problem_id
stringlengths
6
6
user_id
stringlengths
10
10
time_limit
float64
1k
8k
memory_limit
float64
262k
1.05M
problem_description
stringlengths
48
1.55k
codes
stringlengths
35
98.9k
status
stringlengths
28
1.7k
submission_ids
stringlengths
28
1.41k
memories
stringlengths
13
808
cpu_times
stringlengths
11
610
code_sizes
stringlengths
7
505
p02719
u985835425
2,000
1,048,576
Given any integer x, Aoki can do the operation below. Operation: Replace x with the absolute difference of x and K. You are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times.
['N, K = map(int,input().split())\nmin(N%K,K-N%K)', 'N, K = map(int,input().split())\nprint(min(N%K,K-N%K))']
['Wrong Answer', 'Accepted']
['s715178842', 's505449233']
[2940.0, 3060.0]
[17.0, 43.0]
[46, 53]
p02719
u986889396
2,000
1,048,576
Given any integer x, Aoki can do the operation below. Operation: Replace x with the absolute difference of x and K. You are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times.
['str = input().split()\nn = int(str[0])\nk = int(str[1])\nt = n%k\nother = abs(k-t)\nprint(min(t,other))\nif t <= other:\n print(t)\nelse:\n print(other)', 'str = input().split()\na1 = int(str[0])\na2 = int(str[1])\nif a1 >= a2:\n a1 = a2%a1\nif a1 < a2-a1:\n print(a1)\nelse:\n print(a2-a1)', 'str = inp...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s154312188', 's234178883', 's692616309']
[3060.0, 2940.0, 2940.0]
[17.0, 18.0, 17.0]
[149, 135, 98]
p02719
u987326700
2,000
1,048,576
Given any integer x, Aoki can do the operation below. Operation: Replace x with the absolute difference of x and K. You are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times.
['n,k = map(int,input().split())\n\nif abs(n-k)>n:\n while True:\n n -= k\n if n<0:\n break\n \nprint(abs(n))\n ', 'n,k = map(int,input().split())\nnum = 0\nwhile True:\n\tnum = n-k\n if num < 0:\n print(abs(num))', 'n,k = map(int,input().split())\n\n\nif abs(n-k)>n:\n print(n)\nelse:\n whil...
['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s011047203', 's211705211', 's831205206', 's956282717', 's122297138']
[2940.0, 2940.0, 2940.0, 2940.0, 2940.0]
[17.0, 18.0, 2104.0, 17.0, 17.0]
[119, 99, 128, 108, 84]
p02719
u989345508
2,000
1,048,576
Given any integer x, Aoki can do the operation below. Operation: Replace x with the absolute difference of x and K. You are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times.
['from fractions import gcd\nn,k=map(int,input().split())\nif k==1:\n print(0)\nelse:\n print(gcd(n,k))\n', 'n,k=map(int,input().split())\nn=n%k\nprint(min(n,k-n))\n']
['Wrong Answer', 'Accepted']
['s762581727', 's174212877']
[5176.0, 2940.0]
[35.0, 18.0]
[103, 53]
p02719
u991619971
2,000
1,048,576
Given any integer x, Aoki can do the operation below. Operation: Replace x with the absolute difference of x and K. You are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times.
['#K = int(input())\nN,K = map(int,input().split())\n#N = int(input())\n#A = list(map(int,input().split()))\nflag=True\nc=N\nif N%K==0:\n print(0)\nelse:\n l=N//K\n while flag==True:\n\n N=abs(l-K)\n if c <= N:\n flag=False\n else:\n c=N\nprint(c)\n', '#K = int(input(...
['Wrong Answer', 'Accepted']
['s136573160', 's427420919']
[2940.0, 2940.0]
[17.0, 17.0]
[281, 303]
p02719
u992951814
2,000
1,048,576
Given any integer x, Aoki can do the operation below. Operation: Replace x with the absolute difference of x and K. You are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times.
['n,k = map(int,input().split())\nif(k==1):\n print(0)\nelse:\n while(len(n)>1):\n n = n//k\n t = n//k\n for i in range(t):\n n = abs(n-k)\n if(n < abs(k-n)):\n print(n)\n else:\n print(abs(k-n))', 'n,k = map(int,input().split())\nif(k==1):\n print(0)\nelse:\n t = n%k\n if(n < abs(k-n)):\n print...
['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s164789872', 's284389644', 's577129019', 's587127439']
[3060.0, 2940.0, 2940.0, 2940.0]
[17.0, 18.0, 17.0, 17.0]
[199, 130, 91, 92]
p02719
u995163736
2,000
1,048,576
Given any integer x, Aoki can do the operation below. Operation: Replace x with the absolute difference of x and K. You are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times.
['n, k = map(int, input().split())\n\nif n % k == 0:\n print(0)\nelse: \n ans = n % k\n while ans > abs(n-k):\n n = abs(n - k)\n ans = min(n, ans)\n print(ans)', 'n, k = map(int, input().split())\n\nif n % k == 0:\n print(0)\nelse: \n ans = n % k\n #print(ans)\n while ans > k//2:\n n = abs(ans - k)\n ...
['Wrong Answer', 'Accepted']
['s618374325', 's405482473']
[8988.0, 8912.0]
[30.0, 30.0]
[158, 170]
p02719
u995419623
2,000
1,048,576
Given any integer x, Aoki can do the operation below. Operation: Replace x with the absolute difference of x and K. You are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times.
['n,k = map(int,input().split())\nprint(min(n%k,k-n%k)', 'n,k = map(int,input().split())\nprint(min(n%k,k-n%k))']
['Runtime Error', 'Accepted']
['s584198985', 's960220552']
[2940.0, 2940.0]
[17.0, 17.0]
[51, 52]
p02719
u998350437
2,000
1,048,576
Given any integer x, Aoki can do the operation below. Operation: Replace x with the absolute difference of x and K. You are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times.
['n,k=map(int,input().split())\nn=n%k\nprint(n)', 'k=int(input())\n\na=[]\ni=1\nd=0\nwhile True:\n if len(str(i))==1:\n a.append(i)\n elif len(str(i))==2:\n I=str(i)\n c=abs(int(I[0])-int(I[1]))\n if c<=1:\n a.append(i) \n \n elif len(str(i))==3:\n I=s...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s134295644', 's153994084', 's143012066']
[2940.0, 3192.0, 2940.0]
[17.0, 18.0, 18.0]
[43, 1600, 61]
p02720
u023229441
2,000
1,048,576
A positive integer X is said to be a lunlun number if and only if the following condition is satisfied: * In the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1. For example, 1234, 1, and 334 are lunlun numbers, while ...
['n=int(input())\nif n<=10 : \n print(n)\n exit()\n \nans=[0 for i in range(10**5+21)]\nQ=[0,1,2,3]\ndef li(x):\n if x==0 : return [0,1]\n if x==9 : return [8,9]\n return [x-1,x,x+1]\n\nnow=0\nfor q in Q:\n W=[i for i in range(10)] if q==0 else li(q)\n for w in W:\n E=[i for i in range(10)] if [q,w]==[0,0] e...
['Wrong Answer', 'Accepted']
['s023744789', 's632343498']
[13556.0, 7388.0]
[172.0, 151.0]
[1333, 1265]
p02720
u024768467
2,000
1,048,576
A positive integer X is said to be a lunlun number if and only if the following condition is satisfied: * In the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1. For example, 1234, 1, and 334 are lunlun numbers, while ...
['# solution\nk=int(input())\n\nfrom collections import deque\ntodo = deque([i for i in range(1, 10)])\ncount = 0\n\nwhile len(todo) > 0:\n value = todo.popleft()\n seen.append(value)\n value_digit1 = value % 10\n count += 1\n if count == k:\n print(value)\n break\n if value_digit1==0:\n...
['Runtime Error', 'Accepted']
['s881638068', 's918936486']
[3444.0, 11916.0]
[98.0, 129.0]
[596, 573]
p02720
u024782094
2,000
1,048,576
A positive integer X is said to be a lunlun number if and only if the following condition is satisfied: * In the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1. For example, 1234, 1, and 334 are lunlun numbers, while ...
['import itertools\nk=int(input())\nl=[[1,2,3,4,5,6,7,8,9]]\nfor _ in range(10):\n a=[]\n for i in range(len(l[-1])):\n L=l[-1][i]\n if L%10==9:\n a.append(L*10+8)\n a.append(L*10+9)\n elif L%10==0:\n a.append(L*10+0)\n a.append(L*10+1)\n else:\n a.append(L*10+L%10-1)\n a.app...
['Time Limit Exceeded', 'Accepted']
['s452804470', 's779334334']
[1674640.0, 11956.0]
[2196.0, 108.0]
[425, 225]
p02720
u025287757
2,000
1,048,576
A positive integer X is said to be a lunlun number if and only if the following condition is satisfied: * In the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1. For example, 1234, 1, and 334 are lunlun numbers, while ...
['k = int(input())\ndef dfs(s):\n if len(s)<10:\n for i in range(-1, 2, 1):\n s+str(min(9, max(0, int(s[-1])+i)))\n return dfs(s)\n else:\n return s\nS = []\nfor i in range(10):\n S.append(dfs(str(i)))\n ', 'import sys\nsys.setrecursionlimit(10**6)\n\nk = int(input())\nS = []\ndef dfs(s):\n if len(...
['Runtime Error', 'Accepted']
['s849893242', 's489144811']
[3924.0, 47924.0]
[75.0, 504.0]
[211, 296]
p02720
u038815010
2,000
1,048,576
A positive integer X is said to be a lunlun number if and only if the following condition is satisfied: * In the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1. For example, 1234, 1, and 334 are lunlun numbers, while ...
['n=int(input())\na=list(map(int,input().split()))\nfrom collections import Counter\nd=Counter(a)\nimport math\ndef cmb(n,r):\n f = math.factorial\n return int(f(n) // f(r) // f(n-r))\ndef combination(n, r):\n a = 1\n b = 1\n for i in range(r):\n a *= (n - i)\n b *= (i + 1)\n return a //...
['Runtime Error', 'Accepted']
['s688420219', 's666417379']
[3064.0, 8140.0]
[18.0, 313.0]
[429, 386]
p02720
u054514819
2,000
1,048,576
A positive integer X is said to be a lunlun number if and only if the following condition is satisfied: * In the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1. For example, 1234, 1, and 334 are lunlun numbers, while ...
["K = int(input())\n\nmin_r = 0\nmax_r = 12\n\ndef count(idx, n):\n if idx==0:\n return 1\n if n==0:\n return count(idx-1, 1)+count(idx-1, 0)\n elif n==9:\n return count(idx-1, 9)+count(idx-1, 8)\n else:\n return count(idx-1, n-1)+count(idx-1, n)+count(idx-1, n+1)\n\nlists = []\n...
['Runtime Error', 'Accepted']
['s769042221', 's648897608']
[3684.0, 11908.0]
[98.0, 127.0]
[1005, 313]
p02720
u064434060
2,000
1,048,576
A positive integer X is said to be a lunlun number if and only if the following condition is satisfied: * In the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1. For example, 1234, 1, and 334 are lunlun numbers, while ...
['import headq\n\nheap=[]\nN = input()\nfor i in range(10):\n heapq.heappush(heap,i)\nprint(heap)\n', 'import heapq\n \nheap=[]\nN = int(input())\nfor i in range(1,10):\n heapq.heappush(heap,i)\nfor i in range(N):\n x = heapq.heappop(heap)\n if x%10!=0:\n heapq.heappush(heap,10*x+(x%10)-1)\n heapq.heappush(heap...
['Runtime Error', 'Accepted']
['s276755181', 's124102687']
[3064.0, 11728.0]
[18.0, 196.0]
[91, 284]
p02720
u065578867
2,000
1,048,576
A positive integer X is said to be a lunlun number if and only if the following condition is satisfied: * In the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1. For example, 1234, 1, and 334 are lunlun numbers, while ...
['k = int(input())\na[i] = [1, 2, 3, 4, 5, 6, 7, 8, 9]\n\nfor i in range(k):\n if a[i] % 10 != 0:\n a.append(10*a[i] + a[i] % 10 - 1)\n a.append(10*a[i] + a[i] % 10)\n if a[i] % 10 != 9:\n a.append(10*a[i] + a[i] % 10 + 1)\n\nprint(a[k - 1])\n', 'k = int(input())\na = [1, 2, 3, 4, 5, 6, 7, 8, 9]\...
['Runtime Error', 'Accepted']
['s453451385', 's298160640']
[3060.0, 15784.0]
[17.0, 151.0]
[253, 250]
p02720
u070201429
2,000
1,048,576
A positive integer X is said to be a lunlun number if and only if the following condition is satisfied: * In the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1. For example, 1234, 1, and 334 are lunlun numbers, while ...
["k = int(input())\nl = ['1','2','3','4','5','6','7','8','9']\nlf = ['1','2','3','4','5','6','7','8','9']\nsum = 9\nwhile sum < k:\n lff = []\n for i in lf:\n if i[-1] == [0]:\n lff.append(i+'0')\n lff.append(i+'1')\n elif i[-1] == [9]:\n lff.append(i+'8')\n ...
['Runtime Error', 'Accepted']
['s161746179', 's113030118']
[3064.0, 18296.0]
[17.0, 163.0]
[510, 506]
p02720
u072717685
2,000
1,048,576
A positive integer X is said to be a lunlun number if and only if the following condition is satisfied: * In the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1. For example, 1234, 1, and 334 are lunlun numbers, while ...
["import sys\nsys.setrecursionlimit(10**6)\nread = sys.stdin.read\nreadlines = sys.stdin.readlines\nfrom math import log10,ceil\ndef main():\n k = int(input())\n k2 = ceil(k / 10)\n def getlun(n):\n lunluns.append(n)\n ns = str(n)\n print(lunluns)\n if len(ns) > k2:\n pas...
['Runtime Error', 'Accepted']
['s812734288', 's560060939']
[141848.0, 38380.0]
[1376.0, 266.0]
[772, 748]
p02720
u075012704
2,000
1,048,576
A positive integer X is said to be a lunlun number if and only if the following condition is satisfied: * In the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1. For example, 1234, 1, and 334 are lunlun numbers, while ...
["from itertools import product\nK = int(input())\n\nans = []\nfor l in range(10):\n for s in range(1, 10):\n for pattern in product([-1, 0, 1], repeat=l):\n X = [s]\n for p in pattern:\n if not (0 <= X[-1] + p <= 9):\n break\n X.append(X[...
['Wrong Answer', 'Accepted']
['s965417070', 's300572695']
[17832.0, 11036.0]
[1093.0, 1237.0]
[413, 418]
p02720
u075595666
2,000
1,048,576
A positive integer X is said to be a lunlun number if and only if the following condition is satisfied: * In the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1. For example, 1234, 1, and 334 are lunlun numbers, while ...
['a = [1,2,3,4,5,6,7,8,9,10,100,1000,10000,100000,1000000,10000000,100000000,1000000000]\nimport heapq\nheapq.heapify(a)\ncnt = 18\nc = 1\nwhile True:\n if cnt > 10**5:\n break\n for i in a:\n if len(str(i)) == c:\n m = i//10**(c-1)\n if i//10**(c-1) == 1:\n heapq.heappush(a,i+10**c*(i//10**(c-...
['Wrong Answer', 'Accepted']
['s083932874', 's549172628']
[12352.0, 12352.0]
[464.0, 469.0]
[916, 918]
p02720
u078181689
2,000
1,048,576
A positive integer X is said to be a lunlun number if and only if the following condition is satisfied: * In the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1. For example, 1234, 1, and 334 are lunlun numbers, while ...
['k = int(input())\n\nnumset = {i for i in range(1,10)}\nflag = False\ncount = len(numset)\nif count >= k:\n flag = True\narr = [numset]\nindex = 0\n\nwhile not flag:\n beforeset = arr[index]\n tmpset = set()\n for i in beforeset:\n tail = str(i)[-1]\n if tail == "0":\n tmpset.add(i...
['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted']
['s099391033', 's435545136', 's463182007', 's303119406']
[20236.0, 3064.0, 3316.0, 11956.0]
[294.0, 17.0, 21.0, 125.0]
[855, 284, 290, 290]
p02720
u089142196
2,000
1,048,576
A positive integer X is said to be a lunlun number if and only if the following condition is satisfied: * In the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1. For example, 1234, 1, and 334 are lunlun numbers, while ...
['K=int(input())\nx=[[0] for _ in range(11)]\ny=[ 0 for _ in range(11)]\n\nx[1]=[1,2,3,4,5,6,7,8,9]\ny[1]=9\n\nfor i in range(2,11):\n x[i].pop()\n for num in x[i-1]:\n last = num%10\n if last==0:\n x[i].append(10*num)\n x[i].append(10*num+1)\n y[i] +=2\n elif last==9:\n x[i].append(10*nu...
['Runtime Error', 'Accepted']
['s570372919', 's579139708']
[12000.0, 12000.0]
[84.0, 84.0]
[700, 680]
p02720
u090972687
2,000
1,048,576
A positive integer X is said to be a lunlun number if and only if the following condition is satisfied: * In the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1. For example, 1234, 1, and 334 are lunlun numbers, while ...
['from collections import deque\n\nk = int(input())\n\nque = deque([1,2,3,4,5,6,7,8,9])\n\nfor n in range(0, k):\n x = que.popleft()\n if x % 10 != 0:\n que.append(x * 10 + x % 10 - 1)\n q.append(c * 10 + c % 10)\n if x % 10 != 9:\n que.append(x * 10 + x % 10 + 1)\n\nprint(x)', 'from collections import deque\...
['Runtime Error', 'Accepted']
['s533445708', 's168151011']
[3316.0, 11908.0]
[21.0, 123.0]
[270, 272]
p02720
u091307273
2,000
1,048,576
A positive integer X is said to be a lunlun number if and only if the following condition is satisfied: * In the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1. For example, 1234, 1, and 334 are lunlun numbers, while ...
['def main():\n k = int(input())\n hp = list(range(1, 10))\n for i in range(k-1):\n n = hp.pop(0)\n if n % 10 != 0:\n hp.append(n * 10 + n - 1)\n hp.append(n * 10 + n)\n if n % 10 != 9:\n hp.append(n * 10 + n + 1)\n print(hp[0])\n', 'def main():\n k = int...
['Wrong Answer', 'Accepted']
['s253804167', 's527845365']
[8868.0, 13972.0]
[27.0, 43.0]
[279, 384]
p02720
u095021077
2,000
1,048,576
A positive integer X is said to be a lunlun number if and only if the following condition is satisfied: * In the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1. For example, 1234, 1, and 334 are lunlun numbers, while ...
['\nfrom collections import deque\n\n\ndef f(x):\n s=str(x) \n y=int(s[-1]) \n return s+str(y-1) \n\n\ndef g(x):\n s=str(x) \n y=int(s[-1]) \n return s+str(y) \n\n\ndef h(x):\n s=str(x) \n y=int(s[-1]) \n return s+str(y+1) \n\n\nK=int(input())\n\n\nq=deque()\n\n\nfor i in range(1, 10):\n q.append(i)\n \n\n\n...
['Runtime Error', 'Accepted']
['s360365174', 's545939007']
[3060.0, 10876.0]
[17.0, 368.0]
[1690, 1707]
p02720
u096190786
2,000
1,048,576
A positive integer X is said to be a lunlun number if and only if the following condition is satisfied: * In the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1. For example, 1234, 1, and 334 are lunlun numbers, while ...
['def main(argv):\n k = int(sys.stdin.readline().rstrip("\\n"))\n if k < 10:\n return print(k)\n d = {i: [i] for i in range(10)}\n\n counter = 9\n n = 1\n while counter < k:\n next_d = {}\n candidates = d[0]\n candidates.extend(d[1])\n next_d[0] = sorted([c for c in ...
['Runtime Error', 'Accepted']
['s385729613', 's914305761']
[3064.0, 8204.0]
[17.0, 80.0]
[888, 902]
p02720
u104935308
2,000
1,048,576
A positive integer X is said to be a lunlun number if and only if the following condition is satisfied: * In the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1. For example, 1234, 1, and 334 are lunlun numbers, while ...
['def main():\n K = int(input())\n\n q = queue.Queue()\n for i in range(9):\n q.put(i+1)\n\n count = 0\n while True:\n count = count+1\n a = q.get()\n\n if count == K:\n break\n\n tail = int(str(a)[-1])\n for i in range(10):\n if abs(tail-i)...
['Wrong Answer', 'Accepted']
['s939674420', 's011967653']
[3064.0, 12768.0]
[17.0, 1457.0]
[383, 436]
p02720
u106181248
2,000
1,048,576
A positive integer X is said to be a lunlun number if and only if the following condition is satisfied: * In the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1. For example, 1234, 1, and 334 are lunlun numbers, while ...
['k = int(input())\ni = 1 \nc = 0 \n\nif k > 13000:\n i = 34454557\n c = 13000\n\nwhile c < k:\n j = str(i)\n if i < 13: \n c = c + 1 \n #print(c, i)\n else: \n x = 0\n for n in range(len(j)-1): 判定を行う\n if abs(int(j[n]) - int(j[n+1])) > 1:\n x = 1\n break\n if x == 0:\n c...
['Time Limit Exceeded', 'Wrong Answer', 'Time Limit Exceeded', 'Accepted']
['s460226070', 's656660990', 's885359081', 's145412506']
[3064.0, 3316.0, 3064.0, 15784.0]
[2104.0, 2104.0, 2104.0, 125.0]
[520, 488, 490, 284]
p02720
u106778233
2,000
1,048,576
A positive integer X is said to be a lunlun number if and only if the following condition is satisfied: * In the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1. For example, 1234, 1, and 334 are lunlun numbers, while ...
['k=int(input())\n\nfrom collections import deque\ng=deque((1,2,3,4,5,6,7,8,9))\n\nb=[[str(k) for k in range(10) if -2<=k-i<3] for i in range(10)]\n\nfor i in range(10,1000000):\n i1=list(str(i))\n e1=len(i1)\n for h in range(e1-1):\n if not i1[h+1] in b[int(i1[h])]:\n break\n else:g.append(i)\n\n\nprint(g[...
['Runtime Error', 'Accepted']
['s230619123', 's330103146']
[4280.0, 11908.0]
[2000.0, 137.0]
[307, 303]
p02720
u133745933
2,000
1,048,576
A positive integer X is said to be a lunlun number if and only if the following condition is satisfied: * In the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1. For example, 1234, 1, and 334 are lunlun numbers, while ...
['\nK = int(input())\nn = 0\ncnt = 0\ntmp = 0\nwhile cnt < K:\n n = n + 1\n print(n)\n nDigit = []\n nDiv = []\n flg = True\n digits = len(str(n))\n tmpN = n\n for i in range(0,digits) :\n nDigit.append(tmpN // (10 ** (digits-i-1)))\n tmpN = tmpN % (10 ** (digits-i-1))\n if le...
['Wrong Answer', 'Accepted']
['s841201514', 's586569005']
[4996.0, 5880.0]
[2104.0, 392.0]
[980, 336]
p02720
u133936772
2,000
1,048,576
A positive integer X is said to be a lunlun number if and only if the following condition is satisfied: * In the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1. For example, 1234, 1, and 334 are lunlun numbers, while ...
['k=int(input());l=list(range(1,10))\nfor i in l:\n if len(l)==k: print(i); break\n for j in range(max(i%10-1,0),min(i%10+2,10)): l+=[i*10+j]', 'k=int(input());l=list(range(1,10))\nfor i in l:\n for j in range(max(i%10-1,0),min(i%10+2,10)):l+=[i*10+j]\n if len(l)>k:break\nprint(l[k-1])']
['Wrong Answer', 'Accepted']
['s082623734', 's253298621']
[171416.0, 7320.0]
[2115.0, 76.0]
[138, 139]
p02720
u150788544
2,000
1,048,576
A positive integer X is said to be a lunlun number if and only if the following condition is satisfied: * In the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1. For example, 1234, 1, and 334 are lunlun numbers, while ...
["n,m = map(int,input().split())\nlst = list(map(int,input().split()))\ns = 0\ntotal = sum(lst)\nfor i in range(n):\n if lst[i] >= total/(4*m):\n s += 1\n \nif s >= m:\n print('Yes')\nelse:\n print('No')\n \n\n", "import sys\nk = int(input())\nlst = [[0]*10 for i in range(10)]\nfor i in range(10):\n ls...
['Runtime Error', 'Accepted']
['s243709798', 's907383449']
[9040.0, 9328.0]
[28.0, 35.0]
[210, 1532]
p02720
u152331265
2,000
1,048,576
A positive integer X is said to be a lunlun number if and only if the following condition is satisfied: * In the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1. For example, 1234, 1, and 334 are lunlun numbers, while ...
['k = int(input())\nlunlun = list(range(1, 10))\n\nfor i in range(k - 1):\n a = lunlun[i]\n b = a * 10 + a % 10\n if a % 10 != 0:\n lunlun.append(b - 1)\n lunlun.append(b)\n if a % 10 != 9:\n lunlun.append(b + 1)\nprint(lunlun)\nprint(lunlun[k - 1])', 'k = int(input())\nli = [i + 1 for i in...
['Wrong Answer', 'Accepted']
['s687680068', 's691469963']
[25876.0, 7200.0]
[131.0, 69.0]
[264, 282]
p02720
u161712560
2,000
1,048,576
A positive integer X is said to be a lunlun number if and only if the following condition is satisfied: * In the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1. For example, 1234, 1, and 334 are lunlun numbers, while ...
["def dfs(inParam, digits, lunlunCount, lunlun):\n if len(inParam) != digits:\n if int(inParam[len(inParam)-1]) == 0:\n nextNumList = [0, 1]\n elif int(inParam[len(inParam)-1]) == 9:\n nextNumList = [8, 9]\n else:\n nextNum = int(inParam[len(inParam)-1])\n ...
['Wrong Answer', 'Time Limit Exceeded', 'Accepted']
['s106124771', 's273055563', 's302309862']
[8428.0, 3064.0, 8568.0]
[521.0, 2104.0, 125.0]
[1135, 1076, 1070]
p02720
u169350228
2,000
1,048,576
A positive integer X is said to be a lunlun number if and only if the following condition is satisfied: * In the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1. For example, 1234, 1, and 334 are lunlun numbers, while ...
['import queue\nk = int(input)\nq = queue.Queue()\n\nfor i in range(1,10):\n q.put(i)\n\nfor i in range(k):\n x = q.get()\n if not x%10 == 0:\n q.put(10*x+(x%10)-1)\n q.put(10*x+(x%10))\n if not x%10 == 9:\n q.put(10*x+(x%10)+1)\n\nprint(x)\n', 'import queue\nk = int(input())\nq = queue.Que...
['Runtime Error', 'Accepted']
['s536705248', 's603082540']
[3952.0, 12452.0]
[27.0, 1036.0]
[253, 255]
p02720
u178465329
2,000
1,048,576
A positive integer X is said to be a lunlun number if and only if the following condition is satisfied: * In the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1. For example, 1234, 1, and 334 are lunlun numbers, while ...
['import queue\n\nn = int(input())\n\n\nq = queue.Queue()\n\nfor i in range(1,10):\n q.put(i)\n\nx = 0\nfor i in range(n):\n x = q.get()\n l = x % 10\n print(x,l)\n if l != 0:\n q.put(x*10 + l - 1)\n q.put(x*10 + l)\n if l != 9:\n q.put(x*10 + l + 1)\n \n#while not q.empty():\n...
['Wrong Answer', 'Accepted']
['s623077244', 's818837577']
[14036.0, 12480.0]
[1264.0, 1043.0]
[331, 332]
p02720
u185405877
2,000
1,048,576
A positive integer X is said to be a lunlun number if and only if the following condition is satisfied: * In the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1. For example, 1234, 1, and 334 are lunlun numbers, while ...
['n=int(input())\nfrom collections import deque\nk=deque([])\nz=0\nfor i in range(1,10):\n k.append(i)\nwhile z<n:\n m=k.pop\n k.popleft\n if m%10!=0:\n k.append(10*m+(m%10)-1)\n k.append(10*m+(m%10))\n if m%10!=9:\n k.append(10*m+(m%10)+1)\nprint(m)\n ', '\nn=int(input())\nfrom colle...
['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s018902581', 's373498926', 's933441348', 's704913539']
[3316.0, 371288.0, 371928.0, 6088.0]
[21.0, 2126.0, 2127.0, 69.0]
[271, 547, 281, 536]
p02720
u199830845
2,000
1,048,576
A positive integer X is said to be a lunlun number if and only if the following condition is satisfied: * In the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1. For example, 1234, 1, and 334 are lunlun numbers, while ...
['import sys\nfrom collections import deque\nsys.setrecursionlimit(10 ** 6) \nto_index = lambda x: int(x) - 1 \nprint_list_in_2D = lambda x: print(*x, sep="\\n") \n\n\ndef input_int():\n return int(input())\n\ndef map_int_input():\n return map(int, input())\n\nMII = map_int_input\n\ndef MII_split():\n retur...
['Runtime Error', 'Accepted']
['s357608935', 's758886099']
[3064.0, 11960.0]
[18.0, 118.0]
[1544, 1544]
p02720
u201387466
2,000
1,048,576
A positive integer X is said to be a lunlun number if and only if the following condition is satisfied: * In the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1. For example, 1234, 1, and 334 are lunlun numbers, while ...
['import sys\ninput=sys.stdin.readline\nK = int(input())\nLEN = 3234566667\n#S = input()[:-1]\n#N,M = map(int,input().split())\n#S,T = map(str,input().split())\n#A = list(map(int,input().split()))\n#A = [int(input()) for _ in range(N)]\n#S = [input() for _ in range(N)]\n#A = [list(map(int,input().split())) for _ in ran...
['Runtime Error', 'Accepted']
['s100023362', 's595724635']
[3064.0, 508532.0]
[20.0, 867.0]
[1209, 1207]
p02720
u207235471
2,000
1,048,576
A positive integer X is said to be a lunlun number if and only if the following condition is satisfied: * In the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1. For example, 1234, 1, and 334 are lunlun numbers, while ...
['from collections import deque\nk=int(input())\ndeq=deque([1,2,3,4,5,6,7,8,9])\nfor in in range(k):\n a=deq.popleft()\n if not a%10==0:\n deq.append(a*10+a%10-1)\n deq.append(a*10+a%10)\n if a%10==9:\n deq.append(a*10+a%10+1)\nprint(a)\n \n ', 'from collections import deque\nk=int(input())\ndeq=deque([1,...
['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s073757114', 's185071064', 's936583369', 's401832876']
[2940.0, 6456.0, 2940.0, 11908.0]
[17.0, 93.0, 18.0, 127.0]
[242, 258, 241, 254]
p02720
u215286521
2,000
1,048,576
A positive integer X is said to be a lunlun number if and only if the following condition is satisfied: * In the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1. For example, 1234, 1, and 334 are lunlun numbers, while ...
['x = int(input())\n\np = []\nfor i in range(1, 10):\n p.append(i)\n\nans = 0\nindex = x\n\nwhile 1:\n if index <= len(p):\n break\n index -= len(p)\n for i in p:\n for j in range(-1, 2):\n d = i % 10 + j\n if d < 0 or d > 9:\n continue\n\n nx = i * 10 + d\n ...
['Time Limit Exceeded', 'Accepted']
['s384822403', 's853254286']
[190744.0, 12104.0]
[2116.0, 90.0]
[347, 820]
p02720
u218838821
2,000
1,048,576
A positive integer X is said to be a lunlun number if and only if the following condition is satisfied: * In the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1. For example, 1234, 1, and 334 are lunlun numbers, while ...
['k = int(input())\n\ncount = 0\n\nfor i in range(1,10**10):\n l = len(str(i))\n if l == 1:\n count +=1\n ans = i\n if count == k:\n print(ans)\n break\n else:\n continue\n else:\n for j in range(l-1):\n if not abs(int(str(i)[j]) - ...
['Time Limit Exceeded', 'Accepted']
['s509425948', 's507739302']
[3064.0, 12452.0]
[2104.0, 1048.0]
[478, 333]
p02720
u223663729
2,000
1,048,576
A positive integer X is said to be a lunlun number if and only if the following condition is satisfied: * In the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1. For example, 1234, 1, and 334 are lunlun numbers, while ...
["import sys\nfrom itertools import accumulate\nK = int(input())\n\nMAX = 22\ndp = [[0]*10 for _ in [0]*MAX]\n\nfor j in range(0, 10):\n dp[1][j] = 1\n\nfor i in range(2, MAX):\n for j in range(1, 9):\n dp[i][j] = dp[i-1][j-1] + dp[i-1][j] + dp[i-1][j+1]\n dp[i][0] = dp[i-1][0] + dp[i-1][1]\n dp[i][9...
['Wrong Answer', 'Accepted']
['s661457115', 's988782833']
[3188.0, 11884.0]
[18.0, 109.0]
[1085, 327]
p02720
u228303592
2,000
1,048,576
A positive integer X is said to be a lunlun number if and only if the following condition is satisfied: * In the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1. For example, 1234, 1, and 334 are lunlun numbers, while ...
['k = int(input())\ncand = [[1,2,3,4,5,6,7,8,9]]\nfor i in range(9):\n tmp = []\n for val in cand[-1]:\n if val % 10 != 0:\n tmp.append(val*10 + (val%10 - 1))\n tmp.append(val*10 + (val % 10))\n if val % 10 != 9:\n tmp.append(val*10 + (val%10 + 1))\n cand.append(tmp)\n\nans = []\nfor j in range(le...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s546431013', 's747992050', 's014467789']
[27384.0, 54420.0, 22116.0]
[116.0, 324.0, 88.0]
[394, 395, 394]
p02720
u232903302
2,000
1,048,576
A positive integer X is said to be a lunlun number if and only if the following condition is satisfied: * In the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1. For example, 1234, 1, and 334 are lunlun numbers, while ...
['import itertools\ndigits1 = [str(i) for i in range(1,10)]\ndigits2 = list(itertools.chain.from_iterable([addLunLun(i) for i in digits1]))\ndigits3 = list(itertools.chain.from_iterable([addLunLun(i) for i in digits2]))\ndigits4 = list(itertools.chain.from_iterable([addLunLun(i) for i in digits3]))\ndigits5 = list(iter...
['Runtime Error', 'Accepted']
['s233896526', 's299641413']
[3064.0, 23140.0]
[17.0, 137.0]
[910, 1227]
p02720
u235210692
2,000
1,048,576
A positive integer X is said to be a lunlun number if and only if the following condition is satisfied: * In the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1. For example, 1234, 1, and 334 are lunlun numbers, while ...
['que = queue.Queue()\n\nfor i in range(1, 10):\n que.put(i)\n\nfor i in range(1, k + 1):\n ans = que.get()\n keta1 = ans % 10\n if keta1 == 0:\n append_list = [ans * 10, ans * 10 + 1]\n elif keta1 == 9:\n append_list = [ans * 10 + 8, ans * 10 + 9]\n else:\n append_list = [ans * 1...
['Runtime Error', 'Wrong Answer', 'Accepted']
['s924459987', 's971795851', 's702589144']
[9040.0, 9572.0, 18680.0]
[25.0, 34.0, 581.0]
[421, 12, 453]
p02720
u242196904
2,000
1,048,576
A positive integer X is said to be a lunlun number if and only if the following condition is satisfied: * In the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1. For example, 1234, 1, and 334 are lunlun numbers, while ...
['from collections import deque\nk = int(input())\nd = deque()\nd += [1,2,3,4,5,6,7,8,9]\nfor i in range(k):\n# print(d, now)\n now = d.popleft()\n if now%10 != 0:\n d.append(10 * now + now % 10 - 1)\n d.append(10 * now + now % 10)\n if now%10 != 9:\n d.append(10 * now + now % 10 + 1)\npri...
['Wrong Answer', 'Accepted']
['s815430926', 's893304287']
[11908.0, 11908.0]
[119.0, 122.0]
[316, 313]
p02720
u250554058
2,000
1,048,576
A positive integer X is said to be a lunlun number if and only if the following condition is satisfied: * In the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1. For example, 1234, 1, and 334 are lunlun numbers, while ...
['n = int(input())\n\n\n', 'k = int(input())\nn = []\n\ndef dfs(num, A):\n A.append(num)\n\n if(len(str(num)) == 10):\n return 0\n\n for i in range(-1, 2):\n s = num%10 + i\n if(s >= 0 and s <= 9):\n dfs(num * 10 + s, A)\n\n return 0\n\nfor i in range(1, 10):\n dfs(i, n)\n\nn = sorted(n)\n\nprint(n[k...
['Wrong Answer', 'Accepted']
['s382687847', 's676915014']
[9200.0, 20820.0]
[23.0, 143.0]
[19, 278]
p02720
u265154666
2,000
1,048,576
A positive integer X is said to be a lunlun number if and only if the following condition is satisfied: * In the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1. For example, 1234, 1, and 334 are lunlun numbers, while ...
["# -*- coding: utf-8 -*-\n\n'''\n100000\n99990\n90000\n'''\n\nK = int(input())\n# K = 100000 - K\n\n# c = list(str(3234566667))\n\nc = 1\n\nfor i in range(K):\n str_c = list(str(c))\n str_c = [int(i) for i in str_c][::-1]\n\n keta = len(str_c)\n # print(c)\n # print(str_c)\n\n if set(str_c) == set([9...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s491311365', 's753864872', 's639915415']
[3064.0, 3064.0, 3064.0]
[875.0, 129.0, 909.0]
[1400, 1153, 1402]
p02720
u266014018
2,000
1,048,576
A positive integer X is said to be a lunlun number if and only if the following condition is satisfied: * In the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1. For example, 1234, 1, and 334 are lunlun numbers, while ...
['k = int(input())\nstack = list(range(1,10))\nfor i in range(k):\n num = stack.pop(0)\n if (m:=num%10) == 0:\n stack.append([num*10 + m,num*10+m+1])\n elif m == 9:\n stack.append([num*1 + m -1,num*10 + m])\n else:\n stack.append([num*10 + m -1,num*10 + m, num*10+ m + 1])\nprint(num)', "def main():\n im...
['Runtime Error', 'Accepted']
['s484463830', 's893124651']
[9196.0, 18952.0]
[25.0, 82.0]
[285, 560]
p02720
u267466261
2,000
1,048,576
A positive integer X is said to be a lunlun number if and only if the following condition is satisfied: * In the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1. For example, 1234, 1, and 334 are lunlun numbers, while ...
['import queue\n\nk = int(input())\nq = queue.Queue()\nfor i in range(1,9):\n q.put(i)\n\nn = 0\nwhile True:\n val = q.get()\n if val % 10 != 0:\n q.put(10 * val + (val % 10) - 1)\n q.put(10 * val + (val % 10))\n if val % 10 != 9:\n q.put(10 * val + (val % 10) + 1)\n \n n += 1\n if n == k:\n print(val)...
['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s375761349', 's525315077', 's785620541', 's393708182']
[12544.0, 12544.0, 2940.0, 12452.0]
[1052.0, 1060.0, 17.0, 1088.0]
[310, 310, 309, 315]
p02720
u290886932
2,000
1,048,576
A positive integer X is said to be a lunlun number if and only if the following condition is satisfied: * In the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1. For example, 1234, 1, and 334 are lunlun numbers, while ...
['def Add_(N):\n M = N\n C = 1\n while M > 10:\n M = M // 10\n C += 1\n if M == 1:\n return [ M * 10**C + N,(M+1) * 10**C + N ]\n elif M == 9:\n return [ (M-1) * 10**C + N, M * 10**C + N ]\n else:\n return [(M-1) * 10**C + N, M * 10**C + N,(M+1) * 10**C + N ]\n\nX = ...
['Wrong Answer', 'Accepted']
['s684771562', 's282671994']
[9000.0, 13280.0]
[129.0, 81.0]
[727, 535]
p02720
u296557772
2,000
1,048,576
A positive integer X is said to be a lunlun number if and only if the following condition is satisfied: * In the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1. For example, 1234, 1, and 334 are lunlun numbers, while ...
['from collections import deque\ndef main(k):\n q = deque([])\n for i in range(10):\n q.append(i)\n \n count = 0\n top = -1\n while True:\n top = q.popleft()\n\n count += 1\n if count == k:\n return top\n\n if top%10 != 0:\n q.append(top*10 + to...
['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s041573355', 's111689294', 's637364500', 's655304566']
[11868.0, 3316.0, 11904.0, 11904.0]
[112.0, 22.0, 115.0, 114.0]
[451, 442, 458, 468]
p02720
u306950978
2,000
1,048,576
A positive integer X is said to be a lunlun number if and only if the following condition is satisfied: * In the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1. For example, 1234, 1, and 334 are lunlun numbers, while ...
['k = int(input())\ncou = 0\nwhile True:\n cou += 1\n t = q.get()\n if cou == k:\n print(t)\n exit()\n if t % 10 == 0:\n q.put(t*10)\n q.put(t*10 + 1)\n elif t % 10 == 9:\n q.put(t*10 + 8)\n q.put(t*10 + 9)\n else:\n s = t % 10\n q.put(t*10 + s -...
['Runtime Error', 'Accepted']
['s964271188', 's771033283']
[3064.0, 12576.0]
[17.0, 1056.0]
[328, 424]
p02720
u311488536
2,000
1,048,576
A positive integer X is said to be a lunlun number if and only if the following condition is satisfied: * In the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1. For example, 1234, 1, and 334 are lunlun numbers, while ...
['from collections import deque\nK = int(input())\nqueue = deque([1,2,3,4,5,6,7,8,9])\ncount = 1\nwhile count <= K:\n num = queue.popleft()\n if num%10!=0:\n queue.append(num*10+num%10-1)\n queue.append(num*10+num%10)\n if num%!=9:\n queue.append(num*10+num%10+1)\n \nprint(num)', 'from collections import deq...
['Runtime Error', 'Accepted']
['s387024926', 's946438591']
[9040.0, 18832.0]
[23.0, 110.0]
[275, 288]
p02720
u314089899
2,000
1,048,576
A positive integer X is said to be a lunlun number if and only if the following condition is satisfied: * In the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1. For example, 1234, 1, and 334 are lunlun numbers, while ...
['#161d\nimport math\nimport copy\n\nK = int(input())\n\nketa = 1\nlunlun_numbers_list = [1,2,3,4,5,6,7,8,9]\nlunlun_numbers_numer = 9\n\nif K <=9:\n print(lunlun_numbers_list[K-1])\nelse:\n while 1:\n new_lunlun_numbers_list = list()\n for lower_keta in lunlun_numbers_list:\n ketasu = in...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s279259793', 's374351850', 's287140195']
[16188.0, 2940.0, 11692.0]
[251.0, 17.0, 141.0]
[1498, 530, 1238]
p02720
u332933608
2,000
1,048,576
A positive integer X is said to be a lunlun number if and only if the following condition is satisfied: * In the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1. For example, 1234, 1, and 334 are lunlun numbers, while ...
['def d1(x):\n y = x % 10\n if y == 0:\n return [0, 1]\n elif y == 9:\n return [8, 9]\n else:\n return [y-1, y, y+1]\n\n\nK = int(input())\n\nrunrun = []\nN = 0\ndigit = 0\nwhile N < K:\n d_i = []\n if digit == 0:\n for i in range(1, 10):\n d_i.append(i)\n ...
['Wrong Answer', 'Accepted']
['s971611421', 's089662566']
[11996.0, 11996.0]
[85.0, 87.0]
[577, 578]
p02720
u336564899
2,000
1,048,576
A positive integer X is said to be a lunlun number if and only if the following condition is satisfied: * In the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1. For example, 1234, 1, and 334 are lunlun numbers, while ...
['k = int(input())\ntime = 1\n\ndp0 = [1]#0,9\ndp1 = [8]#1~8\np = [9]\n\nfor i in range(100):\n dp0.append(dp0[i]*2 + 2)\n dp1.append(dp1[i]*3 - 2)\n p.append(dp0[i+1] + dp1[i+1] + p[i])\n\n if p[len(p)-1] > k:\n break\n\n#print(len(p))\ns = k - p[len(p)-2]\nw = [0]*len(p)\nprint(s,w)\n', 'import col...
['Wrong Answer', 'Accepted']
['s532212290', 's105023131']
[3064.0, 11872.0]
[17.0, 140.0]
[285, 385]
p02720
u349724238
2,000
1,048,576
A positive integer X is said to be a lunlun number if and only if the following condition is satisfied: * In the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1. For example, 1234, 1, and 334 are lunlun numbers, while ...
["K = int(input())\nA = [1,2,3,4,5,6,7,8,9,10]\nfor i in range(len(A)):\n if A[i] % 10 == 0:\n A.append(100)\n A.append(101)\n elif A[i] != 9:\n for j in range(-1,2):\n a = int(str(A[i]) + str(A[i]+j))\n A.append(a)\n else:\n A.append(98)\n A.append(99)\...
['Wrong Answer', 'Accepted']
['s384856332', 's910559056']
[13200.0, 12864.0]
[276.0, 260.0]
[3176, 739]
p02720
u350997995
2,000
1,048,576
A positive integer X is said to be a lunlun number if and only if the following condition is satisfied: * In the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1. For example, 1234, 1, and 334 are lunlun numbers, while ...
['K = int(input())\nA = "0123456789"\nS = [i for i in range(1,10)]\nQ = [str(i) for i in range(1,10)]\nwhile Q:\n q = Q.pop(0)\n D = []\n if q[-1]=="0":\n D = [q+"0",q+"1"]\n elif q[-1]=="9":\n D = [q+"0",q+"1"]\n else:\n a = A.index(q[-1])\n D = [q+A[a-1],q+A[a],q+A[a+1]]\n ...
['Time Limit Exceeded', 'Accepted']
['s881060674', 's834102475']
[21096.0, 28184.0]
[2109.0, 509.0]
[411, 381]
p02720
u354126779
2,000
1,048,576
A positive integer X is said to be a lunlun number if and only if the following condition is satisfied: * In the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1. For example, 1234, 1, and 334 are lunlun numbers, while ...
['k=int(input())\nA=[[1,1,1,1,1,1,1,1,1,1]]\nfor i in range(9):\n Ai=[]\n Ai.append(A[i][0]+A[i][1])\n for j in range(8):\n Ai.append(A[i][j]+A[i][j+1]+A[i][j+2])\n Ai.append(A[i][7]+A[i][8])\n A.append(Ai)\nc=[]\nfor i in range(len(A)):\n c.append(sum(A[i][1:10]))\nl=1 #length of number\nwhile...
['Runtime Error', 'Runtime Error', 'Accepted']
['s880125695', 's962301671', 's655455544']
[3064.0, 3064.0, 12480.0]
[17.0, 17.0, 1015.0]
[757, 767, 232]
p02720
u354492470
2,000
1,048,576
A positive integer X is said to be a lunlun number if and only if the following condition is satisfied: * In the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1. For example, 1234, 1, and 334 are lunlun numbers, while ...
['k = int(input())\n\nque = [1,2,3,4,5,6,7,8,9]\n\nfor i in range(k):\n x = que[0]\n del que[0]\n if x%10 != 0:\n que.append(10*x+(x%10)-1)\n que.append(10*x+(x%10))\n if x%10 != 9:\n que.append(10*x+(x%10)+1)\n print(x)', 'from collections import deque\nk = int(input())\nq = deque(list(...
['Wrong Answer', 'Accepted']
['s217497314', 's714428397']
[11760.0, 11912.0]
[2104.0, 131.0]
[238, 240]
p02720
u359178469
2,000
1,048,576
A positive integer X is said to be a lunlun number if and only if the following condition is satisfied: * In the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1. For example, 1234, 1, and 334 are lunlun numbers, while ...
['K=int(input())\nA=[1,2,3,4,5,6,7,8,9]\nI=0\nwhile I<=K:\n if not A[I]%10==0:\n A.append(A[I]%10+10*A[I]-1)\n A.append(A[I]%10+10*A[I])\n if not A[I]%10==9:\n A.append(A[I]%10+10*A[I]+1)\n I+=1\n if len(A)>=K:\n break\nprint(A[I])', 'K=int(input())\nA=[1,2,3,4,5,6,7,8,9]\nI=0\nwhile I...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s196349068', 's446102488', 's291342808']
[7228.0, 7228.0, 7216.0]
[69.0, 66.0, 71.0]
[251, 251, 253]
p02720
u375253797
2,000
1,048,576
A positive integer X is said to be a lunlun number if and only if the following condition is satisfied: * In the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1. For example, 1234, 1, and 334 are lunlun numbers, while ...
['import math\n\nnum = int(input())\n\nbox = [1,2,3,4,5,6,7,8,9]\nk=0\n\nwhile True:\n \n if len(box)==num:\n print(box[num-1])\n break\n\n k = k+1 \n k1 = str(k)\n for i in range(len(k1)-1):\n if i == len(k1)-2:\n if abs(int(k1[i])-int(k1[i+1]))<=1:\n box.a...
['Wrong Answer', 'Accepted']
['s060714390', 's608771075']
[3188.0, 7272.0]
[2104.0, 70.0]
[484, 399]
p02720
u377989038
2,000
1,048,576
A positive integer X is said to be a lunlun number if and only if the following condition is satisfied: * In the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1. For example, 1234, 1, and 334 are lunlun numbers, while ...
['def dfs(r):\n global l\n if len(r) == 11:\n return\n l.append(int(r))\n for i in range(-1, 2):\n tmp = int(r[-1]) + i\n if 0 <= tmp <= 9:\n dfs(r + str(tmp))\n\n\nk = int(input())\nl = []\nfor i in range(1, 10):\n dfs(str(i))\nprint(sorted(l)[k])', 'def dfs(d, r):\n g...
['Wrong Answer', 'Accepted']
['s171501051', 's370945622']
[12856.0, 12856.0]
[586.0, 556.0]
[278, 290]
p02720
u391675400
2,000
1,048,576
A positive integer X is said to be a lunlun number if and only if the following condition is satisfied: * In the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1. For example, 1234, 1, and 334 are lunlun numbers, while ...
['import heapq\n\nk = int(input())\n\nlunlun = [1,2,3,4,5,6,7,8,9]\nheapq.heapify(lunlun)\n\nfor i in range(1,10**5):\n x = heapq.heappop(lunlun) \n y = x % 10\n if i == k :\n break\n if y != 0:\n heapq.heappush(lunlun, x * 10 + y- 1)\n heapq.heappush(lunlun,10*x+y)\n if y != 9:\n ...
['Wrong Answer', 'Accepted']
['s771243772', 's877989991']
[18688.0, 11748.0]
[205.0, 194.0]
[377, 375]
p02720
u396210538
2,000
1,048,576
A positive integer X is said to be a lunlun number if and only if the following condition is satisfied: * In the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1. For example, 1234, 1, and 334 are lunlun numbers, while ...
['# from sys import stdin\nimport sys\nglobal cnt1\n\n\ndef bts(A, cnt, max):\n # print(A)\n if cnt == max:\n global cnt1\n cnt1 = cnt1+1\n if cnt1 == K:\n print(A)\n sys.exit()\n return\n cnt = cnt+1\n if A % 10 == 0:\n bts(A*10+(A % 10), cnt, max)\n...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s147030259', 's149217060', 's470379012']
[3188.0, 3064.0, 3188.0]
[2104.0, 91.0, 71.0]
[714, 713, 743]
p02720
u408620326
2,000
1,048,576
A positive integer X is said to be a lunlun number if and only if the following condition is satisfied: * In the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1. For example, 1234, 1, and 334 are lunlun numbers, while ...
['import sys\nsys.setrecursionlimit(10 ** 6)\ninput = sys.stdin.readline\nK = int(input())\nRUN = {\n 0:[0, 1],\n 1:[0, 1, 2],\n 2:[1, 2, 3],\n 3:[2, 3, 4],\n 4:[3, 4, 5],\n 5:[4, 5, 6],\n 6:[5, 6, 7],\n 7:[6, 7, 8],\n 8:[7, 8, 9],\n 9:[8, 9]\n}\ncnt = 0\n\ndef dfs(i, s, p):\n if i == 0...
['Runtime Error', 'Runtime Error', 'Accepted']
['s234458864', 's284614854', 's966272511']
[3064.0, 3064.0, 3064.0]
[18.0, 18.0, 78.0]
[560, 560, 641]
p02720
u432098488
2,000
1,048,576
A positive integer X is said to be a lunlun number if and only if the following condition is satisfied: * In the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1. For example, 1234, 1, and 334 are lunlun numbers, while ...
['import queue\n\nK = int(input())\nA = queue.Queue()\n\nfor i in range(1, 10):\n A.put(i)\n\nnum = 0\nwhile num < K:\n emp = A.get()\n var = emp % 10\n if var != 0:\n A.put(emp*10+var-1)\n A.put(10*emp)\n if var != 9:\n A.put(emp*10+var+1)\n ...
['Wrong Answer', 'Accepted']
['s406842319', 's444825920']
[12728.0, 12480.0]
[1141.0, 1069.0]
[347, 327]
p02720
u432754124
2,000
1,048,576
A positive integer X is said to be a lunlun number if and only if the following condition is satisfied: * In the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1. For example, 1234, 1, and 334 are lunlun numbers, while ...
['from collections import deque\n\nk = int(input())\nq = deque(range(1, 10))\n\nfor i in range(k-1):\n \n x = q.popleft()\n y = int(str(x)[-1])\n if y-1 >= 0:\n print(int(str(x)+str(y-1)))\n q.append(int(str(x)+str(y-1)))\n q.append(int(str(x)+str(x)[-1]))\n if y+1 < 10:\n q.appen...
['Runtime Error', 'Accepted']
['s187178571', 's547826545']
[137184.0, 16620.0]
[1573.0, 253.0]
[364, 327]
p02720
u437215432
2,000
1,048,576
A positive integer X is said to be a lunlun number if and only if the following condition is satisfied: * In the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1. For example, 1234, 1, and 334 are lunlun numbers, while ...
['def f(k):\n def lunlun(n):\n s = [int(i) for i in str(n)]\n for i in range(len(s) - 1):\n if abs(s[i] - s[i + 1]) > 1:\n return False\n return True\n cum_npi = [0, 9, 35, 110, 327, 956, 2782, 8089, 23527, 68468, 199368]\n for i, begin in enumerate(cum_npi):\n ...
['Runtime Error', 'Runtime Error', 'Accepted']
['s496179032', 's731089252', 's478514242']
[2940.0, 2940.0, 9320.0]
[17.0, 17.0, 34.0]
[600, 304, 1969]
p02720
u440161695
2,000
1,048,576
A positive integer X is said to be a lunlun number if and only if the following condition is satisfied: * In the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1. For example, 1234, 1, and 334 are lunlun numbers, while ...
['from collections import deque\nK=int(input())\nd=deque([_ for _ in range(1,10)])\nif K<=9:\n print(K)\n exit()\ni=0\nwhile True:\n a=d.pop()\n i+=1\n if i==K:\n print(a)\n exit()\n if a%10!=0 and a%10!=9:\n d.extend([10*a+(a%10)+i for i in range(-1,2)])\n elif a%10==0:\n d.extend([10*a+i for i in ...
['Wrong Answer', 'Accepted']
['s997295777', 's682209863']
[529636.0, 12008.0]
[2137.0, 193.0]
[365, 377]
p02720
u459150945
2,000
1,048,576
A positive integer X is said to be a lunlun number if and only if the following condition is satisfied: * In the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1. For example, 1234, 1, and 334 are lunlun numbers, while ...
['K = int(input())\nimport sys\nsys.setrecursionlimit(1000000)\nrun = [1, 2, 3, 4, 5, 6, 7, 8, 9]\n\n\ndef runrun(number):\n if len(number) < 16:\n last = int(number[-1])\n if last == 0:\n run.append(int(str(int(number[-1])+0)))\n run.append(int(str(int(number[-1])+1)))\n ...
['Time Limit Exceeded', 'Accepted']
['s303259777', 's783390797']
[481672.0, 11956.0]
[2138.0, 110.0]
[1015, 279]
p02720
u461454424
2,000
1,048,576
A positive integer X is said to be a lunlun number if and only if the following condition is satisfied: * In the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1. For example, 1234, 1, and 334 are lunlun numbers, while ...
['#input\nK = int(input())\n\n#output\nq = queue.Queue()\nfor i in range(1, 10):\n q.put(i)\n\nfor i in range(1, K+2):\n x = q.get()\n if x % 10 != 0:\n q.put(10*x + (x % 10)-1)\n q.put(10*x+(x % 10))\n if x % 10 != 9:\n q.put(10*x + (x % 10)+1)\n if i == K:\n print(x)', 'import q...
['Runtime Error', 'Accepted']
['s669430329', 's071587285']
[3064.0, 12452.0]
[17.0, 1055.0]
[290, 304]
p02720
u471641802
2,000
1,048,576
A positive integer X is said to be a lunlun number if and only if the following condition is satisfied: * In the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1. For example, 1234, 1, and 334 are lunlun numbers, while ...
['K = int(input())\n\nqueue = list(range(1, 10))\n\nif K < 10:\n print(K)\nelse:\n i = 0\n while K > len(queue):\n if queue[i] % 10 != 0:\n l = 10 * queue[i] + queue[i] % 10 - 1\n queue.append(l)\n \n l = 10 * queue[i] + queue[i] % 10\n queue.append(l)\n ...
['Runtime Error', 'Accepted']
['s904876237', 's513272272']
[7200.0, 7200.0]
[66.0, 64.0]
[458, 462]
p02720
u479638406
2,000
1,048,576
A positive integer X is said to be a lunlun number if and only if the following condition is satisfied: * In the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1. For example, 1234, 1, and 334 are lunlun numbers, while ...
['import copy\nk = int(input())\n\ncnt = 0\nfor i in range(1, 100000):\n if i < 9:\n cnt += 1\n else:\n num = copy.copy(i)\n nei = []\n while num < 10:\n nei.append(num%10)\n num /= 10\n for j in range(len(nei)):\n if abs(nei[j] - nei[j+1]) > 1:\n break\n elif abs(nei[j] - ne...
['Time Limit Exceeded', 'Accepted']
['s937966202', 's456168145']
[227068.0, 12476.0]
[2118.0, 1068.0]
[409, 291]
p02720
u484052148
2,000
1,048,576
A positive integer X is said to be a lunlun number if and only if the following condition is satisfied: * In the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1. For example, 1234, 1, and 334 are lunlun numbers, while ...
['from collections import deque\nK = int(input())\nq = deque(str(i) for i in range(1, 10))\ncnt = 9\nif K < 10:\n print(K); return\nwhile True:\n tmp = q.popleft()\n las = int(tmp[-1])\n for i in range(las-1, las+2):\n if 0<=i<=9:\n q.append(tmp + str(i))\n cnt += 1\n ...
['Runtime Error', 'Runtime Error', 'Accepted']
['s049296115', 's323573796', 's525691490']
[9092.0, 91680.0, 13712.0]
[25.0, 389.0, 73.0]
[355, 367, 338]
p02720
u502841298
2,000
1,048,576
A positive integer X is said to be a lunlun number if and only if the following condition is satisfied: * In the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1. For example, 1234, 1, and 334 are lunlun numbers, while ...
["n = int(input())\nD = []\n\ndef FindOtvet(i, j, otv):\n if i == 0:\n return ''\n if j == 0:\n if (otv + D[i - 1][j]) < n:\n otv += D[i - 1][j]\n return str(j + 1) + FindOtvet(i - 1, j + 1, otv)\n else:\n return str(j) + FindOtvet(i - 1, j, otv)\n elif j =...
['Wrong Answer', 'Accepted']
['s387866822', 's974096800']
[3192.0, 3192.0]
[18.0, 18.0]
[1568, 1593]
p02720
u507613674
2,000
1,048,576
A positive integer X is said to be a lunlun number if and only if the following condition is satisfied: * In the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1. For example, 1234, 1, and 334 are lunlun numbers, while ...
['from collections import deque\n\nstdin = sys.stdin\nread_int = lambda : list(map(int,stdin.readline().split()))\n\nK = read_int()[0]\n\nq = deque()\nfor i in range(1, 10):\n q.append(i)\ndef solve():\n for _ in range(K - 1):\n x = q.popleft()\n if x % 10 != 0:\n q.append(10 * x + (x % 1...
['Runtime Error', 'Accepted']
['s073239522', 's551348036']
[3316.0, 12384.0]
[21.0, 105.0]
[499, 499]
p02720
u509739538
2,000
1,048,576
A positive integer X is said to be a lunlun number if and only if the following condition is satisfied: * In the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1. For example, 1234, 1, and 334 are lunlun numbers, while ...
['import math\nimport queue\n\ndef readInt():\n\treturn int(input())\n\ndef readInts():\n\treturn list(map(int, input().split()))\n\ndef readChars():\n\treturn input().split()\n\n\nq = queue.Queue()\n\nfor i in range(1,9):\n\tq.put(i)\n\nn = readInt()\n\nfor i in range(1,100000):\n\ta = str(q.get())\n\tif a[-1]!=0:\n\t...
['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Time Limit Exceeded', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s049132696', 's264392214', 's340515339', 's465685465', 's808426047', 's856764890', 's464890100']
[3952.0, 3952.0, 52232.0, 93816.0, 3832.0, 7704.0, 11536.0]
[26.0, 27.0, 680.0, 2109.0, 21.0, 1055.0, 1435.0]
[443, 440, 522, 536, 6344, 426, 1342]
p02720
u517910772
2,000
1,048,576
A positive integer X is said to be a lunlun number if and only if the following condition is satisfied: * In the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1. For example, 1234, 1, and 334 are lunlun numbers, while ...
['from collections import deque\n\n\ndef lunlun():\n k = int(input())\n q = deque(list(range(1, 10)))\n\n while k > 0:\n k -= 1\n n = q.popleft()\n # print(\'====== popleft:\', n)\n\n if n % 10 != 0:\n n0 = int(str(n) + str(n % 10 - 1))\n q.append(n0)\n ...
['Wrong Answer', 'Accepted']
['s588732862', 's639931705']
[10968.0, 10840.0]
[277.0, 268.0]
[642, 631]
p02720
u524922893
2,000
1,048,576
A positive integer X is said to be a lunlun number if and only if the following condition is satisfied: * In the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1. For example, 1234, 1, and 334 are lunlun numbers, while ...
['import queue\nk=int(input())\nq=queue.Queue()\nfor i in range(1,10):\n q.put(i)\nc=0\nwhile c<k:\n a=q.get()\n c+=1\n print("{}番目:{}".format(c,a))\n if c==k:\n print(a)\n if (a%10)!=0:\n q.put(10*a+a%10-1)\n q.put(10*a+a%10)\n if (a%10)!=9:\n q.put(10*a+a%10+1)', 'import queue\nk=int(input())\nq=queu...
['Wrong Answer', 'Accepted']
['s400110506', 's992666970']
[14820.0, 12452.0]
[1339.0, 1063.0]
[266, 231]
p02720
u528748570
2,000
1,048,576
A positive integer X is said to be a lunlun number if and only if the following condition is satisfied: * In the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1. For example, 1234, 1, and 334 are lunlun numbers, while ...
['import heapq\nl = [1, 2, 3, 4, 5, 6, 7, 8, 9]\nheapq.heapify(l)\n\ndef f(x):\n \n min_x = int(list(str(x))[-1])\n if min_x == 0:\n yield int(x + "0")\n yield int(x + "1")\n elif min_x == 9:\n yield int(x + "8")\n yield int(x + "9")\n else:\n yield int(x + str(min_x - ...
['Runtime Error', 'Runtime Error', 'Accepted']
['s166555582', 's339277500', 's029040658']
[3064.0, 3064.0, 10780.0]
[17.0, 18.0, 435.0]
[597, 597, 616]
p02720
u531579566
2,000
1,048,576
A positive integer X is said to be a lunlun number if and only if the following condition is satisfied: * In the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1. For example, 1234, 1, and 334 are lunlun numbers, while ...
['def dp(i, j, memo):\n key = "{}.{}".format(i, j)\n\n if i == 1:\n memo[key] = 1\n return memo[key]\n\n if key in memo:\n return memo[key]\n\n if j == 0:\n memo[key] = dp(i-1, j, memo) + dp(i-1, j+1, memo)\n return memo[key]\n\n if j == 9:\n memo[key] = dp(i-1, ...
['Wrong Answer', 'Accepted']
['s118650714', 's279665679']
[3064.0, 3192.0]
[17.0, 17.0]
[892, 880]
p02720
u552357043
2,000
1,048,576
A positive integer X is said to be a lunlun number if and only if the following condition is satisfied: * In the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1. For example, 1234, 1, and 334 are lunlun numbers, while ...
['#!/usr/bin/env python3\nans = [0] * 10\nans[1] = \'1\'\nfor i in range(2, 10):\n ans[i] = str(i)\nalpha = "0123456789"\ndef dfs(s):\n if len(s) == N:\n ans.append(s)\n if len(ans) >= 100001:\n return\n else:\n for c in range(int(s[-1])-1,int(s[-1])+2):\n if c >= 0:\...
['Runtime Error', 'Runtime Error', 'Accepted']
['s784835642', 's786848066', 's024622509']
[4488.0, 4552.0, 11052.0]
[78.0, 76.0, 157.0]
[547, 542, 545]
p02720
u567430603
2,000
1,048,576
A positive integer X is said to be a lunlun number if and only if the following condition is satisfied: * In the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1. For example, 1234, 1, and 334 are lunlun numbers, while ...
['from collections import deque\nK = int(input())\nd = deque(range(1, 10))\nfor i in range(K):\n x = d.popleft()\n if x % 10 != 0:\n d.append(10*x-1)\n d.append(10*x)\n if x % 10 != 9:\n d.append(10*x+1)\nprint(x)', 'from collections import deque\nK = int(input())\nd = deque(range(1, 10))\nfor...
['Wrong Answer', 'Accepted']
['s896427334', 's212414917']
[9404.0, 11908.0]
[89.0, 123.0]
[227, 254]
p02720
u572138437
2,000
1,048,576
A positive integer X is said to be a lunlun number if and only if the following condition is satisfied: * In the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1. For example, 1234, 1, and 334 are lunlun numbers, while ...
['cur = []\n\ndef recur(n):\n if n > 10 ** 18:\n return\n cur.append(n)\n for i in range(10):\n if abs(n % 10 - i) <= 1:\n recur(10 * n + i)\n\nfor i in range(1, 10):\n recur(i)\ncur.sort()\nn = int(input())\nprint((cur[n - 1]))', 'cur = []\n\ndef recur(n):\n if n > 10 ** 10:\n ...
['Time Limit Exceeded', 'Accepted']
['s968057386', 's103057122']
[54372.0, 12776.0]
[2110.0, 462.0]
[249, 249]
p02720
u580697892
2,000
1,048,576
A positive integer X is said to be a lunlun number if and only if the following condition is satisfied: * In the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1. For example, 1234, 1, and 334 are lunlun numbers, while ...
['# coding: utf-8\nfrom collections import deque\nK = int(input())\nqueue = [str(i) for i in range(1, 10)]\n\nqueue = deque(queue)\nL = []\ncnt = 0\nwhile cnt <= K:\n v = queue.popleft()\n # L.push(int(v))\n L.append(int(v))\n if v[-1] == "0":\n # print("v =", v)\n queue.append(v + v[-1])\n ...
['Wrong Answer', 'Accepted']
['s001278380', 's416056505']
[20872.0, 20872.0]
[216.0, 223.0]
[639, 638]
p02720
u585348179
2,000
1,048,576
A positive integer X is said to be a lunlun number if and only if the following condition is satisfied: * In the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1. For example, 1234, 1, and 334 are lunlun numbers, while ...
['k=int(input())\n \nfrom collections import deque\nq = deque(range(1, 10))\n\nfor i in range(k-1):\n d = q.popleft()\n if d % 10 != 0:\n q.append(10*d-1)\n q.append(10*d)\n if d % 10 != 9:\n q.append(10*d+1)\n \nprint(q.popleft())', 'k=int(input())\n\nfrom collections import deque\nq = deq...
['Wrong Answer', 'Accepted']
['s912107775', 's416865750']
[9404.0, 11912.0]
[87.0, 126.0]
[245, 302]
p02720
u594803920
2,000
1,048,576
A positive integer X is said to be a lunlun number if and only if the following condition is satisfied: * In the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1. For example, 1234, 1, and 334 are lunlun numbers, while ...
["\nimport sys\n\nsys.setrecursionlimit(10**9)\n\ndef runrun(n):\n if n == 1:\n return [['1','2','3','4','5','6','7','8','9']]\n else:\n li = runrun(n-1)\n li2 = []\n for i in range(len(li[n-2])):\n p = int(li[n-2][i][-1])\n if p == 0:\n li2.append(...
['Wrong Answer', 'Accepted']
['s894502024', 's523206277']
[22064.0, 17820.0]
[213.0, 128.0]
[1374, 1416]
p02720
u595353654
2,000
1,048,576
A positive integer X is said to be a lunlun number if and only if the following condition is satisfied: * In the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1. For example, 1234, 1, and 334 are lunlun numbers, while ...
['# -*- coding: utf-8 -*-\nfrom sys import stdin\nfrom operator import itemgetter\nimport math\n\n\ndef keta(kazu):\n kazu_str = str(kazu)\n kazu_list = [int(kazu_str[i]) for i in range(0, len(kazu_str))]\n return kazu_list\n\nK = int(stdin.readline().rstrip())\na = list(range(1,10))\nb = []\nattack = 100000\n...
['Time Limit Exceeded', 'Time Limit Exceeded', 'Time Limit Exceeded', 'Accepted']
['s603525616', 's885631990', 's888500223', 's020158393']
[13660.0, 13688.0, 13612.0, 16240.0]
[2104.0, 2104.0, 2105.0, 134.0]
[601, 576, 682, 615]
p02720
u597374218
2,000
1,048,576
A positive integer X is said to be a lunlun number if and only if the following condition is satisfied: * In the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1. For example, 1234, 1, and 334 are lunlun numbers, while ...
['K=int(input())\nnumber=[]\nfor i in range(3234566668):\n k=str(i)\n if all([abs(int(k[j])-int(k[j-1]))<=1 for j in range(1,len(k))]):\n number.append(k)\nprint(number[K])', 'from collections import deque\nK=int(input())\nqueue=deque(list(range(1,10)))\nfor i in range(K):\n k=queue.popleft()\n mod=k...
['Time Limit Exceeded', 'Accepted']
['s534398533', 's014076942']
[9196.0, 19664.0]
[2206.0, 134.0]
[177, 256]
p02720
u597455618
2,000
1,048,576
A positive integer X is said to be a lunlun number if and only if the following condition is satisfied: * In the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1. For example, 1234, 1, and 334 are lunlun numbers, while ...
['import collections\n\ndef main():\n k = int(input())\n Q = collections.deque([int(i) for i in range(1, 10)])\n for i in range(k):\n x = Q.popleft()\n if i + len(Q) < k:\n if x%10:\n Q.append(10*x + x%10 - 1)\n Q.append(10*x + x%10)\n if x%10 != 9:...
['Runtime Error', 'Accepted']
['s591562525', 's945862680']
[140492.0, 12108.0]
[1347.0, 61.0]
[418, 491]
p02720
u601575292
2,000
1,048,576
A positive integer X is said to be a lunlun number if and only if the following condition is satisfied: * In the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1. For example, 1234, 1, and 334 are lunlun numbers, while ...
['for i in range(N):\n\tif (A[i]*4*M) >= vote_sum:\n\t\tcnt += 1\n\tif cnt == M:\n\t\tprint(y)\n\t\tbreak\n\t\t\nif C < M:\n\tprint(n)', 'N, M = map(int, input().split())\nA = list(map(int, input().split()))\nvote_sum = sum(A)\ncnt = 0\ny = "Yes"\nn = "No"\n\nfor i in range(N):\n\tif (A[i]*4*M) >= vote_sum:\n\t\tcnt +=...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s158246489', 's200935908', 's628623719', 's117424691']
[2940.0, 3064.0, 3064.0, 12916.0]
[17.0, 17.0, 17.0, 121.0]
[113, 228, 220, 583]
p02720
u619144316
2,000
1,048,576
A positive integer X is said to be a lunlun number if and only if the following condition is satisfied: * In the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1. For example, 1234, 1, and 334 are lunlun numbers, while ...
['K = int(input())\ncount =0 \nj =0 \nwhile True:\n j+=1\n t = [int(i) for i in list(str(j))]\n a = len(t)\n for i,v in enumerate(t):\n if i < a-1:\n if abs(t[i] - t[i+1]) > 1:\n break\n count += 1\n if count ==K:\n print(j)\n exit()', 'import queue\n\nK ...
['Wrong Answer', 'Accepted']
['s751020015', 's321617618']
[3064.0, 10948.0]
[307.0, 424.0]
[282, 642]
p02720
u621345513
2,000
1,048,576
A positive integer X is said to be a lunlun number if and only if the following condition is satisfied: * In the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1. For example, 1234, 1, and 334 are lunlun numbers, while ...
['from collections import deque\n\nk = 9 #+ (9*3-1)\ncount = 0\nq = deque(range(1,10))\n\nwhile count < k:\n l = q.popleft()\n resid = l % 10\n if resid != 0: q.append(l*10 + resid - 1)\n\n q.append(l*10 + resid)\n \n if resid != 9: q.append(l*10 + resid + 1)\n \n count += 1\n\nprint(l)', 'k = ...
['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s609755436', 's703207095', 's782874823', 's900946027', 's223003384']
[3316.0, 3060.0, 3316.0, 3192.0, 11956.0]
[21.0, 17.0, 20.0, 17.0, 116.0]
[293, 267, 288, 2410, 292]
p02720
u634282234
2,000
1,048,576
A positive integer X is said to be a lunlun number if and only if the following condition is satisfied: * In the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1. For example, 1234, 1, and 334 are lunlun numbers, while ...
['K=int(input())\nnums=[i for i in range(1,10)]\nfor i in range(K):\n a=nums.pop(0)\n if a%10!=0:\n nums.append(a*10 + %10 - 1)\n \n nums.append(a*10 + a%10)\n \n if a%10!=9:\n nums.append(a*10 + a%10 + 1)\n\nprint(a)\n', 'K=int(input())\nnums=[i for i in range(1,10)]\nfor i in range(K):...
['Runtime Error', 'Runtime Error', 'Accepted']
['s089220090', 's504977387', 's353429554']
[9020.0, 9040.0, 18592.0]
[24.0, 24.0, 1947.0]
[236, 236, 236]
p02720
u640922335
2,000
1,048,576
A positive integer X is said to be a lunlun number if and only if the following condition is satisfied: * In the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1. For example, 1234, 1, and 334 are lunlun numbers, while ...
['K=int(input())\n\nfrom collections import deque\nnum=deque()\nfor i in range(1,10):\n num.append(i)\n\nfor j in range(K):\n l=num.popleft()\n if ans%10 !=0:\n num.append(l*10+(l%10-1))\n num.append(l*10)\n if ans%10 != 9:\n num.append(l*10+(l%10+1))\n\nprint(l)\n \n ', 'K=int(input())\n\nfrom collections...
['Runtime Error', 'Accepted']
['s051575229', 's651175490']
[3316.0, 12384.0]
[20.0, 122.0]
[263, 261]
p02720
u644516473
2,000
1,048,576
A positive integer X is said to be a lunlun number if and only if the following condition is satisfied: * In the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1. For example, 1234, 1, and 334 are lunlun numbers, while ...
["import sys\nfrom functools import lru_cache\nsys.setrecursionlimit(10**9)\nk = int(input())\nlunlun = []\n\n\n@lru_cache(maxsize=100000000)\ndef func(i):\n if int(i) > 3234566667 + 10 or len(i) > 6:\n return\n lunlun.append(int(i))\n f = int(i[0])\n b = int(i[-1])\n if f != 0:\n func(f'{f...
['Runtime Error', 'Accepted']
['s415994996', 's519740115']
[2940.0, 12404.0]
[17.0, 108.0]
[578, 252]