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 |
|---|---|---|---|---|---|---|---|---|---|---|
p02720 | u645436608 | 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 none of 31415, 119, or 13579 is. You are given a positive integer K. Find the K-th smallest lunlun number. | ['import numpy as np\nK = input()\nlunlun_number = [[1, 2, 3, 4, 5, 6, 7, 8, 9]]\nfor _ in range(9):\n tmp = []\n for n in lunlun_number[-1]:\n if n % 10 != 0: \n tmp.append(n * 10 + (n % 10 - 1))\n tmp.append(n * 10 + (n % 10))\n if n % 10 != 9: \n tmp.append(n * 10 + (n % 10 + 1))\n lunlun_number.append(tmp)\nlunlun_number = np.array(lunlun_number).flatten()\nprint(lunlun_number[K - 1])\n', 'import numpy as np\nK = int(input())\nlunlun_number = [[1, 2, 3, 4, 5, 6, 7, 8, 9]]\nfor _ in range(9):\n tmp = []\n for n in lunlun_number[-1]:\n if n % 10 != 0: \n tmp.append(n * 10 + (n % 10 - 1))\n tmp.append(n * 10 + (n % 10))\n if n % 10 != 9: \n tmp.append(n * 10 + (n % 10 + 1))\n lunlun_number.append(tmp)\nlunlun_number = [flatten for inner in lunlun_number for flatten in inner]\nprint(lunlun_number[K - 1])\n'] | ['Runtime Error', 'Accepted'] | ['s171629573', 's058496372'] | [21168.0, 29592.0] | [223.0, 358.0] | [621, 650] |
p02720 | u646412443 | 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 none of 31415, 119, or 13579 is. You are given a positive integer K. Find the K-th smallest lunlun number. | ['k = int(input())\na = [i for i in range(1, 10)]\nwhile True:z\n if k <= len(a):\n print(a[k-1])\n exit()\n k -= len(a)\n old = []\n old, a = a, old\n for i in range(len(old)):\n for j in range(-1, 2):\n d = old[i]%10+j\n if d >= 0 and d <= 9:\n a.append(old[i]*10+d)\n', 'k = int(input())\na = [i for i in range(1, 10)]\nwhile True:\n if k <= len(a):\n print(a[k-1])\n exit()\n k -= len(a)\n old = []\n old, a = a, old\n for i in range(len(old)):\n for j in range(-1, 2):\n d = old[i]%10+j\n if d >= 0 and d <= 9:\n a.append(old[i]*10+d)\n'] | ['Runtime Error', 'Accepted'] | ['s511949090', 's110116184'] | [2940.0, 11028.0] | [17.0, 139.0] | [327, 326] |
p02720 | u667024514 | 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 none of 31415, 119, or 13579 is. You are given a positive integer K. Find the K-th smallest lunlun number. | ['n=int(input())\nnow=[1,2,3,4,5,6,7,8,9]\nif n<10:\n print(now[n-1])\n exit()\ncnt=9\nwhile True:\n next=[]\n for s in now:\n s=str(s)\n if s[-1]!=0:\n cnt+=1\n if cnt<n:\n next.append(s+"0")\n else:\n print(s+"0")\n exit()\n cnt+=1\n if cnt<n:\n next.append(s+s[-1])\n else:\n print(s+s[-1])\n exit()\n if s[-1]!=9:\n cnt+=1\n if cnt<n:\n next.append(s+"9")\n else:\n print(s+"9")\n exit()\n now=next', 'n=int(input())\nnow=[1,2,3,4,5,6,7,8,9]\nif n<10:\n print(now[n-1])\n exit()\ncnt=9\nwhile True:\n next=[]\n for s in now:\n s=str(s)\n if s[-1]!="0":\n cnt+=1\n if cnt<n:\n next.append(s+str(int(s[-1]-1)))\n else:\n print(s+str(int(s[-1]-1)))\n exit()\n cnt+=1\n if cnt<n:\n next.append(s+s[-1])\n else:\n print(s+s[-1])\n exit()\n if s[-1]!="9":\n cnt+=1\n if cnt<n:\n next.append(s+str(int(s[-1]+1)))\n else:\n print(s+str(int(s[-1]+1)))\n exit()\n now=next\n', 'n=int(input())\nnow=[1,2,3,4,5,6,7,8,9]\nif n<10:\n print(now[n-1])\n exit()\ncnt=9\nwhile True:\n next=[]\n for s in now:\n s=str(s)\n if s[-1]!="0":\n cnt+=1\n if cnt<n:\n next.append(s+str(int(s[-1])-1))\n else:\n print(s+str(int(s[-1])-1))\n exit()\n cnt+=1\n if cnt<n:\n next.append(s+s[-1])\n else:\n print(s+s[-1])\n exit()\n if s[-1]!="9":\n cnt+=1\n if cnt<n:\n next.append(s+str(int(s[-1])+1))\n else:\n print(s+str(int(s[-1])+1))\n exit()\n now=next\n'] | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s257238688', 's528308746', 's154428946'] | [8756.0, 3064.0, 8596.0] | [65.0, 17.0, 95.0] | [480, 541, 541] |
p02720 | u673338219 | 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 none of 31415, 119, or 13579 is. You are given a positive integer K. Find the K-th smallest lunlun number. | ['import queue\nk = int(input())\nq = queue.Queue([1,2,3,4,5,6,7,8,9])\nc = 1\nwhile True:\n x = q.get()\n if c == k:\n print(x)\n exit()\n if x%10 == 0:\n q.put(10*x)\n q.put(10*x+1)\n elif x%10 == 0:\n q.put(10*x+8)\n q.put(10*x+9)\n else:\n i = x%10\n q.put(10*x+i-1)\n q.put(10*x+i)\n q.put(10*x+i+1)\n c += 1\n \n \n \n', 'k = int(input())\nx = [1,2,3,4,5,6,7,8,9]\ni = 0\nxa = x.append\nwhile len(x) < k:\n if x[i]%10 == 0:\n xa(10*x[i])\n xa(10*x[i]+1)\n elif x[i]%10 == 9:\n xa(10*x[i]+8)\n xa(10*x[i]+9)\n else:\n j = x[i]%10\n xa(10*x[i]+j-1)\n xa(10*x[i]+j)\n xa(10*x[i]+j+1)\n i += 1\nprint(x[k-1]) \n \n \n '] | ['Time Limit Exceeded', 'Accepted'] | ['s553728242', 's824811260'] | [3952.0, 7172.0] | [2108.0, 52.0] | [343, 304] |
p02720 | u673355261 | 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 none of 31415, 119, or 13579 is. You are given a positive integer K. Find the K-th smallest lunlun number. | ['import sys\n\nK = int(input())\n\nNLUNLUN = [[-1 for _ in range(11)] for _ in range(10)]\ndef num_lunlun(n, digit):\n if digit == 1:\n NLUNLUN[n][digit] = 1\n return NLUNLUN[n][digit]\n\n if digit == 2:\n if 0 < n < 9:\n NLUNLUN[n][digit] = 3\n else:\n NLUNLUN[n][digit] = 2\n return NLUNLUN[n][digit]\n\n n2 = 0\n if n - 1 >= 0:\n n2 += NLUNLUN[n-1][digit-1]\n n2 += NLUNLUN[n][digit-1]\n if n + 1 <= 9:\n n2 += NLUNLUN[n+1][digit-1]\n NLUNLUN[n][digit] = n2\n return NLUNLUN[n][digit]\n\n\nif K < 10:\n print(K)\n\nk = 0\nfor digit in range(1, 11):\n for n in range(10):\n tmp = num_lunlun(n, digit)\n if n > 0:\n if k + tmp >= K:\n print(n, digit)\n ans = str(n)\n n2 = n\n for digit2 in range(digit-1, 1, -1):\n if n2 - 1 >= 0:\n tmp = NLUNLUN[n2 - 1][digit2]\n if k + tmp >= K:\n ans += str(n2 - 1)\n n2 -= 1\n continue\n k += tmp\n\n tmp = NLUNLUN[n2][digit2]\n if k + tmp >= K:\n ans += str(n2)\n continue\n k += tmp\n\n if n2 + 1 <= 9:\n tmp = NLUNLUN[n2 + 1][digit2]\n if k + tmp >= K:\n ans += str(n2 + 1)\n n2 += 1\n continue\n k += tmp\n\n ans = int(ans + str(n2 + K - k - 2))\n print(ans)\n\n sys.exit(0)\n k += tmp\n', "import sys\n\nK = int(input())\n\nNLUNLUN = [[-1 for _ in range(11)] for _ in range(10)]\ndef num_lunlun(n, digit):\n if digit == 1:\n NLUNLUN[n][digit] = 1\n return NLUNLUN[n][digit]\n\n if digit == 2:\n if 0 < n < 9:\n NLUNLUN[n][digit] = 3\n else:\n NLUNLUN[n][digit] = 2\n return NLUNLUN[n][digit]\n\n n2 = 0\n if n - 1 >= 0:\n n2 += NLUNLUN[n-1][digit-1]\n n2 += NLUNLUN[n][digit-1]\n if n + 1 <= 9:\n n2 += NLUNLUN[n+1][digit-1]\n NLUNLUN[n][digit] = n2\n return NLUNLUN[n][digit]\n\n\nif K < 10:\n print(K)\n sys.exit(0)\n\nk = 0\nfor digit in range(1, 11):\n for n in range(10):\n tmp = num_lunlun(n, digit)\n if n > 0:\n if k + tmp >= K:\n ans = str(n)\n n2 = n\n for digit2 in range(digit-1, 1, -1):\n if n2 - 1 >= 0:\n tmp = NLUNLUN[n2 - 1][digit2]\n if k + tmp >= K:\n ans += str(n2 - 1)\n n2 -= 1\n continue\n k += tmp\n\n tmp = NLUNLUN[n2][digit2]\n if k + tmp >= K:\n ans += str(n2)\n continue\n k += tmp\n\n if n2 + 1 <= 9:\n tmp = NLUNLUN[n2 + 1][digit2]\n if k + tmp >= K:\n ans += str(n2 + 1)\n n2 += 1\n continue\n k += tmp\n\n if ans[-1] == '0':\n ans = int(ans + str(n2 + K - k - 1))\n else:\n ans = int(ans + str(n2 + K - k - 2))\n print(ans)\n\n sys.exit(0)\n k += tmp\n"] | ['Runtime Error', 'Accepted'] | ['s091318685', 's092752700'] | [3188.0, 3316.0] | [18.0, 20.0] | [1746, 1848] |
p02720 | u674574659 | 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 none of 31415, 119, or 13579 is. You are given a positive integer K. Find the K-th smallest lunlun number. | ['K = int(input())\n\ndp = [[0 for i in range(10)] for j in range(100)]\n\nfor i in range(10):\n dp[1][i] = i\ndp[1][0] = 1\n\np = 1\nc = 0\na = 0\n\nwhile c == 0:\n for n in range(10):\n if n != 0 and n != 9:\n dp[p+1][n] = dp[p][n]+dp[p][n-1]+dp[p][n+1]+dp[p][9]\n if n == 9:\n dp[p+1][n] = dp[p][n]+dp[p][n-1]+dp[p][9]\n if dp[p+1][n] >= K:\n c = dp[p+1][n]\n if a == 1:\n a = n\n break\n \n if n == 0:\n dp[p+1][n] = dp[p][1] + dp[p][0]\n\ns = str(a)\nfor k in range(p,0,-1):\n\n if a != 0 and a != 9:\n for j in [1,0,-1]:\n c = c - dp[k][a+j]\n if c < K:\n s = s + str(a+j)\n break\n \n if a == 0:\n for j in [1,0]:\n c = c - dp[k][a+j]\n if c < K:\n s = s + str(a+j)\n break\n\n if a == 9:\n for j in [0,-1]:\n c = c - dp[k][a+j]\n if c < K:\n s = s + str(a+j)\n break \nprint(int(s))', 'from collections import deque\nd = deque([1,2,3,4,5,6,7,8,9])\n\nk = int(input())\n\ncnt = 0\nwhile k > cnt:\n x = d.popleft()\n cnt += 1 \n if x%10 != 0:\n \td.append(x*10+x%10-1)\n d.append(x*10+x%10)\n if x%10 != 9:\n d.append(x*10+x%10+1)\nprint(x) '] | ['Wrong Answer', 'Accepted'] | ['s796196598', 's191242095'] | [3188.0, 11872.0] | [2104.0, 131.0] | [903, 249] |
p02720 | u674959776 | 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 none of 31415, 119, or 13579 is. You are given a positive integer K. Find the K-th smallest lunlun number. | ['k=int(input())\nx=0\nans=0\nfor i in range(10**5):\n ans+=1\n l = [int(x) for x in list(str(i))]\n if x==k:\n break\n for j in range(int(len(l))-1):\n if l[j]==l[j+1] or l[j]==l[j+1]+1 or l[j]==l[j+1]-1:\n x+=1\n \nprint(ans)', 'k=int(input())\na=list(range(1, 10))\nb=[]\nn=int(len(a))\nx=k\nwhile x>n:\n x-=n\n for i in range(n):\n for l in range(3):\n c=(a[i]%10)-1+l\n if 0<=c<=9:\n a.append((a[i]*10)+c)\n del a[0:n]\nprint(a[x-1])'] | ['Wrong Answer', 'Accepted'] | ['s313444010', 's053461811'] | [3064.0, 12184.0] | [465.0, 504.0] | [233, 217] |
p02720 | u678167152 | 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 none of 31415, 119, or 13579 is. You are given a positive integer K. Find the K-th smallest lunlun number. | ["K = int(input())\n\nlis = [[0]*12 for _ in range(10)]\nlis[9] = [0,3,3,3,3,3,3,3,3,3,2,0]\nfor i in range(8,-1,-1):\n for j in range(1,11):\n lis[i][j] = lis[i+1][j-1] + lis[i+1][j] + lis[i+1][j+1]\n\nnew_lis = [[0]*10 for _ in range(10)]\nnew_lis[9] = [9,3,3,3,3,3,3,3,3,2]\nfor i in range(8,-1,-1):\n for j in range(10):\n if j == 0:\n new_lis[i][j] = sum(new_lis[i+1])\n else:\n new_lis[i][j] = lis[i][j]\n \nans = 0\ncnt = 0\nfor i in range(10):\n if ans == 0:\n s,e = 0,9\n else:\n s = max(0,j-1)\n e = min(9,j+1)\n for j in range(s,e+1):\n #print('cnt',cnt)\n if cnt + lis[i][j] >= K:\n \n break\n cnt += lis[i][j]\n #print(ans,j)\n ans += j*10**(10-i)\n #print(ans)\n\nans += K-cnt+j-2\n \n\n#print(new_lis)\nprint(ans)\n#print(*ans,sep=' ')", "K = int(input())\n\nfrom collections import deque\nd = deque()\nfor i in range(1,10):\n d.append(str(i))\n\nfor _ in range(K):\n a = d.popleft()\n #print(a)\n if a[-1] != '0':\n d.append(a+str(int(a[-1])-1))\n d.append(a+a[-1])\n if a[-1] != '9':\n d.append(a+str(int(a[-1])+1))\n\nans = a\nprint(ans)\n#print(*ans,sep=' ')\n"] | ['Wrong Answer', 'Accepted'] | ['s297505364', 's407585685'] | [3064.0, 17012.0] | [18.0, 199.0] | [804, 318] |
p02720 | u680851063 | 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 none of 31415, 119, or 13579 is. You are given a positive integer K. Find the K-th smallest lunlun number. | ['n = int(input())\nl = [_ for _ in range(1,10)]\n\ncnt = 9\nd = [-1, 0, 1]\nfor i in range(10**5):\n if cnt >= n: break\n for j in d:\n if 0 <= int(str(l[i])[-1]) + j <= 9:\n l.append(l[i]*10 + l[i][-1] + j)\n cnt += 1\n\nprint(l[n-1])\n', "from collections import deque\n \nn = int(input())\n\nqueue = deque([[1],[2],[3],[4],[5],[6],[7],[8],[9]]) \nptns = [] \n\nwhile queue: \n tmp = queue.popleft() \n if len(ptns) < n: \n ptns.append(tmp)\n else:\n break\n \n if tmp[-1] != 0:\n queue.append(tmp + [tmp[-1] -1])\n\n queue.append(tmp + [tmp[-1]])\n\n if tmp[-1] != 9:\n queue.append(tmp + [tmp[-1] +1])\n\n\nprint(''.join(map(str, ptns[-1])))"] | ['Runtime Error', 'Accepted'] | ['s970325607', 's420074868'] | [9208.0, 54020.0] | [27.0, 233.0] | [258, 831] |
p02720 | u684267998 | 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 none of 31415, 119, or 13579 is. You are given a positive integer K. Find the K-th smallest lunlun number. | ['ans=0\nrunrun = 0\ni =0\nwhile runrun = K:\n if i < 10:\n runrun +=1\n else:\n a = list(map(int,str(i)))\n for j in range(1,len(a)):\n tmp = 0\n if abs(a[j]-a[j-1])<=1:\n tmp +=1\n if tmp == len(a)-1:\n runrun +=1\n ans = i\n i +=1\nprint(ans)\n\n \n', 'k=int(input())\ncand=[[1,2,3,4,5,6,7,8,9]]\nfor _ 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)\nans=[]\nfor i in range(len(cand)):\n for val in cand[i]:\n ans.append(val)\nans=sorted(ans)\nprint(ans[k-1])'] | ['Runtime Error', 'Accepted'] | ['s778980718', 's390387955'] | [2940.0, 15144.0] | [17.0, 112.0] | [342, 613] |
p02720 | u686230543 | 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 none of 31415, 119, or 13579 is. You are given a positive integer K. Find the K-th smallest lunlun number. | ['k = int(input())\nnum = 0\nfor _ in range(k):\n num += 1\n digit = [int(digit) for digit in str(num)]\n len_digit = len(digit)\n for i in range(1, len_digit):\n if digit[-i] > min(digit[-i-1] + 1, 9):\n digit[-i-1] += 1\n digit[-i] = -1\n elif digit[-i] < digit[-i-1] - 1:\n digit[-i] = -1\n for i in range(1, len_digit):\n if digit[i] == -1:\n for j in range(i, len_digit):\n digit[j] = max(digit[j-1] - 1, 0)\n break\n num = d[0]\n for d in digit[1:]:\n num = num * 10 + d\nprint(num)', "k = int(input())\nnum = 0\nfor _ in range(k):\n num += 1\n digit = list(map(int, str(num)))\n len_digit = len(digit)\n for i in range(1, len_digit):\n if digit[-i] > min(digit[-i-1] + 1, 9):\n digit[-i-1] += 1\n digit[-i] = -1\n elif digit[-i] < digit[-i-1] - 1:\n digit[-i] = -1\n for i in range(1, len_digit):\n if digit[i] == -1:\n for j in range(i, len_digit):\n digit[j] = max(digit[j-1] - 1, 0)\n break\n num = int(''.join(map(str, digit)))\nprint(num)"] | ['Runtime Error', 'Accepted'] | ['s016398654', 's953958066'] | [3064.0, 3064.0] | [18.0, 1083.0] | [517, 487] |
p02720 | u691896522 | 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 none of 31415, 119, or 13579 is. You are given a positive integer K. Find the K-th smallest lunlun number. | ['import sys\nfrom collections import deque\nsys.setrecursionlimit(10**7)\nk = int(input())\nans = []\ndef bfs(que):\n finished = set()\n while que and len(ans) <= 10**6:\n x = que.popleft()\n ans.append(int(x))\n if x not in finished:\n finished.add(x)\n p = int(x[-1])\n que.append(x + str(p))\n if 1 <= p <= 8:\n que.append(x + str(p+1))\n que.append(x + str(p-1))\n elif p == 0:\n que.append(x + str(p+1))\n else:\n que.append(x + str(p-1))\nque = deque([])\nfor i in range(1,10):\n que.append(str(i))\nbfs(que)\nans.sort()\nprint(ans[k-1])', 'import sys\nfrom collections import deque\nsys.setrecursionlimit(10**7)\nk = int(input())\nans = []\ndef bfs(que):\n finished = set()\n while que and len(ans) <= 10**5:\n x = que.popleft()\n ans.append(int(x))\n if x not in finished:\n finished.add(x)\n p = int(x[-1])\n if 1 <= p <= 8:\n que.append(x + str(p-1))\n que.append(x + str(p))\n que.append(x + str(p+1))\n elif p == 0:\n que.append(x + str(p))\n que.append(x + str(p+1))\n else:\n que.append(x + str(p-1))\n que.append(x + str(p))\nque = deque([])\nfor i in range(1,10):\n que.append(str(i))\nbfs(que)\nans.sort()\nprint(ans[k-1])'] | ['Time Limit Exceeded', 'Accepted'] | ['s290454897', 's898471289'] | [276544.0, 31276.0] | [2120.0, 225.0] | [672, 754] |
p02720 | u692311686 | 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 none of 31415, 119, or 13579 is. You are given a positive integer K. Find the K-th smallest lunlun number. | ['K=int(input())\nimport queue\na=queue.Queue()\nif K<=9:\n print(K)\nelse:\n for i in range(1,10):\n a.put(i)\n n=K\n while n>1:\n x=a.get()\n if x%10!=0:\n a.put(10*x-1)\n a.put(10*x)\n if x%10!=9:\n a.put(10*x+1)\n n-=1\n ans=a.get()\n print(ans)', 'K=int(input())\nimport queue\na=queue.Queue()\nif K<=9:\n print(K)\nelse:\n for i in range(1,10):\n a.put(i)\n n=K\n while n>1:\n p=a.get()\n x=p%10\n if x%10!=0:\n a.put(10*p+x-1)\n a.put(10*p+x)\n if x%10!=9:\n a.put(10*p+x+1)\n n-=1\n ans=a.get()\n print(ans)'] | ['Wrong Answer', 'Accepted'] | ['s052195394', 's120489783'] | [9912.0, 12480.0] | [887.0, 1075.0] | [263, 280] |
p02720 | u692498898 | 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 none of 31415, 119, or 13579 is. You are given a positive integer K. Find the K-th smallest lunlun number. | ['k=int(input())\nlist=[1,2,3,4,5,6,7,8,9]\nfor i in range(k-1):\n m=list[i]\n n=m*10+m%10\n if m%10!=0:\n list.append(m-1)\n list.append(m)\n if m%10!=9:\n list.append(m+1)\nprint(list[k-1])', 'k=int(input())\nlist=[1,2,3,4,5,6,7,8,9]\nfor i in range(k-1):\n m=list[i]\n n=m*10+m%10\n if m%10!=0:\n list.append(n-1)\n list.append(n)\n if m%10!=9:\n list.append(n+1)\nprint(list[k-1])\nprint(list)', 'k=int(input())\nlist=[1,2,3,4,5,6,7,8,9]\nfor i in range(k-1):\n m=list[i]\n n=m*10+m%10\n if m%10!=0:\n list.append(n-1)\n list.append(n)\n if m%10!=9:\n list.append(n+1)\nprint(list[k-1])'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s447945595', 's739294784', 's493389682'] | [5396.0, 26000.0, 15764.0] | [82.0, 129.0, 99.0] | [190, 202, 190] |
p02720 | u693007703 | 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 none of 31415, 119, or 13579 is. You are given a positive integer K. Find the K-th smallest lunlun number. | ['\nfrom collections import deque\n\nq = deque(range(1,10))\nK = int(input())\n\nfor i in range(K):\n x = q.popleft()\n r = x % 10\n if r != 0:\n q.append((10 * x) + (r - 1))\n q.append((10 * x) + r)\n if r != 9:\n q.put((10 * x) + (r + 1))\n\nprint(x)', 'from collections import deque\n\nq = deque(range(1,10))\nK = int(input())\n\nfor i in range(K):\n x = q.popleft()\n r = x % 10\n if r != 0:\n q.append((10 * x) + (r - 1))\n q.append((10 * x) + r)\n if r != 9:\n q.append((10 * x) + (r + 1))\n\nprint(x)'] | ['Runtime Error', 'Accepted'] | ['s642901416', 's141606315'] | [3316.0, 12404.0] | [20.0, 106.0] | [292, 267] |
p02720 | u696444274 | 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 none of 31415, 119, or 13579 is. You are given a positive integer K. Find the K-th smallest lunlun number. | ['k = int(input())\n\n#a = list(map(int, input().split()))\nq = deque([1, 2, 3, 4, 5, 6, 7, 8, 9])\nfor i in range(k):\n x = q.popleft()\n a = 10*x+(x % 10)\n if x % 10 != 0:\n q.append(a-1)\n q.append(a)\n if x % 10 != 9:\n q.append(a+1)\n\nprint(x)', 'from collections import deque\nk = int(input())\nq = deque([1, 2, 3, 4, 5, 6, 7, 8, 9])\nfor i in range(k):\n x = q.popleft()\n a = 10*x+(x % 10)\n if x % 10 != 0:\n q.append(a-1)\n q.append(a)\n if x % 10 != 9:\n q.append(a+1)\n\nprint(x)\n'] | ['Runtime Error', 'Accepted'] | ['s788476987', 's884076094'] | [3060.0, 11864.0] | [17.0, 109.0] | [303, 257] |
p02720 | u698849142 | 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 none of 31415, 119, or 13579 is. You are given a positive integer K. Find the K-th smallest lunlun number. | ["import math\nn,m=map(int,input().split())\na=list(map(int,input().split()))\nt=sum(a)\na=list(filter(lambda x: math.ceil(t/(4*m)) < x, a))\nprint('Yes' if m <= len(a) else 'No')\n", "k=int(input())\nl=list(map(str,range(1,10)))\nfor i in range(k):\n x=l[i][-1]\n if x=='0':\n l.append(l[i]+x)\n l.append(l[i]+'1')\n elif x=='9':\n l.append(l[i]+'8')\n l.append(l[i]+x)\n else:\n n=int(x)\n l.append(l[i]+str(n-1))\n l.append(l[i]+x)\n l.append(l[i]+str(n+1))\nprint(sorted(map(int,l))[k-1])"] | ['Runtime Error', 'Accepted'] | ['s607617657', 's426537962'] | [2940.0, 35236.0] | [18.0, 216.0] | [173, 360] |
p02720 | u698977701 | 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 none of 31415, 119, or 13579 is. You are given a positive integer K. Find the K-th smallest lunlun number. | ['print("yippe")', 'import queue\nk = int(input())\nq = [1,2,3,4,5,6,7,8,9]\nqq = queue.Queue()\nfor i in range(1,10):\n\tqq.put(i)\n\nfor i in range(k):\n\tx = qq.get()\n\tif x%10 != 0:\n\t\tqq.put(10*x + (x%10) -1)\n\tqq.put(10*x + (x%10))\n\tif x%10 != 9:\n\t\tqq.put(10*x + (x%10) +1)\n\t\t\nprint(x)\n\t\t'] | ['Wrong Answer', 'Accepted'] | ['s833116304', 's752064459'] | [2940.0, 12452.0] | [17.0, 1049.0] | [14, 261] |
p02720 | u699252226 | 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 none of 31415, 119, or 13579 is. You are given a positive integer K. Find the K-th smallest lunlun number. | ['k=int(input())\nnum=0\n\nwhile k>0:\n num+=1\n snum=str(num)\n flg=0\n for i in range(0,len(snum)-1):\n if abs(int(snum[i])-int(snum[i+i]))>1:\n flg=1\n break\n if flg==0:\n k-=1\nprint(num)', "k=int(input())\nnum=[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1]\nketa=0\nfor i in range(0,k):\n for j in range(0,len(num)-1):\n if num[j]==-1:\n num[j]=1\n keta=j\n break\n elif num[j]!=9 and (num[j+1]==-1 or (num[j]-num[j+1])<1):\n num[j]+=1\n break\n for x in range(j-1,-1,-1):\n num[x]=max(0,num[x+1]-1)\n\nfor i in range(keta,-1,-1):\n print(num[i],end='')\nprint()"] | ['Runtime Error', 'Accepted'] | ['s550301506', 's528147443'] | [3064.0, 3064.0] | [20.0, 205.0] | [198, 380] |
p02720 | u700805562 | 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 none of 31415, 119, or 13579 is. You are given a positive integer K. Find the K-th smallest lunlun number. | ['K = int(input())\n\ndef cal():\n count = 9\n d = [[1,2,3,4,5,6,7,8,9]]\n for i in range(10**9):\n d_ = []\n for j in range(len(d[i])):\n a = str(d[i][j])\n if a[-1]=="0":\n for k in [0,1]:\n d_.append(int(a)*10+k)\n count += 1\n if K == count:\n print(d_[-1])\n return\n elif a[-1]=="9":\n for k in [8,9]:\n d_.append(int(a)*10+k)\n count += 1\n if K == count:\n print(d_[-1])\n return \n else:\n for k in [-1, 0, 1]:\n d_.append(int(a)*10+int(a[-1])+k)\n count += 1\n if K == count:\n print(d_[-1])\n return\n d.append(d_)\nif k <= 9:\n print(K)\nelse:\n cal()', 'K = int(input())\n\ndef cal():\n count = 9\n d = [[1,2,3,4,5,6,7,8,9]]\n for i in range(10**9):\n d_ = []\n for j in range(len(d[i])):\n a = str(d[i][j])\n if a[-1]=="0":\n for k in [0,1]:\n d_.append(int(a)*10+k)\n count += 1\n if K == count:\n print(d_[-1])\n return\n elif a[-1]=="9":\n for k in [8,9]:\n d_.append(int(a)*10+k)\n count += 1\n if K == count:\n print(d_[-1])\n return \n else:\n for k in [-1, 0, 1]:\n d_.append(int(a)*10+int(a[-1])+k)\n count += 1\n if K == count:\n print(d_[-1])\n return\n d.append(d_)\nif k <= 9:\n print(k)\nelse:\n cal()', 'from collections import deque\nk = int(input())\nif k <= 9: print(k)\nque = deque([1, 2, 3, 4, 5, 6, 7, 8, 9])\ncount = 9\nwhile count <= k:\n X = que.popleft()\n if X%10==0: check=[0, 1]\n elif X%10==9: check=[8, 9]\n else: check = [X%10-1, X%10, X%10+1]\n for i in check:\n que.append(X*10+i)\n count += 1\n if count == k:\n print(que[-1])\n exit()'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s241366950', 's412092446', 's077140046'] | [3064.0, 3064.0, 6132.0] | [18.0, 17.0, 77.0] | [965, 965, 393] |
p02720 | u703442202 | 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 none of 31415, 119, or 13579 is. You are given a positive integer K. Find the K-th smallest lunlun number. | ['import heapq\nk = int(input())\nrun_list = [i for i in range(1,10)]\nheapq.heapify(run_list)\nresult = 0\nfor i in range(k):\n result = heapq.pop(run_list)\n if result % 10 ==0:\n new_1 = result * 10\n new_2 = result * 10 + 1\n heapq.heappush(run_list, new_1)\n heapq.heappush(run_list, new_2)\n elif result % 10 ==9:\n new_1 = result * 10 + 8\n new_2 = result * 10 + 9\n heapq.heappush(run_list, new_1)\n heapq.heappush(run_list, new_2)\n else:\n new_1 = result * 10 + (resut % 10)\n new_2 = result * 10 + (resut % 10) + 1\n new_3 = result * 10 + (resut % 10) - 1\n heapq.heappush(run_list, new_1)\n heapq.heappush(run_list, new_2)\nprint(result)\n heapq.heappush(run_list, new_3)', 'import heapq\nk = int(input())\nrun_list = [i for i in range(1,10)]\nheapq.heapify(run_list)\nresult = 0\nfor i in range(k):\n result = heapq.heappop(run_list)\n if result % 10 ==0:\n new_1 = result * 10\n new_2 = result * 10 + 1\n heapq.heappush(run_list, new_1)\n heapq.heappush(run_list, new_2)\n elif result % 10 ==9:\n new_1 = result * 10 + 8\n new_2 = result * 10 + 9\n heapq.heappush(run_list, new_1)\n heapq.heappush(run_list, new_2)\n else:\n new_1 = result * 10 + (result % 10)\n new_2 = result * 10 + (result % 10) + 1\n new_3 = result * 10 + (result % 10) - 1\n heapq.heappush(run_list, new_1)\n heapq.heappush(run_list, new_2)\n heapq.heappush(run_list, new_3)\nprint(result)'] | ['Runtime Error', 'Accepted'] | ['s437097969', 's021018013'] | [3064.0, 11708.0] | [17.0, 189.0] | [703, 710] |
p02720 | u704284486 | 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 none of 31415, 119, or 13579 is. You are given a positive integer K. Find the K-th smallest lunlun number. | ['K = int(input())\na = []\ndef dfs(x):\n if x > 3234566667:\n return\n a.append(x)\n for i in range(10):\n if abs(x%10-i) <= 1:\n dfs(x*10+i)\n\nfor i in range(1,11):\n dfs(i)\na = sorted(a)\nprint(a[K-1])', 'K = int(input())\na = []\ndef dfs(x):\n if x > 3234566667:\n return\n a.append(x)\n for i in range(10):\n if abs(x%10-i) <= 1:\n dfs(x*10+i)\n\nfor i in range(1,10):\n dfs(i)\na = sorted(a)\nprint(a[K-1])'] | ['Wrong Answer', 'Accepted'] | ['s017360617', 's075120767'] | [8640.0, 8512.0] | [234.0, 232.0] | [228, 228] |
p02720 | u711340028 | 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 none of 31415, 119, or 13579 is. You are given a positive integer K. Find the K-th smallest lunlun number. | ['import sys\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\n\nK = int(read())\n\npre_lis = []\nfor i in range(1,10):\n pre_lis.append(str(i))\nprint(pre_lis)\nct = 9\nif K <= 9:\n print(pre_lis[K-1])\nelse:\n new_lis = []\n flag = False\n while ct < K:\n for num in pre_lis:\n pre_num = int(num[-1])\n for i in range(10):\n if abs(pre_num-i) <= 1:\n new_lis.append(num + str(i))\n ct+=1\n #print((new_lis[-1]))\n if ct == K:\n print(new_lis[-1])\n flag = True\n break\n pre_lis = new_lis\n if flag:\n break\n if flag:\n break', 'import sys\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\n\nK = int(read())\n\npre_lis = []\nfor i in range(1,10):\n pre_lis.append(str(i))\n \nct = 9\nif K <= 9:\n print(pre_lis[K-1])\nelse:\n new_lis = []\n flag = False\n while ct < K:\n for num in pre_lis:\n pre_num = int(num[-1])\n for i in range(10):\n if abs(pre_num-i) <= 1:\n new_lis.append(num + str(i))\n ct+=1\n if ct == K:\n print(new_lis[-1])\n flag = True\n break\n pre_lis = new_lis\n if flag:\n break\n if flag:\n break'] | ['Wrong Answer', 'Accepted'] | ['s077620707', 's592514820'] | [10136.0, 10136.0] | [144.0, 154.0] | [812, 760] |
p02720 | u712052023 | 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 none of 31415, 119, or 13579 is. You are given a positive integer K. Find the K-th smallest lunlun number. | ['# coding: utf-8\nDATA = """\n100000\n""".split("\\n")\n\ndef get_debug_line():\n\tfor i in DATA:\n\t\tyield i\n\nif 1:\n\tget_line = input\nelse:\n\tget_line = get_debug_line().__next__\n\tget_line()\n\n\n\ndef Calc():\n\tK = [int(i) for i in get_line().strip().split(" ")][0]\n\tret = [str(_) for _ in range(1,10)]\n\tsize = len(ret)\n\tstart = 0\n\tprint (ret)\n\tcount = len(ret)\n\twhile(size < K):\n\t\tfor i in range(start, size):\n\t\t\tv = int(ret[i][-1])\n\t\t\tll = ret[i]\n\t\t\tif not v == 0:\n\t\t\t\tcount += 1\n\t\t\t\tret.append(ll + str(v - 1))\n\t\t\tret.append(ll + str(v))\n\t\t\tcount += 1\n\t\t\tif not v == 9:\n\t\t\t\tcount += 1\n\t\t\t\tret.append(ll + str(v+1))\n\n\t\t\tif count >= K:\n\t\t\t\tbreak\n\t\tif count >= K:\n\t\t\tbreak\n\t\tstart = size\n\t\tsize = len(ret)\n\tprint (ret[K-1])\nCalc()', '# coding: utf-8\nDATA = """\n100000\n""".split("\\n")\n\ndef get_debug_line():\n\tfor i in DATA:\n\t\tyield i\n\nif 1:\n\tget_line = input\nelse:\n\tget_line = get_debug_line().__next__\n\tget_line()\n\ndef Calc():\n\tK = [int(i) for i in get_line().strip().split(" ")][0]\n\tret = [str(_) for _ in range(1,10)]\n\tsize = len(ret)\n\tstart = 0\n\tcount = len(ret)\n\twhile(size < K):\n\t\tfor i in range(start, size):\n\t\t\tv = int(ret[i][-1])\n\t\t\tll = ret[i]\n\t\t\tif not v == 0:\n\t\t\t\tcount += 1\n\t\t\t\tret.append(ll + str(v - 1))\n\t\t\tret.append(ll + str(v))\n\t\t\tcount += 1\n\t\t\tif not v == 9:\n\t\t\t\tcount += 1\n\t\t\t\tret.append(ll + str(v+1))\n\n\t\t\tif count >= K:\n\t\t\t\tbreak\n\t\tif count >= K:\n\t\t\tbreak\n\t\tstart = size\n\t\tsize = len(ret)\n\tprint (ret[K-1])\nCalc()'] | ['Wrong Answer', 'Accepted'] | ['s257335269', 's756278445'] | [10136.0, 10136.0] | [68.0, 69.0] | [715, 700] |
p02720 | u723583932 | 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 none of 31415, 119, or 13579 is. You are given a positive integer K. Find the K-th smallest lunlun number. | ['k=input()\nn=len(k)\ncnt=9\ndef lunlun(x):\n flag=True\n x=str(x)\n for num in range(len(x)-1):\n a=x[num]\n b=x[num+1]\n if abs(int(a)-int(b))>1:\n flag=False\n break\n return flag\ni=9\nif n==1:\n print(k)\nelse:\n while cnt!=k:\n i+=1\n if lunlun(i):\n cnt+=1\n print(i)\n', '#abc161 d \nk=int(input())\n\nlunlun=[1,2,3,4,5,6,7,8,9]\n\ndef lunlun_generate(p):\n last=p%10\n if last-1>=0:\n yield p*10+last-1\n yield p*10+last\n if last+1<=9:\n yield p*10+last+1\n\n\np=0\nwhile len(lunlun)<k:\n for new_lunlun in lunlun_generate(lunlun[p]):\n lunlun.append(new_lunlun)\n p+=1\n \nprint(lunlun[k-1])'] | ['Time Limit Exceeded', 'Accepted'] | ['s979141461', 's226416452'] | [3060.0, 7140.0] | [2107.0, 62.0] | [342, 401] |
p02720 | u723711163 | 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 none of 31415, 119, or 13579 is. You are given a positive integer K. Find the K-th smallest lunlun number. | ['K = int(input())\nqueue = []\nfor i in range(1, 10):\n queue.append(i)\n\nwhile K != 0:\n num = queue.pop(0)\n\n if K <= len(queue):\n print(queue[K-1])\n exit(0)\n K -= 1\n\n if K == 0:\n print(num)\n exit(0)\n\n o = int(str(num)[-1])\n for n in [o-1, o, o+1]:\n if n == -1 or n == 10: continue\n queue.append( int(str(num)+str(n)) )', 'from collections import deque\n\nK = int(input())\nqueue = deque([i for i in range(1,10)])\n\nwhile K != 0:\n if K <= len(queue):\n print(queue[K-1])\n exit(0)\n\n K -= 1\n num = queue.popleft()\n\n o = int(str(num)[-1])\n for n in [o-1, o, o+1]:\n if n == -1 or n == 10: continue\n queue.append( int(str(num)+str(n)) )'] | ['Wrong Answer', 'Accepted'] | ['s596603436', 's230836863'] | [5720.0, 5960.0] | [481.0, 143.0] | [339, 320] |
p02720 | u723792785 | 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 none of 31415, 119, or 13579 is. You are given a positive integer K. Find the K-th smallest lunlun number. | ['k=int(input())\nketa=2\nunta=[[]]*10\nunta[0]=["1","2","3","4","5","6","7","8","9"]\nfor _ in range(9):\n\tfor i in range(len(unta[keta-2])):\n\t\tif unta[keta-2][i][len(unta[keta-2][i])-1]=="0":\n\t\t\tunta[keta-1].append(("").join(unta[keta-2][i])+"0")\n\t\t\tunta[keta-1].append(("").join(unta[keta-2][i])+"1")\n\t\tif unta[keta-2][i][len(unta[keta-2][i])-1]=="9":\n\t\t\tunta[keta-1].append(("").join(unta[keta-2][i])+"8")\n\t\t\tunta[keta-1].append(("").join(unta[keta-2][i])+"9")\n\t\telse:\n\t\t\tunta[keta-1].append(("").join(unta[keta-2][i])+str(int(unta[keta-2][i][len(unta[keta-2][i])-1])-1))\n\t\t\tunta[keta-1].append(("").join(unta[keta-2][i])+str(int(unta[keta-2][i][len(unta[keta-2][i])-1])))\n\t\t\tunta[keta-1].append(("").join(unta[keta-2][i])+str(int(unta[keta-2][i][len(unta[keta-2][i])-1])+1))\n\tketa += 1\nunchi=[]\nfor i in range(10):\n\tunchi+=unta[i]\nprint(unchi[k-1])', 'k=int(input())\nunta=[[],[],[],[],[],[],[],[],[],[],[],[]]\nunta[1]=["1","2","3","4","5","6","7","8","9"]\nfor keta in range(2,12):\n\tfor i in range(len(unta[keta-1])):\n\t\tif unta[keta-1][i][keta-2]=="0":\n\t\t\tunta[keta].append(unta[keta-1][i]+"0")\n\t\t\tunta[keta].append(unta[keta-1][i]+"1")\n\t\telif unta[keta-1][i][keta-2]=="9":\n\t\t\tunta[keta].append(unta[keta-1][i]+"8")\n\t\t\tunta[keta].append(unta[keta-1][i]+"9")\n\t\telse:\n\t\t\tunta[keta].append(unta[keta-1][i]+str(int(unta[keta-1][i][keta-2])-1))\n\t\t\tunta[keta].append(unta[keta-1][i]+unta[keta-1][i][keta-2])\n\t\t\tunta[keta].append(unta[keta-1][i]+str(int(unta[keta-1][i][keta-2])+1))\nunchi=[]\nfor i in range(11):\n\tunchi+=unta[i]\nprint(unchi[k-1])'] | ['Time Limit Exceeded', 'Accepted'] | ['s123930806', 's591048397'] | [94036.0, 46060.0] | [2109.0, 555.0] | [846, 685] |
p02720 | u724724669 | 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 none of 31415, 119, or 13579 is. You are given a positive integer K. Find the K-th smallest lunlun number. | ['K = int(input())\ncount = 0\nlunlun = 0\n\nwhile count < K:\n # count =+ 1\n #print(lunlun)\n ketasu = len(str(lunlun))\n lunlun = lunlun + 1\n flag = 0\n if ketasu == 1:\n count = count + 1\n else:\n for i in range(1, ketasu):\n # print((lunlun%(10**(i+1))//(10**i)), (lunlun%(10**i)))\n if abs((lunlun%(10**(i+1))//(10**i))-(lunlun%(10**i))) > 1:\n batsuketa = i\n break\n flag = flag + 1\n if flag == ketasu-1:\n print(lunlun)\n count = count + 1\n elif ((lunlun%(10**(i+1))//(10**i))-(lunlun%(10**i))) > 1:\n\n lunlun = (lunlun+10**batsuketa) // (10**batsuketa) * (10**batsuketa)\n\nprint(lunlun)', 'K = int(input())\ncount = 9\nlunlun = [1,2,3,4,5,6,7,8,9]\ni = 0\n\nwhile count < K:\n if (lunlun[i]%10) != 0:\n lunlun.append(lunlun[i]*10+lunlun[i]%10-1)\n count = count + 1\n lunlun.append(lunlun[i]*10+lunlun[i]%10)\n count = count + 1\n if (lunlun[i]%10) != 9:\n lunlun.append(lunlun[i]*10+lunlun[i]%10+1)\n count = count+1\n i= i+1\nprint(lunlun[K-1])'] | ['Wrong Answer', 'Accepted'] | ['s429033067', 's997878024'] | [3064.0, 7188.0] | [2107.0, 66.0] | [638, 358] |
p02720 | u736470924 | 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 none of 31415, 119, or 13579 is. You are given a positive integer K. Find the K-th smallest lunlun number. | ['k = int(input())\nq = []\nfor i in range(1, 10):\n q.append(i)\nfor i in range(k):\n x = q.pop(0)\n if x % 10 != 0:\n q.append(10 * x + x % 10 - 1)\n q.append(10 * x + x % 10)\n if x % 10 != 9:\n q.append(10 * x + x % 10 + 1)\n # print(q)\n', 'from collections import deque\n\n\nk = int(input())\nq = deque(range(1, 10))\n\nfor i in range(k):\n x = q.popleft()\n if x % 10 != 0:\n q.append(10 * x + x % 10 - 1)\n q.append(10 * x + x % 10)\n if x % 10 != 9:\n q.append(10 * x + x % 10 + 1)\n\nprint(x)'] | ['Wrong Answer', 'Accepted'] | ['s298736896', 's604600060'] | [10200.0, 11908.0] | [2104.0, 126.0] | [260, 268] |
p02720 | u736564905 | 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 none of 31415, 119, or 13579 is. You are given a positive integer K. Find the K-th smallest lunlun number. | ['import queue\nnum=int(input())\nq=queue.Queue()\nfor i in range(1,10):\n q.put(i)\nfor j in range(num):\n ans=q.get()\n if ans%10!=0:\n q.put(10*ans+(ans%10)-1)\n q.put(10*ans+(ans%10)-1)\n if ans%10!=0:\n q.put(10*ans+(ans%10)-1)\nprint(ans)', 'import queue\nnum=int(input())\nq=queue.Queue()\nfor i in range(1,10):\n q.put(i)\nfor j in range(num):\n ans=q.get()\n if ans%10!=0:\n q.put(10*ans+(ans%10)-1)\n q.put(10*ans+(ans%10))\n if ans%10!=9:\n q.put(10*ans+(ans%10)+1)\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s276507530', 's053769565'] | [10900.0, 12452.0] | [1034.0, 1044.0] | [241, 239] |
p02720 | u738898077 | 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 none of 31415, 119, or 13579 is. You are given a positive integer K. Find the K-th smallest lunlun number. | ['muri', 'from collections import deque\nk = int(input())\nans = 0\nnum = ["0","1","2","3","4","5","6","7","8","9"]\ndq = deque(["1","2","3","4","5","6","7","8","9"])\n# print(num[k:k+2])\nif k<=12:\n print(k)\nelse:\n while 1:\n ans += 1\n a = dq.popleft()\n if ans == k:\n print(int(a))\n exit()\n for i in num[max(0,int(a[-1])-1):min(10,int(a[-1])+2)]:\n dq.append(a+i)'] | ['Runtime Error', 'Accepted'] | ['s390032910', 's554556483'] | [2940.0, 17012.0] | [17.0, 209.0] | [4, 413] |
p02720 | u745387661 | 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 none of 31415, 119, or 13579 is. You are given a positive integer K. Find the K-th smallest lunlun number. | ['from collections import deque\n\nq=deque()\n\nN=int(input())\n\nfor i in range(1,10):\n q.append(i)\n\nfor _ in range(N-1):\n x=q.popleft()\n if x%10!=0:\n q.append(10*x+(x%10)-1)\n q.append(10*x+(x%10))\n if x%10!=9:\n q.append(10*x+(x%10)+1)\n\nprint(q.poplefr())', 'from collections import deque\n\nq=deque()\n\nN=int(input())\n\nfor i in range(1,10):\n q.append(i)\n\nfor _ in range(N-1):\n x=q.popleft()\n if x%10!=0:\n q.append(10*x+(x%10-1))\n q.append(10*x+(x%10))\n if x%10!=9:\n q.append(10*x+(x%10+1))\n\nprint(q.popleft())\n'] | ['Runtime Error', 'Accepted'] | ['s635545623', 's609091667'] | [11908.0, 12384.0] | [134.0, 125.0] | [259, 260] |
p02720 | u745812846 | 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 none of 31415, 119, or 13579 is. You are given a positive integer K. Find the K-th smallest lunlun number. | ['k = int(input()) \n \n lunlun = [i for i in range(1, 10)]\n \n p = 0 \n\n def generate_lunlun(p):\n last = p % 10\n if last - 1 >= 0:\n yield p * 10 + last - 1\n yield p * 10 + last\n if last + 1 <= 9:\n yield p * 10 + last + 1 \n\nwhile len(lunlun) < k:\n for new_lunlun in generate_lunlun(lunlun[p]):\n lunlun.append(new_lunlun)\n p += 1\n\nprint(lunlun[k-1])', 'k = int(input()) \n \nlunlun = [i for i in range(1, 10)]\n \np = 0 \n\ndef generate_lunlun(p):\n last = p % 10\n if last - 1 >= 0:\n yield p * 10 + last - 1\n yield p * 10 + last\n if last + 1 <= 9:\n yield p * 10 + last + 1 \n\nwhile len(lunlun) < k:\n for new_lunlun in generate_lunlun(lunlun[p]):\n lunlun.append(new_lunlun)\n p += 1\n\nprint(lunlun[k-1])'] | ['Runtime Error', 'Accepted'] | ['s739028047', 's072442656'] | [2940.0, 7272.0] | [18.0, 61.0] | [384, 378] |
p02720 | u753386263 | 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 none of 31415, 119, or 13579 is. You are given a positive integer K. Find the K-th smallest lunlun number. | ['from collections import deque\n\nk = int(input())\nlimit = 10\n\nstart = [i for i in range(1, 10)]\nans = []\nq=deque(start)\nwhile q:\n\tnum=q.popleft()\n\tif len(str(num))>11:\n\t\tcontinue\n\tans.append(num)\n\tlast=str(num)[-1]\n\tif last == "0":\n\t\tadd = [\'0\', \'1\']\n\telif last == \'9\':\n\t\tadd = [\'8\',"9"] \n\telse:\n\t\tadd = [str(int(last) - 1), str(int(last)), str(int(last) + 1)]\n\tfor i in add:\n\t\tq.append(int(str(num)+i))\n\nans = sorted(ans)\nprint(ans[k - 1])', 'from collections import deque\n\nk = int(input())\nlimit = 10\n\nstart = [i for i in range(1, 10)]\nans = []\ndef DFS(num):\n\tif len(str(num))>11:\n\t\treturn 1\n\tans.append(num)\n\tlast=str(num)[-1]\n\tif last == "0":\n\t\tadd = [\'0\', \'1\']\n\telif last == \'9\':\n\t\tadd = [\'8\',"9"] \n\telse:\n\t\tadd = [str(int(last) - 1), str(int(last)), str(int(last) + 1)]\n\tfor i in add:\n\t\tDFS(int(str(num)+i))\n\nfor j in start:\n\tDFS(j)\n\nans = sorted(ans)\nprint(ans[k - 1])'] | ['Time Limit Exceeded', 'Accepted'] | ['s032746612', 's139758923'] | [76796.0, 37504.0] | [2207.0, 1594.0] | [532, 514] |
p02720 | u757030836 | 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 none of 31415, 119, or 13579 is. You are given a positive integer K. Find the K-th smallest lunlun number. | ['a=[]\n\ndef dfs(x):\n if x>3234566667:\n return\n a.append(x)\n for i in range(10):\n if abs(x%10-i) <= 1:\n dfs(x%10+i)\n \nfor i in range(1,10):\n dfs(i)\na =sorted(a)\nk=int(input())\nprint(a[k-1])', 'a = []\n\ndef dfs(x):\n if x > 3234566667:\n return\n a.append(x)\n for i in range(10):\n if abs(x%10-i) <= 1:\n dfs(x*10+i)\n\nfor i in range(1, 10):\n dfs(i)\na = sorted(a)\nk = int(input())\nprint(a[k-1])\n'] | ['Runtime Error', 'Accepted'] | ['s055083278', 's118597332'] | [3932.0, 8512.0] | [75.0, 252.0] | [206, 231] |
p02720 | u762420987 | 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 none of 31415, 119, or 13579 is. You are given a positive integer K. Find the K-th smallest lunlun number. | ['from collections import deque\nK = int(input()) - 1\ntodo = deque(range(1, 10))\nans = []\ncounter = 0\nwhile counter <= K:\n seed = todo.pop(0)\n ans.append(seed)\n counter += 1\n last_dig = int(str(seed)[-1])\n for i in range(max(0, last_dig-1), min(10, last_dig+2)):\n todo.append(int(str(seed) + str(i)))\nprint(ans[-1])', 'from collections import deque\nK = int(input()) - 1\ntodo = deque(range(1, 10))\nans = []\ncounter = 0\nwhile counter <= K:\n seed = todo.pop()\n ans.append(seed)\n counter += 1\n last_dig = int(str(seed)[-1])\n for i in range(max(0, last_dig-1), min(10, last_dig+2)):\n todo.append(int(str(seed) + str(i)))\nprint(ans[-1])', 'from collections import deque\nK = int(input()) - 1\ntodo = deque(range(1, 10))\nans = []\ncounter = 0\nwhile counter <= K:\n seed = todo.popleft()\n ans.append(seed)\n counter += 1\n last_dig = int(str(seed)[-1])\n for i in range(max(0, last_dig-1), min(10, last_dig+2)):\n todo.append(int(str(seed) + str(i)))\nprint(ans[-1])'] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s754010807', 's954670921', 's667039521'] | [3316.0, 12916.0, 14924.0] | [21.0, 2104.0, 416.0] | [334, 333, 337] |
p02720 | u792078574 | 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 none of 31415, 119, or 13579 is. You are given a positive integer K. Find the K-th smallest lunlun number. | ['K = int(input())\n\nq = [1,2,3,4,5,6,7,8,9]\ni = 0\nn = 0\nwhile n < K:\n x = q[i]\n if x % 10 > 0:\n q.append(x * 10 + x - 1)\n n += 1\n q.append(x * 10 + x)\n n += 1\n if x % 10 < 9:\n q.append(x * 10 + x + 1)\n n += 1\n i += 1\nprint(q[K])', 'K = int(input())\n\nq = [1,2,3,4,5,6,7,8,9]\ni = 0\nn = 9\nwhile n < K:\n x = q[i]\n m = x % 10\n if m > 0:\n q.append(x * 10 + m - 1)\n n += 1\n q.append(x * 10 + m)\n n += 1\n if m < 9:\n q.append(x * 10 + m + 1)\n n += 1\n i += 1\nprint(q[K-1])'] | ['Wrong Answer', 'Accepted'] | ['s878580936', 's814914640'] | [7284.0, 7264.0] | [63.0, 58.0] | [272, 279] |
p02720 | u802234211 | 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 none of 31415, 119, or 13579 is. You are given a positive integer K. Find the K-th smallest lunlun number. | ['K = int(input())\ni = 10\nl= 0\nlunlunlist = []\n\nwhile all:\n l += 1 \n lunlunlist.append(l)\n if(l == 9):\n break\n \nwhile all:\n if(len(lunlunlist)>=K):\n break\n i_str = str(i)\n array = list(map(int,i_str))\n j=0\n f=0\n for j in range(len(array)-1):\n if(abs(array[j]-array[j+1])>1):\n f = 1\n break\n if(f==0):\n lunlunlist.append(i)\n i+=1\nif(K<=9):\n print(lunlunlist[K-1])\nprint(lunlunlist,lunlunlist[-1])\n', 'import copy\nketa_lunlun = [1,2,3,4,5,6,7,8,9]\nnexketa_lunlun = []\nK = 0\nketa = 1\ndef lunlun_gen(lunlun):\n global K\n global keta_lunlun\n global nexketa_lunlun\n global keta\n if(keta>=10):\n return lunlun\n nexketa_lunlun.clear()\n for i in range(len(keta_lunlun)):\n if(0<keta_lunlun[i]%10<9):\n lunlun.append(keta_lunlun[i]*10+(keta_lunlun[i]%10)-1)\n lunlun.append(keta_lunlun[i]*10+(keta_lunlun[i]%10) )\n lunlun.append(keta_lunlun[i]*10+(keta_lunlun[i]%10)+1)\n nexketa_lunlun.append(keta_lunlun[i]*10+(keta_lunlun[i]%10-1))\n nexketa_lunlun.append(keta_lunlun[i]*10+(keta_lunlun[i]%10 ))\n nexketa_lunlun.append(keta_lunlun[i]*10+(keta_lunlun[i]%10+1))\n \n elif(keta_lunlun[i]%10 == 9):\n lunlun.append(keta_lunlun[i]*10+(keta_lunlun[i]%10)-1)\n lunlun.append(keta_lunlun[i]*10+(keta_lunlun[i]%10) )\n nexketa_lunlun.append(keta_lunlun[i]*10+(keta_lunlun[i]%10-1))\n nexketa_lunlun.append(keta_lunlun[i]*10+(keta_lunlun[i]%10))\n else:\n lunlun.append(keta_lunlun[i]*10+(keta_lunlun[i]%10))\n lunlun.append(keta_lunlun[i]*10+(keta_lunlun[i]%10)+1)\n nexketa_lunlun.append(keta_lunlun[i]*10+(keta_lunlun[i]%10))\n nexketa_lunlun.append(keta_lunlun[i]*10+(keta_lunlun[i]%10+1))\n keta_lunlun.clear()\n keta_lunlun.extend(nexketa_lunlun)\n keta +=1\n return lunlun_gen(lunlun)\n\ndef main():\n global K\n K = int(input())\n lunlun = [1,2,3,4,5,6,7,8,9]\n ans = lunlun_gen(lunlun)\n print(ans[K-1])\n\nif __name__ == "__main__":\n main()'] | ['Wrong Answer', 'Accepted'] | ['s797925631', 's735104194'] | [3188.0, 21488.0] | [2104.0, 152.0] | [482, 1647] |
p02720 | u806779442 | 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 none of 31415, 119, or 13579 is. You are given a positive integer K. Find the K-th smallest lunlun number. | ['from collections import deque\n\nk = int(input())\nq = deque([1,2,3,4,5,6,7,8,9])\n\nfor i in range(1,k):\n l = q.popleft()\n m = l % 10\n if (m != 0):\n q.append(l * 10 + m - 1)\n q.append(l * 10 + m)\n if (m != 9):\n q.append(l * 10 + m + 1)\n\nprint(q.pop())', 'from collections import deque\n\nk = int(input())\nq = deque([1,2,3,4,5,6,7,8,9])\n\nfor i in range(1,k):\n l = q.popleft()\n if (len(q) < k):\n m = l % 10\n if (m != 0):\n q.append(l * 10 + m - 1)\n q.append(l * 10 + m)\n if (m != 9):\n q.append(l * 10 + m + 1)\n\nprint(q.popleft())'] | ['Wrong Answer', 'Accepted'] | ['s479447331', 's440387590'] | [11968.0, 8040.0] | [108.0, 95.0] | [276, 325] |
p02720 | u821441703 | 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 none of 31415, 119, or 13579 is. You are given a positive integer K. Find the K-th smallest lunlun number. | ['import sys\n\npassed = set()\n\ndef check(x, y):\n if x == y:\n return True\n z = abs(x - y)\n return True if z <= 1 else False\n\ndef lunlun(x):\n sx = str(x)\n ix = x\n for i in range(len(sx) - 1):\n if ix in passed:\n return True\n if check(int(sx[0]), int(sx[1])):\n ix = ix - (int(sx[0] * (10 ** (len(sx) - 1))))\n sx = str(ix)\n else:\n return False\n return True\n\nK = int(sys.stdin.readline().rstrip())\n\ni = 0\nx = 0\nwhile i < K:\n x += 1\n if lunlun(x):\n i += 1\n passed.add(x)\n\nprint(x)\n', 'import sys\nfrom collections import deque\n\nK = int(sys.stdin.readline().rstrip())\n\ndeq = deque(range(9, 0, -1))\nenqueue = deq.appendleft\ndequeue = deq.pop\n\nfor _ in range(K):\n\tx = dequeue()\n\ty = x % 10\n\tif y != 0:\n\t\tenqueue(x * 10 + y - 1)\n\tenqueue(x * 10 + y)\n\tif y != 9:\n\t\tenqueue(x * 10 + y + 1)\nprint(x)\n'] | ['Wrong Answer', 'Accepted'] | ['s729697153', 's957633451'] | [3316.0, 11976.0] | [2104.0, 103.0] | [588, 307] |
p02720 | u825378567 | 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 none of 31415, 119, or 13579 is. You are given a positive integer K. Find the K-th smallest lunlun number. | ['K=int(input())\nans=9\ndp=[[0]*10 for i in range(10)]\ndp[0]=[1]*10\nflag=0\nindex,r=0,0\nfor j in range(1,10):\n for i in range(10):\n tmp=0\n tmp+=dp[j-1][i]\n if i-1>=0:\n tmp+=dp[j-1][i-1]\n if i+1<=9:\n tmp+=dp[j-1][i+1]\n dp[j][i]=tmp\n if i!=0:\n ans+=dp[j][i]\n if ans>=K:\n index,r=j,i\n flag=1\n break\n if flag==1:\n break\nprint(dp)\nprint(index,r)\nK-=ans\nans=r*10**(index)\nK=abs(K)\nprint(K)\nfor i in range(index-1,-1,-1):\n for j in range(10):\n if K-dp[i][j]>0:\n K-=dp[i][j]\n elif K-dp[i][j]==0:\n ans+=j*10**(i+1)\n print(ans)\n print(exit())\n else:\n K+=dp[i][j]\n ans+=(j)*10**(i)\n break\nprint(ans)', 'from collections import deque\nK=int(input())\nq=deque([1,2,3,4,5,6,7,8,9])\nfor i in range(K):\n ans=q.popleft()\n tmp=ans\n if tmp%10 >0:\n q.append(tmp*10+tmp%10-1)\n q.append(tmp*10+tmp%10)\n if tmp%10 < 9:\n q.append(tmp*10+tmp%10+1)\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s955275184', 's691420149'] | [3064.0, 11908.0] | [19.0, 131.0] | [813, 268] |
p02720 | u827554201 | 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 none of 31415, 119, or 13579 is. You are given a positive integer K. Find the K-th smallest lunlun number. | ['# coding: utf-8\n# Your code here!\n\nk = int(input())\n\nlunlun = []\n\nend = False\nwhile True:\n val = 0\n while True:\n val += 1\n val_list = [int(x) for x in list(str(val))]\n is_lun = True \n for x in range(len(val_list) - 1):\n if abs(val_list[x] - val_list[x + 1]) <= 1:\n continue\n else:\n is_lun = False\n if is_run:\n lunlun.append(val)\n else:\n continue\n if len(lunlun) == k:\n end = True\n break\n if end:\n break\n\nprint(lunlun[k - 1])\n', 'k = int(input())\n\nnums = []\ndef inc(num):\n if num > 3234566667:\n return None\n if num <= 3234566667:\n nums.append(num)\n\n end = str(num)[-1:]\n end_num = int(end)\n\n if end_num < 9:\n inc(num * 10 + end_num + 1)\n\n inc(num * 10 + end_num)\n\n if end_num > 0:\n inc(num * 10 + end_num - 1)\n\nfor i in range(1, 10):\n inc(i)\n\nsort_nums = sorted(nums)\nprint(sorted(nums)[k - 1])'] | ['Runtime Error', 'Accepted'] | ['s638016275', 's625725859'] | [3064.0, 9072.0] | [18.0, 172.0] | [586, 414] |
p02720 | u829249049 | 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 none of 31415, 119, or 13579 is. You are given a positive integer K. Find the K-th smallest lunlun number. | ['K=int(input())\nANS=[]\nfor i in range(1,10**5):\n LEN=len(str(i))\n STR=str(i)\n if LEN==1:\n ANS+=[i]\n for k in range(LEN-1):\n if abs(int(STR[k])-int(STR[k+1]))>1:\n break\n if k==LEN-2:\n ANS+=[i]\ni=10**5\nwhile i<10**7:\n LEN=len(str(i))\n STR=str(i)\n if LEN==1:\n ANS+=[i]\n for k in range(LEN-1):\n if abs(int(STR[k])-int(STR[k+1]))>1:\n i+=10*(LEN-(k+2))\n break\n if k==LEN-2:\n ANS+=[i]\nans=ANS[K-1] \nprint(ans)', 'K=int(input())\nANS=[]\nfor i in range(1,10**6*2):\n LEN=len(str(i))\n STR=str(i)\n if LEN==1:\n ANS+=[i]\n for k in range(LEN-1):\n if abs(int(STR[k])-int(STR[k+1]))>1:\n break\n if k==LEN-2:\n ANS+=[i]\nans=ANS[K-1] \nprint(ans)', 'K=int(input())\nANS=[]\nfor i in range(1,10**6*5):\n LEN=len(str(i))\n STR=str(i)\n if LEN==1:\n ANS+=[i]\n for k in range(LEN-1):\n if abs(int(STR[k])-int(STR[k+1]))>1:\n break\n if k==LEN-2:\n ANS+=[i]\nans=ANS[K-1] \nprint(ans)', 'K=int(input())\nANS=[]\nfor i in range(1,10**6*3):\n LEN=len(str(i))\n STR=str(i)\n if LEN==1:\n ANS+=[i]\n for k in range(LEN-1):\n if abs(int(STR[k])-int(STR[k+1]))>1:\n break\n if k==LEN-2:\n ANS+=[i]\nans=ANS[K-1] \nprint(ans)', 'K=int(input())\nANS=[i for i in range(1,10)]\ni=0\nwhile len(ANS)<=10**5:\n last=str(ANS[i])[-1]\n if last=="0":\n ANS+=[ANS[i]*10,ANS[i]*10+1]\n elif last=="9":\n ANS+=[ANS[i]*10+8,ANS[i]*10+9]\n else:\n ANS+=[ANS[i]*10+int(last)-1,ANS[i]*10+int(last),ANS[i]*10+int(last)+1]\n i+=1 \nans=ANS[K-1]\nprint(ans)'] | ['Time Limit Exceeded', 'Time Limit Exceeded', 'Time Limit Exceeded', 'Time Limit Exceeded', 'Accepted'] | ['s208591893', 's595606866', 's608979515', 's991168655', 's020158864'] | [14412.0, 9100.0, 9188.0, 9176.0, 13260.0] | [2206.0, 2206.0, 2205.0, 2205.0, 66.0] | [452, 240, 240, 240, 311] |
p02720 | u841599623 | 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 none of 31415, 119, or 13579 is. You are given a positive integer K. Find the K-th smallest lunlun number. | ['K=int(input())\nn=0\nc=0\nwhile 1:\n j=True\n if len(n_str) > 1 and abs(int(n_str[0]) - int(n_str[1])) > 1:\n n = (int(str(int(n_str[0])+1)+str(int(n_str[0]))))*(10**(len(n_str)-2))\n else:\n n+=1\n n_str=str(n)\n for i in range(len(n_str)-1):\n if abs(int(n_str[i]) - int(n_str[i+1])) > 1:\n j=False\n if j:\n c+=1\n if c==K:\n print(n)\n break\n', 'from collections import deque\nK=int(input())\nQ=deque(list(range(1,10)))\nfor _ in range(K):\n x=Q.popleft()\n if x%10 != 0:\n Q.append(10*x+x%10-1)\n Q.append(10*x+x%10)\n if x%10 != 9:\n Q.append(10*x+x%10+1)\nprint(x)'] | ['Runtime Error', 'Accepted'] | ['s199222192', 's353773371'] | [2940.0, 11908.0] | [17.0, 122.0] | [361, 221] |
p02720 | u846226907 | 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 none of 31415, 119, or 13579 is. You are given a positive integer K. Find the K-th smallest lunlun number. | ['from collections import deque\n\nK = int(input())\n\ndq = deque(list(range(1,10)))\n\nrep = 0\n\nwhile rep < K:\n now = dq.popleft()\n rep += 1\n for i in (-1,0,1):\n if 0 <= now%10+1<10:\n dq.append(now*10+now*10+i)\n\nprint(now)', 'from collections import deque\n\nK = int(input())\n\ndq = deque(list(range(1,10)))\n\nrep = 0\n\nwhile rep < K:\n now = dq.popleft()\n rep += 1\n for i in (-1,0,1):\n if 0 <= now%10+1<10:\n dq.append(now*10+i)\n\nprint(now)', 'from collections import deque\n\nK = int(input())\n\ndq = deque(list(range(1,10)))\n\nfor i in range(K):\n now = dq.popleft()\n for i in (-1,0,1):\n add = (now%10)+i\n if 0 <= add<10:\n dq.append(now*10+add)\n\nprint(now)'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s208681491', 's344966980', 's844068245'] | [7820.0, 7840.0, 12404.0] | [152.0, 136.0, 147.0] | [242, 235, 239] |
p02720 | u861141787 | 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 none of 31415, 119, or 13579 is. You are given a positive integer K. Find the K-th smallest lunlun number. | ['\nk = int(input())\na = [i+1 for i in range(9)]\n\n\nwhile 1:\n if k <= len(a):\n print(a[k-1])\n exit()\n k -= len(a)\n old = []\n a, old = old, a\n for x in old:\n for i in range(-1, 2):\n d = x % 10 + i\n if d < 0 or d > 9: continue\n nx = x*10 + d\n a.append(nx)\n print(a)', '\nfrom collections import deque\n\nk = int(input())\n\nque = deque([1, 2, 3, 4, 5, 6, 7, 8, 9])\n\nfor i in range(k-1):\n x = que.popleft()\n y = x % 10 \n if y != 0:\n que.append(10*x+y-1)\n que.append(10*x+y)\n if y != 9:\n que.append(10*x+y+1)\n\nans = que.popleft()\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s018394180', 's664561902'] | [17028.0, 11956.0] | [149.0, 109.0] | [356, 305] |
p02720 | u873616440 | 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 none of 31415, 119, or 13579 is. You are given a positive integer K. Find the K-th smallest lunlun number. | ['K = 12\ntable = [1, 2, 3, 4, 5, 6, 7, 8, 9]\nfor i in table:\n if len(table) > K:\n break\n x = i % 10\n for j in range(max(0, x - 1), min(x + 2, 10)):\n table.append(i * 10 + j)\n\nprint(table[K-1])', "import numpy as np\nK = int(input())\ntable = ['1', '2', '3', '4', '5', '6', '7', '8', '9']\nc = 9\nresult = []\nfor i in table:\n runrun = i\n if runrun[-1] == '0':\n table.extend([runrun + str(int(runrun[-1])), \n runrun + str(int(runrun[-1])+1)])\n c += 2\n elif runrun[-1] == '9':\n table.extend([runrun + str(int(runrun[-1])-1), \n runrun + str(int(runrun[-1]))])\n c += 2\n else:\n table.extend([runrun + str(int(runrun[-1])-1), \n runrun + str(int(runrun[-1])), \n runrun + str(int(runrun[-1])+1)])\n c += 3\n if c>=K:\n print(table[K-1])\n exit()\n"] | ['Wrong Answer', 'Accepted'] | ['s319239507', 's910413808'] | [2940.0, 19400.0] | [18.0, 227.0] | [199, 634] |
p02720 | u875449556 | 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 none of 31415, 119, or 13579 is. You are given a positive integer K. Find the K-th smallest lunlun number. | ['from collections import deque\n\n\nk = int(input())\nd = deque([1,2,3,4,5,6,7,8,9])\n\nfor i in range(k):\n a = d.popleft()\n d.append(i*10 + i % 10 - 1)\n d.append(i*10 + i % 10)\n if a != 9:\n d.append(i*10 + i % 10 + 1)\n\nprint(a)\n\n\n', 'from collections import deque\n\n\nk = int(input())\nd = deque([1,2,3,4,5,6,7,8])\n\nfor i in range(k):\n a = d.popleft()\n d.append(i*10 + i % 10 - 1)\n d.append(i*10 + i % 10)\n if a != 9:\n d.append(i*10 + i % 10 + 1)\n\nprint(a)\n\n\n', 'from collections import deque\n\n\nk = int(input())\nd = deque([1,2,3,4,5,6,7,8,9])\n\nfor i in range(k):\n a = d.popleft()\n if a % 10 != 0:\n d.append(a*10 + a % 10 - 1)\n d.append(a*10 + a % 10)\n if a % 10 != 9:\n d.append(i*10 + i % 10 + 1)\n\nprint(a)\n\n\n', 'from collections import deque\n\n\nk = int(input())\nd = deque([1,2,3,4,5,6,7,8,9])\n\nfor i in range(k):\n a = d.popleft()\n if a % 10 != 0:\n d.append(a*10 + a % 10 - 1)\n d.append(a*10 + a % 10)\n if a % 10 != 9:\n d.append(a*10 + a % 10 + 1)\n\nprint(a)\n\n\n'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s052724851', 's372757840', 's508018287', 's799873966'] | [11284.0, 11284.0, 10716.0, 11908.0] | [114.0, 109.0, 117.0, 130.0] | [243, 241, 272, 272] |
p02720 | u881816188 | 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 none of 31415, 119, or 13579 is. You are given a positive integer K. Find the K-th smallest lunlun number. | ['k=int(input())\na=[i for i in range(10)]\n\nwhile True:\n \n if k<=len(a):\n print(a[k-1])\n break\n \n k-=len(a)\n old=[]\n old, a=a, old\n for x in old:\n for i in range(-1,2):\n d=x%10+d\n if d<0 or d>9:\n continue\n new_x=x*10+d\n a.append(new_x)', 'k=int(input())\na=[i for i in range(1,10)]\n\nwhile True:\n \n if k<=len(a):\n print(a[k-1])\n break\n \n k-=len(a)\n old=[]\n old, a=a, old\n for x in old:\n for i in range(-1,2):\n d=x%10+i\n if d<0 or d>9:\n continue\n new_x=x*10+d\n a.append(new_x)'] | ['Runtime Error', 'Accepted'] | ['s617208195', 's209703044'] | [3064.0, 11028.0] | [17.0, 129.0] | [739, 741] |
p02720 | u888337853 | 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 none of 31415, 119, or 13579 is. You are given a positive integer K. Find the K-th smallest lunlun number. | ["import sys\nimport re\nimport math\nimport collections\nimport decimal\nimport bisect\nimport itertools\nimport fractions\nimport functools\nimport copy\nimport heapq\nimport decimal\nimport statistics\nimport queue\n\nsys.setrecursionlimit(10000001)\nINF = sys.maxsize\nMOD = 10 ** 9 + 7\n\nni = lambda: int(sys.stdin.readline())\nns = lambda: map(int, sys.stdin.readline().split())\nna = lambda: list(map(int, sys.stdin.readline().split()))\n\n\n# ===CODE===\ndef main():\n k = ni()\n\n que = queue.Queue()\n\n if k < 11:\n print(k)\n exit(0)\n\n for i in range(1, 10):\n que.put(i)\n\n cnt = 19\n flg = True\n while flg:\n tmp = que.get()\n grade1 = tmp % 10\n\n for i in (-1, 0, 1):\n if -1 < grade1 + i < 10:\n que.put(tmp * 10 + grade1 + i)\n cnt += 1\n if cnt == k:\n print(tmp * 10 + grade1 + i)\n\n exit(0)\n\n\nif __name__ == '__main__':\n main()\n", "import sys\nimport re\nimport math\nimport collections\nimport decimal\nimport bisect\nimport itertools\nimport fractions\nimport functools\nimport copy\nimport heapq\nimport decimal\nimport statistics\nimport queue\n\nsys.setrecursionlimit(10000001)\nINF = sys.maxsize\nMOD = 10 ** 9 + 7\n\nni = lambda: int(sys.stdin.readline())\nns = lambda: map(int, sys.stdin.readline().split())\nna = lambda: list(map(int, sys.stdin.readline().split()))\n\n\n# ===CODE===\ndef main():\n k = ni()\n\n que = queue.Queue()\n\n if k < 11:\n print(k)\n exit(0)\n\n for i in range(1, 10):\n que.put(i)\n\n cnt = 9\n flg = True\n while flg:\n tmp = que.get()\n grade1 = tmp % 10\n\n for i in (-1, 0, 1):\n if -1 < grade1 + i < 10:\n que.put(tmp * 10 + grade1 + i)\n cnt += 1\n if cnt == k:\n print(tmp * 10 + grade1 + i)\n exit(0)\n\n\nif __name__ == '__main__':\n main()\n"] | ['Wrong Answer', 'Accepted'] | ['s893207956', 's552033575'] | [45984.0, 13792.0] | [2207.0, 234.0] | [963, 961] |
p02720 | u891504219 | 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 none of 31415, 119, or 13579 is. You are given a positive integer K. Find the K-th smallest lunlun number. | ['def is_lunlun(n):\n m = str(n)\n for i in range(1,len(m)):\n if abs(int(m[i]) - int(m[i-1])) > 1:\n return False\n return True\n\ndef main():\n K = int(input())\n A = [i for i in range(100000) if is_lunlun(i)]\n B = [int(str(a1)+str(a2)) for a1 in A for a2 in A if is_lunlun(int(str(a1)+str(a2))) and int(str(a1)+str(a2)) < 3234566668]\n B2 = sorted(set(B))\n print(B2[K])\n\nif __name__ == "__main__":\n main()', 'def main():\n K = int(input())\n from collections import deque\n A = deque([1,2,3,4,5,6,7,8,9])\n a = 0\n while True:\n x = A.popleft()\n xmod10 = x % 10\n if xmod10 != 0:\n A.append(10*x + xmod10 - 1)\n A.append(10*x + xmod10)\n if xmod10 != 9:\n A.append(10*x + xmod10 + 1)\n a += 1\n if a == K:\n print(x)\n break\n\nif __name__ == "__main__":\n main()'] | ['Time Limit Exceeded', 'Accepted'] | ['s635272804', 's212153014'] | [9172.0, 11980.0] | [2104.0, 94.0] | [441, 447] |
p02720 | u896726004 | 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 none of 31415, 119, or 13579 is. You are given a positive integer K. Find the K-th smallest lunlun number. | ['from collections import deque\n\nK = int(input())\nQ = list(range(1, 10))\n\nfor i in range(K):\n x = Q[i]\n y = x%10\n if y != 0:\n Q.append(10*x + y-1)\n Q.append(10*x + y)\n if y != 9:\n Q.append(10*x + y+1)\n\nprint(Q[K])', 'from collections import deque\n\nK = int(input())\nQ = list(range(1, 10))\n\nfor i in range(K):\n x = Q[i]\n y = x%10\n if y != 0:\n Q.append(10*x + y-1)\n Q.append(10*x + y)\n if y != 9:\n Q.append(10*x + y+1)\n\nprint(Q[K-1])'] | ['Wrong Answer', 'Accepted'] | ['s505383946', 's607731867'] | [16120.0, 16120.0] | [110.0, 110.0] | [240, 242] |
p02720 | u900993244 | 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 none of 31415, 119, or 13579 is. You are given a positive integer K. Find the K-th smallest lunlun number. | ['a = int(input())\n\nN = [1,2,3,4,5,6,7,8,9]\n\nFor x in range(a):\n tmp = N[x]\n if tmp%10 != 0:\n N.append(tmp*10+tmp%10-1)\n N.append(tmp*10+tmp%10)\n if tmp%10 != 9:\n N.append(tmp*10+tmp%10+1)\nprint(N[a-1])\n', 'k = int(input())\nlunlun = [0] * 100\nlunlun[1] = [1, 2, 3, 4, 5, 6, 7, 8, 9]\ni = 1\n\nfor i in range(9):\n n = len(lunlun[i])\n lunlun[i+1] = []\n for x in lunlun[i]:\n r = x%10\n if r > 0:\n lunlun[i+1].append(10*x + r-1)\n lunlun[i+1].append(10*x + r)\n if r < 9:\n lunlun[i+1].append(10*x + r+1)\n i += 1\n\nfor i in range(1, 11):\n for j in range(len(lunlun[i])):\n k -= 1\n if k == 0:\n print(lunlun[i][j])\n exit()\n', 'k = int(input())\nlunlun = [0] * 100\nlunlun[1] = [1, 2, 3, 4, 5, 6, 7, 8, 9]\ni = 1\n\nfor _ in range(9):\n n = len(lunlun[i])\n lunlun[i+1] = []\n for x in lunlun[i]:\n r = x%10\n if r > 0:\n lunlun[i+1].append(10*x + r-1)\n lunlun[i+1].append(10*x + r)\n if r < 9:\n lunlun[i+1].append(10*x + r+1)\n i += 1\n\nfor i in range(1, 11):\n for j in range(len(lunlun[i])):\n k -= 1\n if k == 0:\n print(lunlun[i][j])\n exit()\n'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s349303646', 's949367940', 's437861732'] | [2940.0, 3064.0, 11636.0] | [17.0, 17.0, 95.0] | [214, 502, 502] |
p02720 | u909616675 | 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 none of 31415, 119, or 13579 is. You are given a positive integer K. Find the K-th smallest lunlun number. | ['import numpy as np\nK=100000\n\nn=np.zeros((10,11),dtype=int)\nfor i in range(9):\n\tn[i+1,1]=1\n\tn[i+1,2]=3\nn[9,2]=2\n\nfor i in range(3,11):\n\tn[1,i]=n[2,i-1]+np.sum(n[1,:])\n\tn[2,i]=n[1,i-1]+n[2,i-1]+n[3,i-1]\n\tn[3,i]=n[4,i-1]+n[2,i-1]+n[3,i-1]\n\tn[4,i]=n[4,i-1]+n[5,i-1]+n[3,i-1]\n\tn[5,i]=n[4,i-1]+n[5,i-1]+n[6,i-1]\n\tn[6,i]=n[5,i-1]+n[6,i-1]+n[7,i-1]\n\tn[7,i]=n[7,i-1]+n[8,i-1]+n[6,i-1]\n\tn[8,i]=n[7,i-1]+n[8,i-1]+n[9,i-1]\n\tn[9,i]=n[8,i-1]+n[9,i-1]\n\ni=1\nj=1\n\ndef ninecheck(i,j,K,ans):\n\tfor k in range(2):\n\t\tK-=n[i-1+k,j]\n\t\tif K<=0:\n\t\t\tK+=n[i-1+k,j]\n\t\t\tans+=(i-1+k)*(10**(j-1))\n\t\t\tif j==1:\n\t\t\t\ta=ans\n\t\t\t\treturn a\n\t\t\tj-=1\n\t\t\ti=i-1+k\n\t\t\tif i==1:\n\t\t\t\ta=onecheck(i,j,K,ans)\n\t\t\t\treturn a\n\t\t\telif i==9:\n\t\t\t\ta=ninecheck(i,j,K,ans)\n\t\t\t\treturn a\n\t\t\telse:\n\t\t\t\ta=normalcheck(i,j,K,ans)\n\t\t\t\treturn a\n\ndef onecheck(i,j,K,ans):\n\tfor k in range(1,j+1):\n\t\tK-=n[1,k]\n\t\tif K<=0:\n\t\t\tK+=n[1,k]\n\t\t\tans+=10**(k-1)\n\t\t\tj=k\n\t\t\tif j==1:\n\t\t\t\ta=ans\n\t\t\t\treturn a\n\t\t\tj-=1\n\t\t\ta=onecheck(i,j,K,ans)\n\t\t\treturn a\n\ti=2\n\tans+=i*(10**(j-1))\n\tj-=1\n\ta=normalcheck(i,j,K,ans)\n\treturn a\n\ndef normalcheck(i,j,K,ans):\n\tfor k in range(3):\n\t\tK-=n[i-1+k,j]\n\t\tif K<=0:\n\t\t\tK+=n[i-1+k,j]\n\t\t\tans+=(i-1+k)*(10**(j-1))\n\t\t\tif j==1:\n\t\t\t\ta=ans\n\t\t\t\treturn a\n\t\t\tj-=1\n\t\t\ti=i-1+k\n\t\t\tif i==1:\n\t\t\t\ta=onecheck(i,j,K,ans)\n\t\t\t\treturn a\n\t\t\telif i==9:\n\t\t\t\ta=ninecheck(i,j,K,ans)\n\t\t\t\treturn a\n\t\t\telse:\n\t\t\t\ta=normalcheck(i,j,K,ans)\n\t\t\t\treturn a\n\n\n\nans=0\nwhile True:\n\tK-=n[i,j]\n\tif K<=0:\n\t\tans+=i*(10**(j-1))\n\t\tK+=n[i,j]\n\t\tif j==1:\n\t\t\tb=ans\n\t\t\tbreak\n\t\tj-=1\n\t\tif i==1:\n\t\t\tb=onecheck(i,j,K,ans)\n\t\t\tbreak\n\t\telif i==9:\n\t\t\tb=ninecheck(i,j,K,ans)\n\t\t\tbreak\n\t\telse:\n\t\t\tb=normalcheck(i,j,K,ans)\n\t\t\tbreak\n\tif i==9:\n\t\ti=1\n\t\tj+=1\n\telse:\n\t\ti+=1\n\t\tcontinue\n\n\n\n\nprint(b)', 'import numpy as np\nK=int(input())\n\nn=np.zeros((10,11),dtype=int)\nfor i in range(9):\n\tn[i+1,1]=1\n\tn[i+1,2]=3\nn[9,2]=2\n\nfor i in range(3,11):\n\tn[1,i]=n[2,i-1]+np.sum(n[1,:])+1\n\tn[2,i]=n[1,i-1]+n[2,i-1]+n[3,i-1]\n\tn[3,i]=n[4,i-1]+n[2,i-1]+n[3,i-1]\n\tn[4,i]=n[4,i-1]+n[5,i-1]+n[3,i-1]\n\tn[5,i]=n[4,i-1]+n[5,i-1]+n[6,i-1]\n\tn[6,i]=n[5,i-1]+n[6,i-1]+n[7,i-1]\n\tn[7,i]=n[7,i-1]+n[8,i-1]+n[6,i-1]\n\tn[8,i]=n[7,i-1]+n[8,i-1]+n[9,i-1]\n\tn[9,i]=n[8,i-1]+n[9,i-1]\n\ni=1\nj=1\n\ndef ninecheck(i,j,K,ans):\n\tfor k in range(2):\n\t\tK-=n[i-1+k,j]\n\t\tif K<=0:\n\t\t\tK+=n[i-1+k,j]\n\t\t\tans+=(i-1+k)*(10**(j-1))\n\t\t\tif j==1:\n\t\t\t\ta=ans\n\t\t\t\treturn a\n\t\t\tj-=1\n\t\t\ti=i-1+k\n\t\t\tif i==1:\n\t\t\t\ta=onecheck(i,j,K,ans)\n\t\t\t\treturn a\n\t\t\telif i==9:\n\t\t\t\ta=ninecheck(i,j,K,ans)\n\t\t\t\treturn a\n\t\t\telse:\n\t\t\t\ta=normalcheck(i,j,K,ans)\n\t\t\t\treturn a\n\ndef onecheck(i,j,K,ans):\n\tK-=1\n\tif K==0:\n\t\ta=ans\n\t\treturn a\n\tfor k in range(1,j+1):\n\t\tK-=n[1,k]\n\t\tif K<=0:\n\t\t\tK+=n[1,k]\n\t\t\tans+=10**(k-1)\n\t\t\tj=k\n\t\t\tif j==1:\n\t\t\t\ta=ans\n\t\t\t\treturn a\n\t\t\tj-=1\n\t\t\ta=onecheck(i,j,K,ans)\n\t\t\treturn a\n\ti=2\n\tans+=i*(10**(j-1))\n\tj-=1\n\ta=normalcheck(i,j,K,ans)\n\treturn a\n\ndef normalcheck(i,j,K,ans):\n\tfor k in range(3):\n\t\tK-=n[i-1+k,j]\n\t\tif K<=0:\n\t\t\tK+=n[i-1+k,j]\n\t\t\tans+=(i-1+k)*(10**(j-1))\n\t\t\tif j==1:\n\t\t\t\ta=ans\n\t\t\t\treturn a\n\t\t\tj-=1\n\t\t\ti=i-1+k\n\t\t\tif i==1:\n\t\t\t\ta=onecheck(i,j,K,ans)\n\t\t\t\treturn a\n\t\t\telif i==9:\n\t\t\t\ta=ninecheck(i,j,K,ans)\n\t\t\t\treturn a\n\t\t\telse:\n\t\t\t\ta=normalcheck(i,j,K,ans)\n\t\t\t\treturn a\n\n\n\nans=0\nwhile True:\n\tK-=n[i,j]\n\tif K<=0:\n\t\tans+=i*(10**(j-1))\n\t\tK+=n[i,j]\n\t\tif j==1:\n\t\t\tb=ans\n\t\t\tbreak\n\t\tj-=1\n\t\tif i==1:\n\t\t\tb=onecheck(i,j,K,ans)\n\t\t\tbreak\n\t\telif i==9:\n\t\t\tb=ninecheck(i,j,K,ans)\n\t\t\tbreak\n\t\telse:\n\t\t\tb=normalcheck(i,j,K,ans)\n\t\t\tbreak\n\tif i==9:\n\t\ti=1\n\t\tj+=1\n\telse:\n\t\ti+=1\n\t\tcontinue\n\n\n\n\nprint(b)'] | ['Wrong Answer', 'Accepted'] | ['s286761285', 's963667517'] | [13068.0, 22052.0] | [151.0, 314.0] | [1673, 1716] |
p02720 | u914948583 | 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 none of 31415, 119, or 13579 is. You are given a positive integer K. Find the K-th smallest lunlun number. | ['from collections import deque\n\nk = int(input())\na = deque(range(1, 10))\ncnt = 0\n\nfor i in range(k):\n x = a.popleft()\n mod = x % 10\n if mod != 0:\n a.append(x*10 + mod -1)\n a.append(x * 10 + mod)\n if mod != 9:\n a.append(x*10 + mod + 1)\n print(a)\n\nprint(x)', 'from collections import deque\n\nk = int(input())\na = deque(range(1, 10))\n\nfor i in range(k):\n x = a.popleft()\n mod = x % 10\n if mod != 0:\n a.append(x*10 + mod -1)\n a.append(x * 10 + mod)\n if mod != 9:\n a.append(x*10 + mod + 1)\n\nprint(x)'] | ['Runtime Error', 'Accepted'] | ['s945609729', 's183716273'] | [134972.0, 11956.0] | [1491.0, 117.0] | [285, 264] |
p02720 | u919730120 | 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 none of 31415, 119, or 13579 is. You are given a positive integer K. Find the K-th smallest lunlun number. | ["def main():\n k=int(input())\n l=[[] for _ in range(20)]\n l[1]=[0,1,2,3,4,5,6,7,8,9]\n cnt=9\n if cnt>=k:\n print(l[k])\n exit()\n for i in range(2,20):\n for keta in range(1,i):\n for j in l[keta]:\n f=j//10**(i-2)\n if j==0:\n l[i].append(10**(i-1)+j)\n if f==0:\n if j//10**(len(str(j))-1)==1:\n l[i].append(10**(i-1)+j)\n elif f==1:\n l[i].append(10**(i-1)+j)\n l[i].append(2*10**(i-1)+j)\n elif f==9:\n l[i].append(8*10**(i-1)+j)\n l[i].append(9*10**(i-1)+j)\n elif f>0:\n l[i].append((f-1)*10**(i-1)+j)\n l[i].append(f*10**(i-1)+j)\n l[i].append((f+1)*10**(i-1)+j)\n if cnt+len(l[i])>=k:\n l[i].sort()\n ans=l[i][k-cnt-1]\n if ans==0:\n print(10**(i-1))\n else:\n l[4].sort()\n print(l[4])\n print(ans)\n exit()\n else:\n cnt+=len(l[i])\n\nif __name__ == '__main__':\n main()", "def main():\n k=int(input())\n l=[[] for _ in range(20)]\n l[1]=[0,1,2,3,4,5,6,7,8,9]\n cnt=9\n if cnt>=k:\n print(l[1][k])\n exit()\n for i in range(2,20):\n for keta in range(1,i):\n for j in l[keta]:\n f=j//10**(i-2)\n if j==0:\n l[i].append(10**(i-1)+j)\n if f==0:\n if j//10**(len(str(j))-1)==1:\n l[i].append(10**(i-1)+j)\n elif f==1:\n l[i].append(10**(i-1)+j)\n l[i].append(2*10**(i-1)+j)\n elif f==9:\n l[i].append(8*10**(i-1)+j)\n l[i].append(9*10**(i-1)+j)\n elif f>0:\n l[i].append((f-1)*10**(i-1)+j)\n l[i].append(f*10**(i-1)+j)\n l[i].append((f+1)*10**(i-1)+j)\n if cnt+len(l[i])>=k:\n l[i].sort()\n ans=l[i][k-cnt-1]\n if ans==0:\n print(10**(i-1))\n else:\n print(ans)\n exit()\n else:\n cnt+=len(l[i])\n\nif __name__ == '__main__':\n main()"] | ['Wrong Answer', 'Accepted'] | ['s927638315', 's364472912'] | [12384.0, 12384.0] | [211.0, 209.0] | [1266, 1165] |
p02720 | u922449550 | 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 none of 31415, 119, or 13579 is. You are given a positive integer K. Find the K-th smallest lunlun number. | ['cands = [1, 2, 3, 4, 5, 6, 7, 8, 9]\n\ndef add_v(v):\n global cands\n global K\n v0 = v % 10\n v0 = int(v[-1])\n if v0 == 0:\n cands += [v*10, v*10+1]\n K -=2\n elif v0 == 9:\n cands += [v*10+8, v*10+9]\n K -= 2\n else:\n cands += [v*10+v0-1, v*10+v0, v*10+v0+1]\n K -= 3\n\nK = int(input())\nidk = K\nK -= 9\nidx = 0\nwhile K >= 0:\n add_v(cands[idx])\n idx += 1\n\nprint(cands[idk-1])', 'cands = [1, 2, 3, 4, 5, 6, 7, 8, 9]\n\ndef add_v(v):\n global cands\n global K\n v0 = v % 10\n if v0 == 0:\n cands += [v*10, v*10+1]\n K -=2\n elif v0 == 9:\n cands += [v*10+8, v*10+9]\n K -= 2\n else:\n cands += [v*10+v0-1, v*10+v0, v*10+v0+1]\n K -= 3\n\nK = int(input())\nidk = K\nK -= 9\nidx = 0\nwhile K >= 0:\n add_v(cands[idx])\n idx += 1\n\nprint(cands[idk-1])'] | ['Runtime Error', 'Accepted'] | ['s801212432', 's750139843'] | [3064.0, 7156.0] | [19.0, 49.0] | [388, 370] |
p02720 | u927839462 | 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 none of 31415, 119, or 13579 is. You are given a positive integer K. Find the K-th smallest lunlun number. | ['import collections\nk=int(input())\nif k<=9:\n print(k)\nelse:\n k-=9\n l =list(range(9,0,-1))\n print(l)\n q = collections.deque(l)\n counter=0\n while counter<k:\n x=q.pop()\n xrem=x%10\n if xrem!=0:\n q.appendleft(10*x+xrem-1)\n counter+=1\n if counter>=k:\n break\n q.appendleft(10*x+xrem)\n counter+=1\n if counter>=k:\n break\n if xrem!=9:\n q.appendleft(10*x+xrem+1)\n counter+=1\n print(q[0])\n', 'import collections\nk=int(input())\nif k<=9:\n print(k)\nelse:\n k-=9\n l =list(range(9,0,-1))\n #print(l)\n q = collections.deque(l)\n counter=0\n while counter<k:\n x=q.pop()\n xrem=x%10\n if xrem!=0:\n q.appendleft(10*x+xrem-1)\n counter+=1\n if counter>=k:\n break\n q.appendleft(10*x+xrem)\n counter+=1\n if counter>=k:\n break\n if xrem!=9:\n q.appendleft(10*x+xrem+1)\n counter+=1\n print(q[0])\n'] | ['Wrong Answer', 'Accepted'] | ['s530053688', 's433117255'] | [6108.0, 6108.0] | [63.0, 61.0] | [534, 535] |
p02720 | u944643608 | 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 none of 31415, 119, or 13579 is. You are given a positive integer K. Find the K-th smallest lunlun number. | ['import queue\nK = int(intut())\nq = queue.Queue()\nfor i in range(9):\n q.put(i + 1)\nfor i in range(K):\n tmp = q.get()\n if tmp % 10 == 0:\n q.put(10 * tmp)\n q.put(10 * tmp + 1)\n elif tmp % 10 == 9:\n q.put(10 * tmp + 8)\n q.put(10 * tmp + 9)\n else:\n for t in range(-1,2):\n q.put(10 * tmp + tmp % 10 + t)\nprint(tmp)', 'import queue\nK = int(intut())\nq = queue.Queue()\nans = 0\nfor i in range(9):\n q.put(i + 1)\nfor i in range(K):\n ans = q.get()\n if tmp % 10 == 0:\n q.put(10 * tmp)\n q.put(10 * tmp + 1)\n elif tmp % 10 == 9:\n q.put(10 * tmp + 8)\n q.put(10 * tmp + 9)\n else:\n for t in range(-1,2):\n q.put(10 * tmp + tmp % 10 + t)\nprint(ans)\n', "import numpy as np\nK = int(input())\nlis = ['1','2','3','4','5','6','7','8','9']\nlis = np.array(lis)\nif K == 1:\n print(1)\nelif K < 10:\n print(K)\nelse:\n count = 9\n sub_count = 0\n while count < K:\n tmp = lis[sub_count]\n if tmp[-1] == '9':\n count += 2\n lis.append(tmp + '8')\n lis.append(tmp + '9')\n sub_count += 1\n elif tmp[-1] == '0':\n count += 2\n lis.append(tmp + '0')\n lis.append(tmp + '1')\n sub_count += 1\n else:\n count += 3\n for i in range(-1,2):\n lis.append(tmp + str(int(tmp[-1]) + i))\n sub_count += 1\n print(lis[count-1])\n", "import numpy as np\nK = int(input())\nlis = ['1','2','3','4','5','6','7','8','9']\nlis = np.array(lis)\nif K == 1:\n print(1)\nelif K < 10:\n print(K)\nelse:\n count = 9\n sub_count = 0\n while count < K:\n if lis[sub_count][-1] == '9':\n count += 2\n lis.append(lis[sub_count] + '8')\n lis.append(lis[sub_count] + '9')\n sub_count += 1\n elif lis[sub_count][-1] == '0':\n count += 2\n lis.append(lis[sub_count] + '0')\n lis.append(lis[sub_count] + '1')\n sub_count += 1\n else:\n count += 3\n for i in range(-1,2):\n lis.append(lis[sub_count] + str(int(lis[sub_count][-1]) + i))\n sub_count += 1\n print(lis[count-1])", 'import numpy as np\nK = int(input())\nlis = [1,2,3,4,5,6,7,8,9]\nlis = np.array(lis)\n \nif K < 10:\n print(K)\n \nelse:\n count = 9\n sub_count = 0\n while count < K:\n tmp = lis[sub_count]\n if tmp % 10 == 9:\n count += 2\n lis.append(tmp * 10 + 8)\n lis.append(tmp * 10 + 9)\n sub_count += 1\n elif tmp % 10== 0:\n count += 2\n lis.append(tmp * 10 )\n lis.append(tmp * 10 + 1)\n sub_count += 1\n else:\n count += 3\n for i in range(-1,2):\n lis.append(tmp * 10 + tmp % 10 + i)\n sub_count += 1\n print(lis[count-1])\n', 'import numpy as np\nK = int(input())\nlis = [1,2,3,4,5,6,7,8,9]\nlis = np.array(lis)\n \nif K < 10:\n print(K)\n \nelse:\n count = 9\n sub_count = 0\n while count < K:\n tmp = lis[sub_count]\n if tmp % 10 == 9:\n count += 2\n lis.append(tmp * 10 + 8)\n lis.append(tmp + 9)\n sub_count += 1\n elif tmp % 10== 0:\n count += 2\n lis.append(tmp * 10 + 0)\n lis.append(tmp * 10 + 1)\n sub_count += 1\n else:\n count += 3\n for i in range(-1,2):\n lis.append(tmp * 10 + tmp % 10 + i)\n sub_count += 1\n print(lis[count-1])\n', "import queue\nK = int(input())\nq = queue.Queue()\ncount = 0\nfor i in range(1,10):\n q.put(str(i))\nwhile count < K:\n tmp = q.get()\n count += 1\n if count == K:\n print(tmp)\n break\n if tmp[-1] == '0':\n for k in ['0', '1']:\n q.put(tmp + k)\n elif tmp[-1] == '9':\n for t in ['8', '9']:\n q.put(tmp + t)\n else:\n for c in [str(int(tmp[-1]) - 1),tmp[-1], str(int(tmp[-1]) + 1)]:\n q.put(tmp + c)\n\n \n"] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s019702755', 's062504311', 's114333484', 's571463812', 's698938961', 's854041267', 's936600406'] | [4080.0, 4080.0, 12972.0, 13788.0, 12512.0, 14424.0, 17520.0] | [33.0, 29.0, 160.0, 155.0, 151.0, 153.0, 1273.0] | [332, 341, 607, 669, 576, 574, 424] |
p02720 | u952669998 | 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 none of 31415, 119, or 13579 is. You are given a positive integer K. Find the K-th smallest lunlun number. | ['K = int(input())\nlun = [1, 2, 3, 4, 5, 6, 7, 8, 9]\ncnt = 0\n\nwhile(len(lun) < K):\n target = lun[cnt]\n num = target % 10\n print(lun,target,num)\n if num != 0:\n lun.append(target * 10 + num - 1)\n lun.append(target * 10 + num)\n if num != 9:\n lun.append(target * 10 + num + 1)\n cnt += 1\n\nprint(lun[K-1])\n', 'K = int(input())\nlun = [1, 2, 3, 4, 5, 6, 7, 8, 9]\ncnt = 0\n\nwhile(len(lun) < K):\n target = lun[cnt]\n num = target % 10\n if num != 0:\n lun.append(target * 10 + num - 1)\n lun.append(target * 10 + num)\n if num != 9:\n lun.append(target * 10 + num + 1)\n cnt += 1\n\nprint(lun[K-1])\n'] | ['Runtime Error', 'Accepted'] | ['s085114859', 's449428533'] | [134824.0, 7140.0] | [1698.0, 53.0] | [315, 291] |
p02720 | u961945062 | 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 none of 31415, 119, or 13579 is. You are given a positive integer K. Find the K-th smallest lunlun number. | ['from collections import deque\n\nK = int(input()) \na = deque()\n\nfor i in range(1,10):\n a.append(i)\n \nfor i in range(K):\n j = a.popleft()\n print(j)\n if j%10 != 0:\n a.append((10*j) + ((j%10) -1))\n \n a.append((10*j)+j%10)\n \n if j%10 != 9:\n a.append((10*j) +((j%10)+1))\n', 'from collections import deque\n\nK = int(input()) \na = deque([1, 2, 3, 4, 5, 6, 7, 8, 9])\n\n\nfor i in range(K-1):\n j = a.popleft()\n if j%10 != 0:\n a.append((10*j) + ((j%10) -1))\n \n a.append((10*j)+j%10)\n \n if j%10 != 9:\n a.append((10*j) +((j%10)+1))\n \na.popleft()', 'K = input()\nfrom collections import deque\n\na = deque()\n\nfor i in range(1,10):\n a.append(i)\n \nfor i in range(K):\n j = a.popleft()\n if j%10 != 0:\n a.append((10*j) + ((j%10) -1))\n \n a.append((10*j)+j%10)\n \n if j%10 != 9:\n a.append((10*j) +((j%10)+1))\n \na.popleft()', 'from collections import deque\n\nK = int(input()) \na = deque([1, 2, 3, 4, 5, 6, 7, 8, 9])\n\nfor i in range(K-1):\n j = a.popleft()\n if j%10 != 0:\n a.append((10*j) + ((j%10) -1))\n \n a.append((10*j)+j%10)\n \n if j%10 != 9:\n a.append((10*j) +((j%10)+1))\n \nprint(a.popleft())'] | ['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s019184181', 's376113316', 's516141258', 's253211281'] | [13576.0, 12384.0, 3316.0, 12384.0] | [208.0, 128.0, 21.0, 125.0] | [309, 299, 310, 305] |
p02720 | u969850098 | 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 none of 31415, 119, or 13579 is. You are given a positive integer K. Find the K-th smallest lunlun number. | ["from collections import deque\n\ndef main():\n \tK = int(input())\n que = deque(['1', '2', '3', '4', '5', '6', '7', '8', '9'])\n\n while K:\n if K == 1:\n ans = que.popleft()\n break\n K -= 1\n v = que.popleft()\n if v[-1] == '0':\n que.append(v + '0')\n que.append(v + '1')\n elif v[-1] == '9':\n que.append(v + '8')\n que.append(v + '9')\n else:\n que.append(v + str(int(v[-1]) - 1))\n que.append(v + str(int(v[-1])))\n que.append(v + str(int(v[-1]) + 1))\n\n print(ans)\n\nif __name__ == '__main__':\n main()", "from collections import deque\n\ndef main():\n K = int(input())\n que = deque([i for i in range(1, 10)])\n\n while K:\n if K == 1:\n ans = que.popleft()\n break\n K -= 1\n v = que.popleft()\n for i in range(-1, 2, 1):\n a = v % 10 + i\n if a < 0 or a > 9:\n continue\n que.append(v * 10 + a)\n \n print(ans)\n\nif __name__ == '__main__':\n main()"] | ['Runtime Error', 'Accepted'] | ['s752353666', 's522832367'] | [2940.0, 12404.0] | [17.0, 133.0] | [638, 449] |
p02720 | u973972117 | 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 none of 31415, 119, or 13579 is. You are given a positive integer K. Find the K-th smallest lunlun number. | ['K = int(input())\ndef L(x):\n X = int(x)\n if X < 10:\n return True\n elif X <100:\n if abs(int(x[-2]) -int(x[-1])) <= 1:\n return True\n else:\n return False\n elif X <(10 ** 3):\n if abs(int(x[-3]) - int(x[-2])) <= 1 and abs(int(x[-2]) -int(x[-1])) <= 1:\n return True\n else:\n return False\n elif X <(10 ** 4):\n if abs(int(x[-4]) - int(x[-3])) <= 1 and abs(int(x[-2]) -int(x[-3])) <= 1 and abs(int(x[-2]) -int(x[-1]))<= 1:\n return True\n else:\n return False\n elif X <=(10 ** 5):\n if abs(int(x[-5]) - int(x[-4])) <= 1 and abs(int(x[-4]) - int(x[-3])) == 1 and abs(int(x[-2]) -int(x[-3])) <= 1 and abs(int(x[-2]) -int(x[-1]))<= 1:\n return True\n else:\n return False\nI = 1\ni = 1\nwhile I != (K+1):\n print([i,I])\n if L(str(i)):\n I += 1\n i += 1\n else:\n i += 1\nprint(i-1)', "import heapq\nK = int(input())\ndef NewLun(strX):\n if strX[-1] != '0' and strX[-1] != '9':\n intX0 = int(strX[-1])\n heapq.heappush(Lun,int(strX + str(intX0+1)))\n heapq.heappush(Lun,int(strX + str(intX0)))\n heapq.heappush(Lun,int(strX + str(intX0-1)))\n elif strX[-1] == '0':\n heapq.heappush(Lun,int(strX + '0'))\n heapq.heappush(Lun,int(strX+'1'))\n else:\n heapq.heappush(Lun,int(strX +'9'))\n heapq.heappush(Lun,int(strX+'8'))\nLun = [i for i in range(1,10)]\nheapq.heapify(Lun)\nfor _ in range(K):\n Ans = heapq.heappop(Lun)\n NewLun(str(Ans))\nprint(Ans)"] | ['Wrong Answer', 'Accepted'] | ['s374989637', 's142052849'] | [16752.0, 16304.0] | [2104.0, 240.0] | [952, 615] |
p02720 | u979823197 | 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 none of 31415, 119, or 13579 is. You are given a positive integer K. Find the K-th smallest lunlun number. | ['k=int(input())\nL=[]\ndef f(d,now,L):\n L.append(now)\n \n if d==10:\n return\n \n for j in range(-1,2):\n v=now%10+j\n if 0<=v<=9:\n f(d+1,now*10+v,L)\n\nf(0,0,L)\nprint(L[k-1])\n ', 'from collections import deque\n\nk=int(input())\n\nlunlun=deque(i for i in range(1,10))\nfor _ in range(k-1):\n p=lunlun.popleft()\n if p%10!=0:\n lunlun.append(10*p+p%10-1)\n lunlun.append(10*p+p%10)\n if p%10!=9:\n lunlun.append(10*p+p%10+1)\nprint(lunlun.popleft())'] | ['Runtime Error', 'Accepted'] | ['s148581822', 's114803942'] | [10184.0, 18972.0] | [41.0, 104.0] | [190, 266] |
p02720 | u982152304 | 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 none of 31415, 119, or 13579 is. You are given a positive integer K. Find the K-th smallest lunlun number. | ['for i in range(K-1):\n x = q.get()\n print(x)\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) )\nprint(q.get())', 'for i in range(K-1):\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) )\nprint(q.get())', 'import queue\nK = int(input())\nq = queue.Queue()\nfor i in range(1,10):\n q.put(i)\n \n \nfor i in range(K-1):\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) )\nprint(q.get())'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s062447790', 's659007374', 's927955958'] | [2940.0, 2940.0, 13016.0] | [17.0, 17.0, 1033.0] | [171, 160, 251] |
p02720 | u985972698 | 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 none of 31415, 119, or 13579 is. You are given a positive integer K. Find the K-th smallest lunlun number. | ['# -*- coding: utf-8 -*-\n\ndef input_multiple_number():\n return map(int, input().split())\n\ndef input_multiple_number_as_list():\n return list(map(int, input().split()))\n\n\nK = int(input())\n\nbase = [1,2,3,4,5,6,7,8,9]\nans = [1,2,3,4,5,6,7,8,9]\n\nfor i in range(100000):\n\tfor j in range(3):\n\t\tif ans[i]%10 == 0 and j ==0:\n\t\t\tcontinue\n\t\telif ans[i]%10 == 9 and j ==2:\n\t\t\tcontinue\n\t\tans.append(ans[i]*10+j-1+ans[i]%10)\n\nprint(ans[K+1])\n', '\n# -*- coding: utf-8 -*-\n\ndef input_multiple_number():\n return map(int, input().split())\n\ndef input_multiple_number_as_list():\n return list(map(int, input().split()))\n\n\nK = int(input())\n\nbase = [1,2,3,4,5,6,7,8,9]\nans = [1,2,3,4,5,6,7,8,9]\n\nfor i in range(100000):\n\tfor j in range(3):\n\t\tif ans[i]%10 == 0 and j ==0:\n\t\t\tcontinue\n\t\telif ans[i]%10 == 9 and j ==2:\n\t\t\tcontinue\n\t\tans.append(ans[i]*10+j-1+ans[i]%10)\n\nprint(ans[K-1])\n'] | ['Wrong Answer', 'Accepted'] | ['s715506833', 's818937592'] | [16280.0, 16408.0] | [256.0, 257.0] | [433, 434] |
p02720 | u986889396 | 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 none of 31415, 119, or 13579 is. You are given a positive integer K. Find the K-th smallest lunlun number. | ['from collections import deque\n\nk = int(input())\nlunlun = []\nq = deque([1,2,3,4,5,6,7,8,9])\nfor i in range(k-1):\n first = q.popleft()\n if first%10-1 >= 0:\n q.append(first*10 + (first%10-1))\n q.append(first*10 + first%10)\n if first%10+1 <= 9:\n q.append(10*first + (first%10+1))\n print(q)\nprint(q[0])', 'from collections import deque\n\nk = int(input())\nlunlun = []\nq = deque([1,2,3,4,5,6,7,8,9])\nwhile len(lunlun) <= k:\n first = q.popleft()\n lunlun.append(first)\n if first%10-1 >= 0:\n q.append(first*10 + (first%10-1))\n q.append(first*10 + first%10)\n if first%10+1 <= 9:\n q.append(10*first + (first%10+1))\nprint(lunlun[k-1])'] | ['Runtime Error', 'Accepted'] | ['s225881994', 's415641704'] | [134976.0, 16596.0] | [1538.0, 144.0] | [326, 348] |
p02720 | u989345508 | 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 none of 31415, 119, or 13579 is. You are given a positive integer K. Find the K-th smallest lunlun number. | ['k=int(input())\nans=[[i for i in range(1,10)]]\nd=9\nwhile d<k:\n ans.append([])\n for i in ans[-2]:\n x=str(i)\n z=int(x[-1])\n ans[-1].append(x+str(z))\n if z<=8:\n ans[-1].append(x+str(z+1))\n if z>=1:\n ans[-1].append(x+str(z-1))\n d+=len(ans[-1])\nprint(ans[-1][k-d-1])', 'k=int(input())\nans=[[i for i in range(1,10)]]\nd=9\nwhile d<k:\n ans.append([])\n for i in ans[-2]:\n x=str(i)\n if z==0:\n ans[-1].append(x+str(z))\n ans[-1].append(x+str(z+1))\n elif 1<=z<=8:\n ans[-1].append(x+str(z-1))\n ans[-1].append(x+str(z))\n ans[-1].append(x+str(z+1))\n else:\n ans[-1].append(x+str(z-1))\n ans[-1].append(x+str(z))\n d+=len(ans[-1])\nl=len(ans[-1])\nv=sorted([int(i) for i in ans[-1]])\n\nprint(v[k-(d-l)-1])', 'k=int(input())\n\nq=["1","2","3","4","5","6","7","8","9"]\nx=9\nfor i in q:\n if x>100000:\n break\n x+=1\n a=i[-1]\n for j in ([-1,0,1]):\n bb=int(a)+j\n if bb<10 and bb>=0:\n q.append(i+str(bb))\n\n\nprint(q[k-1])'] | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s126674501', 's594042610', 's054837106'] | [17268.0, 3064.0, 23796.0] | [141.0, 18.0, 317.0] | [326, 530, 244] |
p02720 | u992951814 | 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 none of 31415, 119, or 13579 is. You are given a positive integer K. Find the K-th smallest lunlun number. | ['k = int(input())\nque = []\nfor i in range(1,10):\n que.append(i)\nct = 0\nwhile(len(que) < k):\n ct += 1\n value = que[0]\n que.remove(value)\n for i in [-1,0,1]:\n if 0 <= (value%10) + i and (value%10) + i <= 9:\n tmp = 10*value + (value%10) + i\n q.append(tmp) \nprint(que[k-1-ct])', 'k = int(input())\nque = []\nfor i in range(10):\n que.append(i)\nwhile(len(que) < k-1):\n x = que[0]\n que.remove(x)\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)\nprint(que[k-1])', 'k = int(input())\nque = []\nfor i in range(1,10):\n que.append(i)\nct = 0\nwhile(len(que) < k):\n ct += 1\n value = que[0]\n que.remove(value)\n for i in [-1,0,1]:\n if 0 <= (value%10) + i and (value%10) + i <= 9:\n tmp = 10*value + (value%10) + i\n que.append(tmp) \nprint(que[k-1-ct])'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s452110159', 's603572350', 's385276753'] | [3064.0, 7488.0, 7512.0] | [18.0, 852.0, 904.0] | [290, 269, 292] |
p02720 | u997641430 | 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 none of 31415, 119, or 13579 is. You are given a positive integer K. Find the K-th smallest lunlun number. | ["def generate(n):\n if n == 1:\n for i in range(1, 10):\n yield [i]\n else:\n for A in generate(n - 1):\n for i in range(10):\n if abs(A[-1] - i) <= 1:\n yield A + [i]\n\n\nL = []\nfor n in range(1, 11):\n for A in generate(n):\n L.append(int(''.join([str(a) for a in A])))\nprint(len(L))\nk = int(input())\nprint(L[k - 1])\n", "def generate(n):\n if n == 1:\n for i in range(1, 10):\n yield [i]\n else:\n for A in generate(n - 1):\n for i in range(10):\n if abs(A[-1] - i) <= 1:\n yield A + [i]\n\n\nL = []\nfor n in range(1, 11):\n for A in generate(n):\n L.append(int(''.join([str(a) for a in A])))\nk = int(input())\nprint(L[k - 1])\n"] | ['Wrong Answer', 'Accepted'] | ['s674652799', 's143244705'] | [16976.0, 17060.0] | [542.0, 538.0] | [392, 378] |
p02721 | u017050982 | 2,000 | 1,048,576 | Takahashi has decided to work on K days of his choice from the N days starting with tomorrow. You are given an integer C and a string S. Takahashi will choose his workdays as follows: * After working for a day, he will refrain from working on the subsequent C days. * If the i-th character of S is `x`, he will not work on Day i, where Day 1 is tomorrow, Day 2 is the day after tomorrow, and so on. Find all days on which Takahashi is bound to work. | ['kinmu = 0\nniti = 0\np = 0\nfor i in range(N):\n if S[i] == "o" and tyousa[i] == p:\n kinmu = 0\n niti = 0\n route.clear()\n while kinmu < K and niti < N:\n if S[niti] == "o" and niti != i:\n route.append(niti)\n kinmu += 1\n niti += C\n niti += 1\n if niti >= N and kinmu < K:\n print(i + 1)\n if kinmu >= K:\n for i2 in route:\n tyousa[i2] += 1\n p += 1', 'N,K,C =map(int,input().rstrip().split(" "))\nS = input()\nkinmu = 0\nniti = 0\nf = []\nb = []\nkinmu = 0\nniti = 0\nwhile kinmu < K and niti < N:\n if S[niti] == "o":\n f.append(niti)\n kinmu += 1\n niti += C\n niti += 1\nkinmu = 0\nniti = N -1\nwhile kinmu < K and niti >= 0:\n if S[niti] == "o":\n b.append(niti)\n kinmu += 1\n niti -= C\n niti -= 1\nb.reverse()\nfor i in range(K):\n if f[i] == b[i]:\n print(f[i] + 1)'] | ['Runtime Error', 'Accepted'] | ['s508406946', 's608699336'] | [3064.0, 20664.0] | [17.0, 408.0] | [408, 422] |
p02721 | u078932560 | 2,000 | 1,048,576 | Takahashi has decided to work on K days of his choice from the N days starting with tomorrow. You are given an integer C and a string S. Takahashi will choose his workdays as follows: * After working for a day, he will refrain from working on the subsequent C days. * If the i-th character of S is `x`, he will not work on Day i, where Day 1 is tomorrow, Day 2 is the day after tomorrow, and so on. Find all days on which Takahashi is bound to work. | ["k = int(input())\nlunluns = list(map(str, range(1,10)))\nnew = list(map(str, range(1,10)))\nnew_fueta = 9\nend = False\nwhile len(lunluns) < k:\n new_new_fueta = 0\n for x in lunluns[-new_fueta:]:\n str_x = str(x)\n if str_x[-1] == '0':\n lunluns += [int(str_x+'0'),int(str_x+'1')]\n new_new_fueta += 2\n elif str_x[-1] == '9':\n lunluns += [int(str_x+'8'),int(str_x+'9')]\n new_new_fueta += 2\n else:\n l = int(str_x[-1])\n lunluns += [int(str_x+str(l-1)), int(str_x+str(l)), int(str_x+str(l+1))]\n new_new_fueta += 3\n if end:\n break\n new_fueta = new_new_fueta\nprint(lunluns[k-1])", "n, k, c = map(int, input().split())\ns = input()\n\ndef solve_dp(s):\n dp = [0]*(n+2)\n for i in range(n):\n if i <= c and s[i] == 'o':\n dp[i+1] = 1\n else:\n if s[i] == 'o':\n dp[i+1] = max(dp[i], dp[i-c]+1)\n else:\n dp[i+1] = dp[i]\n return dp\n\nmae = solve_dp(s)\nushiro = solve_dp(s[::-1])[::-1]\n\nfor i in range(1,n+1):\n if mae[i-1] + ushiro[i+1] < k:\n print(i)"] | ['Runtime Error', 'Accepted'] | ['s814655156', 's030680280'] | [3064.0, 20772.0] | [17.0, 445.0] | [617, 394] |
p02721 | u089032001 | 2,000 | 1,048,576 | Takahashi has decided to work on K days of his choice from the N days starting with tomorrow. You are given an integer C and a string S. Takahashi will choose his workdays as follows: * After working for a day, he will refrain from working on the subsequent C days. * If the i-th character of S is `x`, he will not work on Day i, where Day 1 is tomorrow, Day 2 is the day after tomorrow, and so on. Find all days on which Takahashi is bound to work. | ["import sys\ninput = sys.stdin.readline\n\n\ndef inpl():\n return list(map(int, input().split()))\n\n\ndef GetBase(s=0):\n ret = []\n last = -C * 2 - 1\n for i, s in enumerate(S[s:]):\n if s == 'x':\n continue\n elif last + C >= i + s:\n continue\n\n ret.append(i + s)\n last = i + s\n return ret\n\n\ndef GetDepend(base_ans):\n ruiseki = []\n a = 0\n for s in S:\n if s == 'o':\n a += 1\n ruiseki.append(a)\n else:\n ruiseki.append(a)\n\n ret = {a: False for a in base_ans}\n for a in ret:\n if ruiseki[a] == ruiseki[min(N - 1, a + C)]:\n ret[a] = True\n return ret\n\n\ndef solve():\n base_ans = GetBase()\n if len(base_ans) > K:\n return []\n\n depend_dict = GetDepend(base_ans)\n for i, b in enumerate(base_ans):\n if depend_dict[b] is True:\n continue\n S[b] = 'x'\n tmp = GetBase(s=i)\n if len(tmp) + i < K:\n depend_dict[b] = True\n else:\n for s in set(base_ans) & set(tmp):\n depend_dict[s] = True\n\n S[b] = 'o'\n\n return [a + 1 for a in base_ans if depend_dict[a] is True]\n\n\nN, K, C = inpl()\nS = list(input().strip())\n\nans = solve()\n\nfor a in ans:\n print(a)\n", "import sys\ninput = sys.stdin.readline\n\n\ndef inpl():\n return list(map(int, input().split()))\n\n\ndef GetBase(t=0):\n ret = []\n last = -C * 2 - 1\n for i, s in enumerate(S[t:]):\n if s == 'x':\n continue\n elif last + C >= i + t:\n continue\n\n ret.append(i + t)\n last = i + t\n return ret\n\n\ndef GetReverse():\n ret = []\n last = -C * 2 - 1\n for i, s in enumerate(S[::-1]):\n if s == 'x':\n continue\n elif last + C >= i:\n continue\n\n ret.append(len(S) - 1 - i)\n last = i\n return reversed(ret)\n\n\ndef GetDepend(base_ans):\n ruiseki = []\n a = 0\n for s in S:\n if s == 'o':\n a += 1\n ruiseki.append(a)\n else:\n ruiseki.append(a)\n\n ret = {a: False for a in base_ans}\n for a in ret:\n if ruiseki[a] == ruiseki[min(N - 1, a + C)]:\n ret[a] = True\n return ret\n\n\ndef solve():\n base_ans = GetBase()\n if len(base_ans) > K:\n return []\n\n reverse_ans = GetReverse()\n\n return sorted(list(set(base_ans) & set(reverse_ans)))\n\n\nN, K, C = inpl()\nS = list(input().strip())\n\nans = solve()\n\nfor a in ans:\n print(a + 1)\n"] | ['Runtime Error', 'Accepted'] | ['s014292037', 's831619587'] | [6308.0, 50208.0] | [24.0, 321.0] | [1274, 1205] |
p02721 | u095021077 | 2,000 | 1,048,576 | Takahashi has decided to work on K days of his choice from the N days starting with tomorrow. You are given an integer C and a string S. Takahashi will choose his workdays as follows: * After working for a day, he will refrain from working on the subsequent C days. * If the i-th character of S is `x`, he will not work on Day i, where Day 1 is tomorrow, Day 2 is the day after tomorrow, and so on. Find all days on which Takahashi is bound to work. | ["\nN, K, C=map(int, input().split())\nS='x'+input() \n\n\nA=[] \ni=1 \nwhile len(A)<K:\n if S[i]=='o':\n \n A.append(i+1)\n i+=(C+1)\n else:\n \n i+=1\n \n\nB=[]\ni=N \nwhile len(B)<K:\n if S[i]=='o':\n \n B.append(i)\n i-=(C+1)\n else:\n \n i-=1\n \nB=B[::-1] \nfor i in range(K):\n \n if A[i]==B[i]:\n print(A[i])\n\n", "\nN, K, C=map(int, input().split())\nS='x'+input() \n\n\nA=[] \ni=1 \nwhile len(A)<K:\n if S[i]=='o':\n \n A.append(i)\n i+=(C+1)\n else:\n \n i+=1\n \n\nB=[]\ni=N \nwhile len(B)<K:\n if S[i]=='o':\n \n B.append(i)\n i-=(C+1)\n else:\n \n i-=1\n \nB=B[::-1] \nfor i in range(K):\n \n if A[i]==B[i]:\n print(A[i])\n\n"] | ['Wrong Answer', 'Accepted'] | ['s560269574', 's450231323'] | [20932.0, 20836.0] | [194.0, 345.0] | [1124, 1122] |
p02721 | u100277898 | 2,000 | 1,048,576 | Takahashi has decided to work on K days of his choice from the N days starting with tomorrow. You are given an integer C and a string S. Takahashi will choose his workdays as follows: * After working for a day, he will refrain from working on the subsequent C days. * If the i-th character of S is `x`, he will not work on Day i, where Day 1 is tomorrow, Day 2 is the day after tomorrow, and so on. Find all days on which Takahashi is bound to work. | ['N, K, C = map(int,input().split())\nS = list(input())\n\nA = list()\nB = list()\n\ni = 0\nnum = 0\nwhile num < K:\n if S[i] == "o":\n A.append(i)\n num += 1\n i += C\n i += 1\ni = len(S)-1\nnum = 0\nwhile num < K:\n if S[i] == "o":\n B.append(i)\n num+=1\n i -= C\n i -= 1\nB.sort()\n\nprint(A)\nprint(B)\n\nfor i,j in zip(A,B):\n if i == j:\n print(i+1)', 'N, K, C = map(int,input().split())\nS = list(input())\n\nA = list()\nB = list()\n\ni = 0\nnum = 0\nwhile num < K:\n if S[i] == "o":\n A.append(i)\n num += 1\n i += C\n i += 1\ni = len(S)-1\nnum = 0\nwhile num < K:\n if S[i] == "o":\n B.append(i)\n num+=1\n i -= C\n i -= 1\nB.sort()\n\nfor i,j in zip(A,B):\n if i == j:\n print(i+1)'] | ['Wrong Answer', 'Accepted'] | ['s053242153', 's311374483'] | [27580.0, 21996.0] | [388.0, 391.0] | [351, 332] |
p02721 | u103902792 | 2,000 | 1,048,576 | Takahashi has decided to work on K days of his choice from the N days starting with tomorrow. You are given an integer C and a string S. Takahashi will choose his workdays as follows: * After working for a day, he will refrain from working on the subsequent C days. * If the i-th character of S is `x`, he will not work on Day i, where Day 1 is tomorrow, Day 2 is the day after tomorrow, and so on. Find all days on which Takahashi is bound to work. | ["n,k,c= map(int,input().split())\ns = input()\ni = 0\n\ndef func(s,k,c):\n i = 0\n res = []\n while 1:\n if s[i] == 'o':\n res.append(i)\n if len(ans1)== k:\n break\n i += c\n return res\nans1 = set(func(s,k,c))\nans2 = set(func(s[::-1],k,c))\n\nans = list(ans1.intersection(ans2))\nfor a in ans:\n print(a)", "n,k,c= map(int,input().split())\ns = input()\ni = 0\n\ndef func(s,k,c):\n i = 0\n res = []\n while 1:\n if s[i] == 'o':\n res.append(i)\n if len(res)== k:\n break\n i += c\n i+= 1\n return res\nans1 = set(func(s,k,c))\nans2 = set(func(s[::-1],k,c))\n\nans = list(ans1.intersection(ans2))\nfor a in ans:\n print(a+1)\n\n", "n,k,c= map(int,input().split())\ns = input()\ni = 0\n\ndef func(s,k,c):\n i = 0\n res = []\n while 1:\n if s[i] == 'o':\n res.append(i)\n if len(res)== k:\n break\n i += c\n i+= 1\n return res\nans1 = func(s,k,c)\nans2 = func(s[::-1],k,c)\nans2 = [n-a-1 for a in ans2]\nans2 = ans2[::-1]\n\nfor i in range(k):\n if ans1[i]==ans2[i]:\n print(ans1[i]+1)\n\n\n"] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s327178939', 's874193117', 's509822698'] | [3500.0, 47200.0, 27496.0] | [2103.0, 296.0, 320.0] | [317, 330, 368] |
p02721 | u127499732 | 2,000 | 1,048,576 | Takahashi has decided to work on K days of his choice from the N days starting with tomorrow. You are given an integer C and a string S. Takahashi will choose his workdays as follows: * After working for a day, he will refrain from working on the subsequent C days. * If the i-th character of S is `x`, he will not work on Day i, where Day 1 is tomorrow, Day 2 is the day after tomorrow, and so on. Find all days on which Takahashi is bound to work. | ["def main():\n from itertools import groupby\n n, k, c = map(int, input().split())\n s = list(input())\n\n if c == 0:\n if s.count('o') == k:\n ans = '\\n'.join(map(str,range(1,n+1)))\n print(ans)\n return\n else:\n return\n\n check_f = []\n x = 0\n for i, j in enumerate(s, 1):\n if x:\n x -= 1\n continue\n if j == 'o':\n x = c\n check_f.append(i)\n if len(check_f) == k:\n break\n\n check_b = []\n x = 0\n for i, j in enumerate(s[::-1]):\n if x:\n x -= 1\n continue\n if j == 'o':\n x = c\n check_b.append(n - i)\n if len(check_b) == k:\n break\n\n ans = list(set(check_f) & set(check_b))\n ans.sort()\n ans = '\\n'.join(map(str,ans))\n print(ans)\n\nif __name__ == '__main__':\n main()\n", "def main():\n from itertools import groupby\n n, k, c = map(int, input().split())\n s = list(input())\n\n if c == 0:\n a = [i + 1 for i, c in enumerate(s) if c == 'o']\n if len(a) == k:\n print(*a, sep='\\n')\n else:\n print()\n exit()\n\n check_f = []\n x = 0\n for i, j in enumerate(s, 1):\n if x:\n x -= 1\n continue\n if j == 'o':\n x = c\n check_f.append(i)\n if len(check_f) == k:\n break\n\n check_b = []\n x = 0\n for i, j in enumerate(s[::-1]):\n if x:\n x -= 1\n continue\n if j == 'o':\n x = c\n check_b.append(n - i)\n if len(check_b) == k:\n break\n\n ans = list(set(check_f) & set(check_b))\n ans.sort()\n ans = '\\n'.join(map(str, ans))\n print(ans)\n\n\nif __name__ == '__main__':\n main()\n"] | ['Runtime Error', 'Accepted'] | ['s168998849', 's556076877'] | [2940.0, 17316.0] | [17.0, 116.0] | [902, 907] |
p02721 | u163320134 | 2,000 | 1,048,576 | Takahashi has decided to work on K days of his choice from the N days starting with tomorrow. You are given an integer C and a string S. Takahashi will choose his workdays as follows: * After working for a day, he will refrain from working on the subsequent C days. * If the i-th character of S is `x`, he will not work on Day i, where Day 1 is tomorrow, Day 2 is the day after tomorrow, and so on. Find all days on which Takahashi is bound to work. | ["n,k,c=map(int,input().split())\ns=input()\nl=len(s)\ncand=[]\nfor i in range(l):\n if s[i]=='o':\n cand.append(i+1)\ncnt1=[0]*(n+2)\ncnt2=[0]*(n+2)\nprev=0\ncnt=0\nfor i in range(l):\n if s[i]=='o' and i>=prev:\n cnt+=1\n cnt1[i+1]=cnt\n prev=i+(c+1)\n else:\n cnt1[i+1]=cnt\nprev=l\ncnt=0\nfor i in range(l-1,-1,-1):\n if s[i]=='o' and i<=prev:\n cnt+=1\n cnt2[i+1]=cnt\n prev=i-(c+1)\n else:\n cnt2[i+1]=cnt\nans=[]\nfor i in range(len(cand)):\n tmp=cand[i]\n if cnt1[tmp-1]+cnt2[tmp+1]<k:\n ans.append(tmp)\nprint(ans)", "n,k,c=map(int,input().split())\ns=input()\nl=len(s)\ncand=[]\nfor i in range(l):\n if s[i]=='o':\n cand.append(i+1)\ncnt1=[0]*(n+2)\ncnt2=[0]*(n+2)\nprev=0\ncnt=0\nfor i in range(l):\n if s[i]=='o' and i>prev+c:\n cnt+=1\n cnt1[i+1]=cnt\n prev=i\n else:\n cnt1[i+1]=cnt\nprev=l\ncnt=0\nfor i in range(l-1,-1,-1):\n if s[i]=='o' and i<prev-c:\n cnt+=1\n cnt2[i+1]=cnt\n prev=i\n else:\n cnt2[i+1]=cnt\nans=[]\nfor i in range(len(cand)):\n tmp=cand[i]\n if cnt1[tmp-1]+cnt2[tmp+1]<k:\n ans.append(tmp)\nfor val in ans:\n print(val)", "n,k,c=map(int,input().split())\ns=input()\nl=len(s)\ncand=[]\nfor i in range(l):\n if s[i]=='o':\n cand.append(i+1)\ncnt1=[0]*(n+2)\ncnt2=[0]*(n+2)\nprev=0\ncnt=0\nfor i in range(l):\n if s[i]=='o' and i>=prev:\n cnt+=1\n cnt1[i+1]=cnt\n prev=i+(c+1)\n else:\n cnt1[i+1]=cnt\nprev=l\ncnt=0\nfor i in range(l-1,-1,-1):\n if s[i]=='o' and i<=prev:\n cnt+=1\n cnt2[i+1]=cnt\n prev=i-(c+1)\n else:\n cnt2[i+1]=cnt\nans=[]\nfor i in range(len(cand)):\n tmp=cand[i]\n if cnt1[tmp-1]+cnt2[tmp+1]<k:\n ans.append(tmp)\nfor val in ans:\n print(val)"] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s185255853', 's989332383', 's273534860'] | [33176.0, 30164.0, 30112.0] | [338.0, 439.0, 443.0] | [526, 534, 544] |
p02721 | u167681750 | 2,000 | 1,048,576 | Takahashi has decided to work on K days of his choice from the N days starting with tomorrow. You are given an integer C and a string S. Takahashi will choose his workdays as follows: * After working for a day, he will refrain from working on the subsequent C days. * If the i-th character of S is `x`, he will not work on Day i, where Day 1 is tomorrow, Day 2 is the day after tomorrow, and so on. Find all days on which Takahashi is bound to work. | ['n, k, c = map(int, input().split())\ns = input()\n\nl, r = [], []\ncur = 0\ncount = 0\n\nwhile cur <= n:\n if s[cur] == "o":\n count += 1\n l.append((count, cur+1))\n cur += c\n\n cur += 1\n\ncur = n\ncount = k\n\nwhile cur >= 0:\n if s[cur] == "o":\n r.append((count, cur+1))\n count -= 1\n cur -= c\n\n cur -= 1\n\nans = (i[1] for i in set(l) & set(r))\nfor i in sorted(ans):\n print(i)', 'from sys import stdin\ndef main():\n input = stdin.readline\n n, k, c = map(int, input().split())\n s = input()\n\n ans = ""\n for i in range(n):\n if s[i] == "x":\n continue\n\n cur = 0\n count = 0\n ss = s[cur]\n\n while cur < n:\n if ss == "o" and cur != i:\n count += 1\n cur += c\n\n cur += 1\n\n if count >= k:\n break\n\n if count < k:\n ans+=str(i+1)+"\\n"\n\n print(ans)\n\nif __name__ == \'__main__\':\n main()', 'n, k, c = map(int, input().split())\ns = input() + "?"\n\nl, r = [], []\ncur = 0\ncount = 0\n\nwhile cur <= n:\n if s[cur] == "o":\n count += 1\n l.append((count, cur+1))\n cur += c\n\n cur += 1\n\ncur = n\ncount = k\n\nwhile cur >= 0:\n if s[cur] == "o":\n r.append((count, cur+1))\n count -= 1\n cur -= c\n\n cur -= 1\n\nans = (i[1] for i in set(l) & set(r))\nfor i in sorted(ans):\n print(i)'] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s399100779', 's664877656', 's541015934'] | [30468.0, 3444.0, 88500.0] | [137.0, 2104.0, 654.0] | [417, 549, 423] |
p02721 | u173148629 | 2,000 | 1,048,576 | Takahashi has decided to work on K days of his choice from the N days starting with tomorrow. You are given an integer C and a string S. Takahashi will choose his workdays as follows: * After working for a day, he will refrain from working on the subsequent C days. * If the i-th character of S is `x`, he will not work on Day i, where Day 1 is tomorrow, Day 2 is the day after tomorrow, and so on. Find all days on which Takahashi is bound to work. | ['N,K,C=map(int,input().split())\nS=input()\n\nl=[]\nla=[]\ni=0\nc=0\nwhile True:\n if S[i]=="o":\n l.append(i)\n i+=C\n c+=1\n i+=1\n\nif c>K:\n exit()\n\ni=N-1\nc=0\n\nwhile True:\n if S[i]=="o":\n la.append(i)\n i-=C\n c+=1\n i-=1\n if c==K:\n break\n \nfor i in l:\n if i in la:\n print(i+1)', 'N,K,C=map(int,input().split())\nS=input()\n\nl=[0]*N\nla=[0]*N\ni=0\nc=0\nwhile True:\n if S[i]=="o":\n l[i]=1\n i+=C\n c+=1\n i+=1\n if i>=N:\n break\n\nif c>K:\n exit()\n\ni=N-1\nc=0\n\nwhile True:\n if S[i]=="o":\n la[i]=1\n i-=C\n c+=1\n i-=1\n if c==K:\n break\n \nfor i in range(N):\n if l[i]==1 and la[i]==1:\n print(i+1)'] | ['Runtime Error', 'Accepted'] | ['s647938818', 's107146565'] | [11368.0, 7872.0] | [95.0, 364.0] | [342, 385] |
p02721 | u212263866 | 2,000 | 1,048,576 | Takahashi has decided to work on K days of his choice from the N days starting with tomorrow. You are given an integer C and a string S. Takahashi will choose his workdays as follows: * After working for a day, he will refrain from working on the subsequent C days. * If the i-th character of S is `x`, he will not work on Day i, where Day 1 is tomorrow, Day 2 is the day after tomorrow, and so on. Find all days on which Takahashi is bound to work. | ['k,y,c = map( int, input().split(" "))\nss = input()\n\nasc = []\ndsc = []\n\ncnt = 0\nerr_flg = 0\nwhile( True ):\n if(len(ss) <= cnt):\n err_flg = 1\n break\n if( ss[cnt] == "o"):\n asc.append( cnt )\n cnt += c+1\n else:\n cnt += 1\n \n if( len(asc)==y ):\n break\n\ncnt = 0\nss = ss[::-1]\nwhile( True ):\n if(len(ss) <= cnt):\n err_flg = 1\n break\n if( ss[cnt] == "o"):\n dsc.append( cnt )\n cnt += c+1\n else:\n cnt += 1\n \n if( len(dsc)==y ):\n break\n \nfor i in range(len(dsc)):\n dsc[i] = len(ss) - dsc[i] - 1\n \ndsc.reverse()\nprint(asc)\nprint(dsc)\n\nif( err_flg == 0 ):\n for i in range(len(asc)):\n if( asc[i] == dsc[i] ):\n print(asc[i])\n \n ', 'k,y,c = map( int, input().split(" "))\nss = input()\n\nasc = []\ndsc = []\n\ncnt = 0\nerr_flg = 0\nwhile( True ):\n if(len(ss) <= cnt):\n err_flg = 1\n break\n if( ss[cnt] == "o"):\n asc.append( cnt )\n cnt += c+1\n else:\n cnt += 1\n \n if( len(asc)==y ):\n break\n\ncnt = 0\nss = ss[::-1]\nwhile( True ):\n if(len(ss) <= cnt):\n err_flg = 1\n break\n if( ss[cnt] == "o"):\n dsc.append( cnt )\n cnt += c+1\n else:\n cnt += 1\n \n if( len(dsc)==y ):\n break\n \nfor i in range(len(dsc)):\n dsc[i] = len(ss) - dsc[i] - 1\n \ndsc.reverse()\n#print(asc)\n#print(dsc)\n\nif( err_flg == 0 ):\n for i in range(len(asc)):\n if( asc[i] == dsc[i] ):\n print(asc[i])\n \n ', 'k,y,c = map( int, input().split(" "))\nss = input()\n\nasc = []\ndsc = []\n\ncnt = 0\nerr_flg = 0\nwhile( True ):\n if(len(ss) <= cnt):\n err_flg = 1\n break\n if( ss[cnt] == "o"):\n asc.append( cnt )\n cnt += c+1\n else:\n cnt += 1\n \n if( len(asc)==y ):\n break\n\ncnt = 0\nss = ss[::-1]\nwhile( True ):\n if(len(ss) <= cnt):\n err_flg = 1\n break\n if( ss[cnt] == "o"):\n dsc.append( cnt )\n cnt += c+1\n else:\n cnt += 1\n \n if( len(dsc)==y ):\n break\n \nfor i in range(len(dsc)):\n dsc[i] = len(ss) - dsc[i] - 1\n \ndsc.reverse()\n#print(asc)\n#print(dsc)\n\nif( err_flg == 0 ):\n for i in range(len(asc)):\n if( asc[i] == dsc[i] ):\n print(asc[i]+1)\n \n '] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s366420031', 's601324267', 's224318906'] | [26228.0, 20584.0, 20588.0] | [460.0, 446.0, 439.0] | [680, 682, 684] |
p02721 | u296150111 | 2,000 | 1,048,576 | Takahashi has decided to work on K days of his choice from the N days starting with tomorrow. You are given an integer C and a string S. Takahashi will choose his workdays as follows: * After working for a day, he will refrain from working on the subsequent C days. * If the i-th character of S is `x`, he will not work on Day i, where Day 1 is tomorrow, Day 2 is the day after tomorrow, and so on. Find all days on which Takahashi is bound to work. | ['exit()', 'n,k,c=map(int,input().split())\ns=input()\nl=list();r=list()\nnex=0\nfor i in range(n):\n\tif i<nex:\n\t\tcontinue\n\tif s[i]=="o":\n\t\tnex=i+c+1\n\t\tl.append(i)\n\t\tif len(l)==k:\n\t\t\tbreak\nnex=-1\nfor i in range(n):\n\tif i<nex:\n\t\tcontinue\n\tif s[-i-1]=="o":\n\t\tnex=i+c+1\n\t\tr.append(n-i-1)\n\t\tif len(r)==k:\n\t\t\tbreak\nr=r[::-1]\nfor i in range(k):\n\tif l[i]==r[i]:\n\t\tprint(l[i]+1)'] | ['Wrong Answer', 'Accepted'] | ['s294454904', 's956784187'] | [9096.0, 26392.0] | [22.0, 277.0] | [6, 353] |
p02721 | u391540332 | 2,000 | 1,048,576 | Takahashi has decided to work on K days of his choice from the N days starting with tomorrow. You are given an integer C and a string S. Takahashi will choose his workdays as follows: * After working for a day, he will refrain from working on the subsequent C days. * If the i-th character of S is `x`, he will not work on Day i, where Day 1 is tomorrow, Day 2 is the day after tomorrow, and so on. Find all days on which Takahashi is bound to work. | ['#!/usr/bin/env python3\n# coding: utf-8\nimport time\n\ndef main():\n N, K, C = map(int, input().split())\n S = dict(enumerate(str(input()), 1))\n\n # time.sleep(0.05 * len(str(C)))\n \n if N == 100000 and K == 66666 and C == 0:\n XXXX\nif __name__ == "__main__":\n main()', '#!/usr/bin/env python3\n# coding: utf-8\nimport time\n\ndef main():\n N, K, C = map(int, input().split())\n S = dict(enumerate(str(input()), 1))\n\n time.sleep(0.05 * len(str(K)))\n \nif __name__ == "__main__":\n main()', '#!/usr/bin/env python3\n# coding: utf-8\nimport time\n\ndef main():\n N, K, C = map(int, input().split())\n S = dict(enumerate(str(input()), 1))\n\n # time.sleep(0.05 * len(str(C)))\n time.sleep(0.05 * int(str(C)[0]))\nif __name__ == "__main__":\n main()', '#!/usr/bin/env python3\n# coding: utf-8\nimport time\n\ndef main():\n N, K, C = map(int, input().split())\n S = dict(enumerate(str(input()), 1))\n\n # time.sleep(0.05 * len(str(N)))\n time.sleep(0.05 * int(str(K)[0]))\nif __name__ == "__main__":\n main()', '#!/usr/bin/env python3\n# coding: utf-8\nimport time\npass', '#!/usr/bin/env python3\n# coding: utf-8\nimport time\n\ndef main():\n N, K, C = map(int, input().split())\n S = dict(enumerate(str(input()), 1))\n\n # time.sleep(0.05 * len(str(C)))\n \n if K == 66666:\n XXXX\n # if S[1] == \'o\':\n # XXXX\n # else:\n # print(-1)\nif __name__ == "__main__":\n main()', '#!/usr/bin/env python3\n# coding: utf-8\nimport time\n\ndef main():\n N, K, C = map(int, input().split())\n S = dict(enumerate(str(input()), 1))\n\n # time.sleep(0.05 * len(str(C)))\n \n # if N == 100000 and K == 55555 and C == 0:\n # XXXX\n if S[1] == \'o\':\n XXXX\n else:\n print(-1)\nif __name__ == "__main__":\n main()', '#!/usr/bin/env python3\n# coding: utf-8\nimport time\n\ndef main():\n N, K, C = map(int, input().split())\n S = dict(enumerate(str(input()), 1))\n\n time.sleep(0.05 * len(str(C)))\n \nif __name__ == "__main__":\n main()', '#!/usr/bin/env python3\n# coding: utf-8\nimport time\n\ndef main():\n N, K, C = map(int, input().split())\n S = dict(enumerate(str(input()), 1))\n\n time.sleep(0.05 * len(str(N)))\nif __name__ == "__main__":\n main()', '#!/usr/bin/env python3\n# coding: utf-8\nimport time\n\ndef main():\n N, K, C = map(int, input().split())\n S = dict(enumerate(str(input()), 1))\n\n # time.sleep(0.05 * len(str(C)))\n \n if N == 100000 and K == 66666 and C == 0:\n N[0]\nif __name__ == "__main__":\n main()', '#!/usr/bin/env python3\n# coding: utf-8\nimport time\n\ndef main():\n N, K, C = map(int, input().split())\n S = dict(enumerate(str(input()), 1))\n\n time.sleep(0.05 * int(str(N)[0]))\nif __name__ == "__main__":\n main()', '#!/usr/bin/env python3\n# coding: utf-8\nimport time\n\ndef main():\n N, K, C = map(int, input().split())\n S = dict(enumerate(str(input()), 1))\n\n time.sleep(0.05 * len(N))\nif __name__ == "__main__":\n main()', '#!/usr/bin/env python3\n# coding: utf-8\nimport time\n\ndef main():\n N, K, C = map(int, input().split())\n S = dict(enumerate(str(input()), 1))\n\n time.sleep(0.05 * int(str(N)[-1]))\nif __name__ == "__main__":\n main()', '#!/usr/bin/env python3\n# coding: utf-8\nimport time\n\ndef main():\n N, K, C = map(int, input().split())\n S = dict(enumerate(str(input()), 1))\n\n # time.sleep(0.05 * len(str(C)))\n \n if N == 100000 and K == 55555 and C == 0:\n XXXX\nif __name__ == "__main__":\n main()', 'pass', '#!/usr/bin/env python3\n# coding: utf-8\nimport time\n\ndef main():\n N, K, C = map(int, input().split())\n S = dict(enumerate(str(input()), 1))\n\nif __name__ == "__main__":\n main()', '#!/usr/bin/env python3\n# coding: utf-8\nimport time\n\ndef main():\n N, K, C = map(int, input().split())\n S = dict(enumerate(str(input()), 1))\n\n # time.sleep(0.05 * len(str(C)))\n time.sleep(0.05 * int(str(K)[4]))\nif __name__ == "__main__":\n main()', '#!/usr/bin/env python3\n# coding: utf-8\nimport time\n\ndef main():\n N, K, C = map(int, input().split())\n S = dict(enumerate(str(input()), 1))\n\n # time.sleep(0.05 * len(str(C)))\n time.sleep(0.05 * int(str(K)[1]))\nif __name__ == "__main__":\n main()', '#!/usr/bin/env python3\n# coding: utf-8\n\n\n# if __debug__:\n\n# else:\n# import sys\n# print(arg, file=sys.stderr)\n \ndef main():\n N, K, C = map(int, input().split())\n S = dict(enumerate(str(input()), 1))\n\n sr = list(k for k, v in S.items() if v == \'o\')\n sl = list(reversed(sr.copy()))\n\n l = [sl.pop()]\n r = [sr.pop()]\n \n for x in range(1, K):\n while True:\n ll = sl.pop()\n if ll > l[x - 1] + C:\n l.append(ll)\n break\n while True:\n rr = sr.pop()\n if rr < r[x - 1] - C:\n r.append(rr)\n break\n\n for ll, rr in zip(l, reversed(r)):\n if ll == rr:\n print(ll)\n\nif __name__ == "__main__":\n main()'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s024676300', 's063987147', 's172090263', 's213170207', 's332843088', 's409010313', 's431892161', 's478280785', 's482403867', 's515002837', 's580449449', 's656079722', 's708403870', 's724193303', 's740130834', 's832760414', 's848521872', 's920530985', 's854837337'] | [27224.0, 27224.0, 27224.0, 27224.0, 2940.0, 27224.0, 27224.0, 27344.0, 27344.0, 27224.0, 27224.0, 27224.0, 27344.0, 27224.0, 2940.0, 27344.0, 27224.0, 27224.0, 30744.0] | [40.0, 340.0, 291.0, 343.0, 18.0, 40.0, 40.0, 280.0, 340.0, 40.0, 324.0, 40.0, 317.0, 40.0, 17.0, 46.0, 490.0, 340.0, 281.0] | [319, 258, 258, 258, 55, 361, 384, 258, 218, 319, 221, 213, 222, 319, 4, 183, 258, 258, 806] |
p02721 | u392319141 | 2,000 | 1,048,576 | Takahashi has decided to work on K days of his choice from the N days starting with tomorrow. You are given an integer C and a string S. Takahashi will choose his workdays as follows: * After working for a day, he will refrain from working on the subsequent C days. * If the i-th character of S is `x`, he will not work on Day i, where Day 1 is tomorrow, Day 2 is the day after tomorrow, and so on. Find all days on which Takahashi is bound to work. | ["print('')", "N, K, C = map(int, input().split())\nS = input()\n\ndef calc(S):\n now = 1\n ret = [0] * (N + 1)\n while now <= N:\n if S[now] == 'x':\n now += 1\n continue\n ret[now] += 1\n now += C + 1\n for i in range(N):\n ret[i + 1] += ret[i]\n\n return ret\n\nL = calc('-' + S)\nR = calc('-' + S[::-1])[::-1]\n\nans = []\nfor mid in range(1, N + 1):\n if S[mid - 1] == 'o' and L[mid] != L[mid - 1] and R[mid] != R[mid - 1] and L[mid] + R[mid] == K:\n ans.append(mid)\n\nprint(*ans, sep='\\n')"] | ['Wrong Answer', 'Accepted'] | ['s915776148', 's035078008'] | [2940.0, 31672.0] | [17.0, 357.0] | [9, 531] |
p02721 | u399298563 | 2,000 | 1,048,576 | Takahashi has decided to work on K days of his choice from the N days starting with tomorrow. You are given an integer C and a string S. Takahashi will choose his workdays as follows: * After working for a day, he will refrain from working on the subsequent C days. * If the i-th character of S is `x`, he will not work on Day i, where Day 1 is tomorrow, Day 2 is the day after tomorrow, and so on. Find all days on which Takahashi is bound to work. | ['N, K, C = map(int, input().split())\nS = list(input())\nS_work = []\ns = []\nf = []\ni = 0\nwhile len(s) < K:\n if S[i] == "o":\n s.append(i)\n i += C + 1\n elif S[i] == "x":\n i += 1\n elif i == len(S):\n break\ni = 1\nwhile len(f) < K:\n if S[N - i] == "o":\n f.append(i)\n i += C + 1\n elif S[N - i] == "x":\n i += 1\n elif i == len(S):\n break\n\nfor i in range(K):\n if s[i] == f[i]:\n print(s[i] + 1)', 'N, K, C = map(int, input().split())\nS = list(input())\nS_work = []\ns = []\nf = []\ni = 0\nwhile len(s) < K:\n if S[i] == "o":\n s.append(i)\n i += C + 1\n elif S[i] == "x":\n i += 1\n elif i == len(S):\n break\ni = 1\nwhile len(f) < K:\n if S[N - i] == "o":\n f.append(i)\n i += C + 1\n elif S[N - i] == "x":\n i += 1\n elif i == len(S):\n break\n\nfor i in range(K):\n if s[i] == f[-i-1]:\n print(s[i] + 1)', 'N, K, C = map(int, input().split())\nS = list(input())\nS_work = []\ns = []\nf = []\ni = 0\nwhile len(s) < K:\n if S[i] == "o":\n s.append(i)\n i += C + 1\n elif S[i] == "x":\n i += 1\n elif i == len(S):\n break\ni = 1\nwhile len(f) < K:\n if S[N - i] == "o":\n f.append(N - i)\n i += C + 1\n elif S[N - i] == "x":\n i += 1\n elif i == len(S):\n break\nf.sort()\nfor i in range(K):\n if s[i] == f[i]:\n print(s[i] + 1)'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s443627416', 's619097015', 's601701089'] | [20728.0, 20732.0, 22012.0] | [226.0, 201.0, 354.0] | [414, 417, 426] |
p02721 | u424768586 | 2,000 | 1,048,576 | Takahashi has decided to work on K days of his choice from the N days starting with tomorrow. You are given an integer C and a string S. Takahashi will choose his workdays as follows: * After working for a day, he will refrain from working on the subsequent C days. * If the i-th character of S is `x`, he will not work on Day i, where Day 1 is tomorrow, Day 2 is the day after tomorrow, and so on. Find all days on which Takahashi is bound to work. | ["for i in range(N):\n if s[i]=='o':\n si=copy.copy(s)\n si[i]='x'\n day=N\n count=0\n flag=False\n while day>K-1 and count<K:\n if si[day-1]=='x':\n day-=1\n else:\n count+=1\n day-=C+1\n if count==K:\n flag=True\n if flag==False:\n print(i+1)", "\n# -*- coding: utf-8 -*-\n\nimport numpy as np\nN, K, C=map(int, input().split())\ns=list(input())\n\nforward=np.zeros(K)\nback=np.zeros(K)\n\nday=0\ncount=0\nwhile day <N and count<K:\n if s[day]=='o':\n forward[count]=day\n count+=1\n day+=C+1\n else:\n day+=1\n\nday=N-1\ncount=0\nwhile day<N and count<K:\n if s[day]=='o':\n back[count]=day\n count+=1\n day-=C+1\n else:\n day-=1\n\n#print(forward)\n#print(back[::-1])\n\nfor i in range(K):\n if forward[i]==back[K-1-i]:\n print(int(forward[i])+1)\n\n"] | ['Runtime Error', 'Accepted'] | ['s028651841', 's838082176'] | [3064.0, 18544.0] | [18.0, 719.0] | [390, 547] |
p02721 | u442877951 | 2,000 | 1,048,576 | Takahashi has decided to work on K days of his choice from the N days starting with tomorrow. You are given an integer C and a string S. Takahashi will choose his workdays as follows: * After working for a day, he will refrain from working on the subsequent C days. * If the i-th character of S is `x`, he will not work on Day i, where Day 1 is tomorrow, Day 2 is the day after tomorrow, and so on. Find all days on which Takahashi is bound to work. | ["N,K,C = map(int,input().split())\nS = str(input())\nworks1 = 0\nworks2 = 0\nl1 = []\nl2 = []\nfor i in range(N):\n if S[i] == 'o':\n works1 += 1\n l1.append(i+1)\n i += C-1\n if works1 == K:\n break\n\nfor i in range(N):\n if S[-i-1] == 'o':\n works2 += 1\n l2.append(N-i)\n i += C-1\n if works2 == K:\n break\n\nl1.extend(l2)\nl = [x for x in set(l1) if l1.count(x) > 1]\nfor i in range(len(l)):\n print(l)", 'N,K,C = map(int,input().split())\nS = str(input())\nworks1 = 0\nworks2 = 0\nl1 = []\nl2 = []\ni = 0\nwhile i < N and works1 < K:\n if S[i] == "o":\n l1.append(i+1)\n i = i+C+1\n works1 += 1\n else:\n i = i+1\ni = N-1\nwhile i > -1 and works2 < K:\n if S[i] == "o":\n l2.append(i+1)\n i = i-C-1\n works2 = works2+1\n else:\n i = i-1\n\nfor i in range(len(l1)):\n if l1[i] == l2[-i-1] :\n print(l1[i])'] | ['Wrong Answer', 'Accepted'] | ['s912606513', 's926483607'] | [33236.0, 20620.0] | [2105.0, 384.0] | [411, 418] |
p02721 | u456353530 | 2,000 | 1,048,576 | Takahashi has decided to work on K days of his choice from the N days starting with tomorrow. You are given an integer C and a string S. Takahashi will choose his workdays as follows: * After working for a day, he will refrain from working on the subsequent C days. * If the i-th character of S is `x`, he will not work on Day i, where Day 1 is tomorrow, Day 2 is the day after tomorrow, and so on. Find all days on which Takahashi is bound to work. | ['N, K, C = list(map(int, input().split()))\nS = list(input())\no = "o"\nx = "x"\n\nW = [0] * N\n\nif S[0] == o:\n W[0] = 1\n\nfor i in range(1, N):\n W[i] = W[i - 1]\n if S[i] == o:\n W[i] += 1\n\nBDP = [0] * N\ncnt = 0\nif S[0] == o:\n BDP[0] = 1\n cnt = C\nfor i in range(1, N):\n BDP[i] = BDP[i - 1]\n if cnt != 0:\n cnt -= 1\n continue\n if S[i] == o:\n BDP[i] += + 1\n cnt = C\n\nADP = [0] * N\ncnt = 0\nif S[-1] == o:\n ADP[-1] = 1\n cnt = C\nfor i in range(N - 2, -1, -1):\n ADP[i] = ADP[i + 1]\n if cnt != 0:\n cnt -= 1\n continue\n if S[i] == o:\n ADP[i] += 1\n cnt = C\n\nBDP = [0] + BDP\n\nIM = [0] * (N + 2)\nans = 0\nfor i in range(C):\n if S[i] == x:\n continue\n if ADP[i] >= K:\n IM[max(-1, i - C) + 1] += 1\n IM[i + 1] -= 1\n IM[min(i + 1, N) + 1] += 1\n IM[min(i + C + 1, N) + 1] -= 1\nfor i in range(C, N - C):\n if S[i] == x:\n continue\n if BDP[i - C] + ADP[i] >= K:\n IM[max(-1, i - C) + 1] += 1\n IM[i + 1] -= 1\n IM[min(i + 1, N) + 1] += 1\n IM[min(i + C + 1, N) + 1] -= 1\nfor i in range(min(N - C, C), N):\n if S[i] == x:\n continue\n if BDP[i - C] + 1 >= K:\n IM[max(-1, i - C) + 1] += 1\n IM[i + 1] -= 1\n IM[min(i + 1, N) + 1] += 1\n IM[min(i + C + 1, N) + 1] -= 1\n\nfor i in range(1, N + 2):\n IM[i] += IM[i - 1]\n\nif BDP[-1] < K:\n exit()\n\nif C == 0:\n if W[-1] == K:\n for i in range(N):\n if S[i] == o:\n print(i + 1)\n exit()\n\nDP = [0] * (N + 1)\nfor i in range(N):\n k = 0\n k += BDP[i]\n if i + C < N:\n k += ADP[i + C]\n if k >= K:\n DP[max(i, -1)] += 1\n DP[min(i + C, N)] -= 1\n\nfor i in range(1, N + 1):\n DP[i] += DP[i - 1]\nprint(DP)\nfor i in range(1, N + 1):\n if S[i - 1] == o and IM[i] == 0 and DP[i - 1] == 0:\n print(i)\n\n', 'N, K, C = list(map(int, input().split()))\nS = list(input())\no = "o"\nx = "x"\n\nW = [0] * N\n\nif S[0] == o:\n W[0] = 1\n\nfor i in range(1, N):\n W[i] = W[i - 1]\n if S[i] == o:\n W[i] += 1\n\nBDP = [0] * N\ncnt = 0\nif S[0] == o:\n BDP[0] = 1\n cnt = C\nfor i in range(1, N):\n BDP[i] = BDP[i - 1]\n if cnt != 0:\n cnt -= 1\n continue\n if S[i] == o:\n BDP[i] += + 1\n cnt = C\n\nADP = [0] * N\ncnt = 0\nif S[-1] == o:\n ADP[-1] = 1\n cnt = C\nfor i in range(N - 2, -1, -1):\n ADP[i] = ADP[i + 1]\n if cnt != 0:\n cnt -= 1\n continue\n if S[i] == o:\n ADP[i] += 1\n cnt = C\n\nBDP = [0] + BDP\n\nIM = [0] * (N + 2)\nans = 0\nfor i in range(C):\n if S[i] == x:\n continue\n if ADP[i] >= K:\n IM[max(-1, i - C) + 1] += 1\n IM[i + 1] -= 1\n IM[min(i + 1, N) + 1] += 1\n IM[min(i + C + 1, N) + 1] -= 1\nfor i in range(C, N - C):\n if S[i] == x:\n continue\n if BDP[i - C] + ADP[i] >= K:\n IM[max(-1, i - C) + 1] += 1\n IM[i + 1] -= 1\n IM[min(i + 1, N) + 1] += 1\n IM[min(i + C + 1, N) + 1] -= 1\nfor i in range(min(N - C, C), N):\n if S[i] == x:\n continue\n if BDP[i - C] + 1 >= K:\n IM[max(-1, i - C) + 1] += 1\n IM[i + 1] -= 1\n IM[min(i + 1, N) + 1] += 1\n IM[min(i + C + 1, N) + 1] -= 1\n\nfor i in range(1, N + 2):\n IM[i] += IM[i - 1]\n\nif BDP[-1] < K:\n exit()\n\nif C == 0:\n if W[-1] == K:\n for i in range(N):\n if S[i] == o:\n print(i + 1)\n exit()\n\nDP = [0] * (N + 1)\nfor i in range(N):\n k = 0\n k += BDP[i]\n if i + C < N:\n k += ADP[i + C]\n if k >= K:\n DP[max(i, -1)] += 1\n DP[min(i + C, N)] -= 1\n\nfor i in range(1, N + 1):\n DP[i] += DP[i - 1]\n\nfor i in range(1, N + 1):\n if S[i - 1] == o and IM[i] == 0 and DP[i - 1] == 0:\n print(i)\n\n'] | ['Wrong Answer', 'Accepted'] | ['s231842223', 's201561949'] | [31584.0, 31468.0] | [930.0, 930.0] | [1703, 1694] |
p02721 | u515647766 | 2,000 | 1,048,576 | Takahashi has decided to work on K days of his choice from the N days starting with tomorrow. You are given an integer C and a string S. Takahashi will choose his workdays as follows: * After working for a day, he will refrain from working on the subsequent C days. * If the i-th character of S is `x`, he will not work on Day i, where Day 1 is tomorrow, Day 2 is the day after tomorrow, and so on. Find all days on which Takahashi is bound to work. | ['line1 = input().split()\nn = int(line1[0])\nk = int(line1[1])\nc = int(line1[2])\ns = list(input())\nl = [s.index("o") + 1]\nr = [len(s) - s[::-1].index("o")]\nfor i in range(1, k):\n j = l[i - 1]\n m = r[i - 1]\n while j - l[i - 1] <= c or s[j - 1] != "o":\n j += 1\n while r[i - 1] - m <= c or s[m - 1] != "o":\n m -= 1\n r.append(m)\n l.append(j)\nfor i in range(len(r)):\n if r[i] == l[i]:\n print(i)', 'line1 = input().split()\nn = int(line1[0])\nk = int(line1[1])\nc = int(line1[2])\ns = list(input())\nl = [s.index("o") + 1]\nr = [len(s) - s[::-1].index("o")]\nfor i in range(1, k):\n j = l[i - 1]\n m = r[i - 1]\n while j - l[i - 1] <= c or s[j - 1] != "o":\n j += 1\n while r[i - 1] - m <= c or s[m - 1] != "o":\n m -= 1\n r.append(m)\n l.append(j)\nr = r[::-1]\nfor i in range(len(r)):\n if r[i] == l[i]:\n print(r[i])'] | ['Wrong Answer', 'Accepted'] | ['s088096400', 's789893245'] | [23420.0, 24860.0] | [320.0, 497.0] | [402, 417] |
p02721 | u526780498 | 2,000 | 1,048,576 | Takahashi has decided to work on K days of his choice from the N days starting with tomorrow. You are given an integer C and a string S. Takahashi will choose his workdays as follows: * After working for a day, he will refrain from working on the subsequent C days. * If the i-th character of S is `x`, he will not work on Day i, where Day 1 is tomorrow, Day 2 is the day after tomorrow, and so on. Find all days on which Takahashi is bound to work. | ['n,k,c=[int(x) for x in input().split()]\ns=list(input())\n\nL=[]\nR=[]\ni=0\nwhile i < n:\n \n if s[i]=="o":\n L.append(i)\n i+=2\n i+=1\n\ni=0\nwhile i < n:\n \n if s[n-i-1]=="o":\n R.append(n-i-1)\n i+=2\n i+=1\n \n\n\ndays=[]\n\nfor i in range(k):\n \n if L[i]==R[i]:\n days.append(L[i])\n\nfor i in range(len(days)):\n print(days[i])', 'L=[]\nR=[]\n\ni=0\nwhile i < n: \n if s[i]=="o":\n L.append(i)\n i+=2\n i+=1\n\ni=0\nwhile i < n:\n if s[n-i-1]=="o":\n R.append(n-i-1)\n i+=2\n i+=1\n\ndays=[]\nfor i in range(k):\n if L[i]==R[i]:\n days.append(L[i])\n\n\nfor i in range(len(days)):\n print(days[i]+1)', 'n,k,c=[int(x) for x in input().split()]\ns=list(input())\n\nL=[]\nR=[]\n\ni=0\nwhile i < n: \n if s[i]=="o":\n L.append(i)\n i+=c\n i+=1\n\ni=0\nwhile i < n:\n if s[n-i-1]=="o":\n R.append(n-i-1)\n i+=c\n i+=1\nprint(L,R)\n\ndays=[]\nfor i in range(k):\n if L[i]==R[i]:\n days.append(L[i])\n\n\nfor i in range(len(days)):\n print(days[i]+1)', 'n,k,c=[int(x) for x in input().split()]\ns=list(input())\n\nL=[]\nR=[]\n\ni=0\nwhile i < n: \n if s[i]=="o":\n L.append(i)\n i+=c\n i+=1\n\ni=0\nwhile i < n:\n if s[n-i-1]=="o":\n R.append(n-i-1)\n i+=c\n i+=1\n \ndays=[]\nfor i in range(k):\n if L[i]==R[k-i-1]:\n days.append(L[i])\n\n\nfor i in range(len(days)):\n print(days[i]+1)'] | ['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s050759415', 's309543355', 's403416699', 's808020809'] | [10116.0, 3064.0, 27736.0, 23676.0] | [109.0, 17.0, 258.0, 408.0] | [371, 298, 366, 363] |
p02721 | u568576853 | 2,000 | 1,048,576 | Takahashi has decided to work on K days of his choice from the N days starting with tomorrow. You are given an integer C and a string S. Takahashi will choose his workdays as follows: * After working for a day, he will refrain from working on the subsequent C days. * If the i-th character of S is `x`, he will not work on Day i, where Day 1 is tomorrow, Day 2 is the day after tomorrow, and so on. Find all days on which Takahashi is bound to work. | ["L=[]\nR=[]\nN,K,C=map(int,input().split())\nS=list(input())\ns=S[::-1]\ni=0\nwhile len(L)<K:\n if S[i]=='o':\n L.append(i+1)\n if i+C<N:\n for j in range(1,C+1):\n S[i+j]='x'\n i+=1\nprint(L)\nk=0\nwhile len(R)<K:\n if s[k]=='o':\n R.append(N-k)\n if k+C<N:\n for l in range(1,C+1):\n s[k+l]='x'\n k+=1\nR=R[::-1]\nans=[]\nfor i in range(K):\n if L[i]==R[i]:\n ans.append(L[i])\nprint(*ans)", "L=[]\nR=[]\nN,K,C=map(int,input().split())\nS=list(input())\ns=S[::-1]\ni=0\nwhile len(L)<K:\n if S[i]=='o':\n L.append(i+1)\n if i+C<N:\n for j in range(1,C+1):\n S[i+j]='x'\n i+=1\nk=0\nwhile len(R)<K:\n if s[k]=='o':\n R.append(N-k)\n if k+C<N:\n for l in range(1,C+1):\n s[k+l]='x'\n k+=1\nR=R[::-1]\nans=[]\nfor i in range(K):\n if L[i]==R[i]:\n ans.append(L[i])\nprint(*ans)"] | ['Wrong Answer', 'Accepted'] | ['s991885137', 's256686694'] | [29636.0, 28304.0] | [444.0, 458.0] | [465, 456] |
p02721 | u645436608 | 2,000 | 1,048,576 | Takahashi has decided to work on K days of his choice from the N days starting with tomorrow. You are given an integer C and a string S. Takahashi will choose his workdays as follows: * After working for a day, he will refrain from working on the subsequent C days. * If the i-th character of S is `x`, he will not work on Day i, where Day 1 is tomorrow, Day 2 is the day after tomorrow, and so on. Find all days on which Takahashi is bound to work. | ['N, K, C = map(int, input().split())\nS = input()\nL = []\nR = []\nL_index = 0\nL_count = 0\nR_index = N - 1\nR_count = K - 1\n\nwhile L_index < N and L_count < K:\n if S[L_index] == "o":\n L.append(L_index)\n L_index += (C + 1)\n L_count += 1\n else:\n L_index += 1\nwhile R_index >= 0 and R_count >= 0:\n if S[R_index] == "o":\n R.append(R_index)\n R_index -= (C - 1)\n R_count -= 1\n else:\n R_index -= 1\n\nwork_day = set(L) & set(R)\nfor w_day in work_day:\n print(w_day + 1)\n', 'n, k, c = map(int, input().split())\ns = input()\nl = [-1] * k\nr = [-1] * k\nnowl = 0\nindl = 0\nwhile nowl < n and indl < k:\n for i in range(nowl, n):\n if s[i] == "o":\n l[indl] = i\n nowl = i + c + 1\n indl += 1\n break\nnowr = n - 1\nindr = k - 1\nwhile nowr >= 0 and indr >= 0:\n for i in range(nowr, -1, -1):\n if s[i] == "o":\n r[indr] = i\n nowr = i - c - 1\n indr -= 1\n break\nprint(l)\nprint(r)\nfor i in range(k):\n if l[i] == r[i]:\n print(l[i] + 1)\n', 'N, K, C = map(int, input().split())\nS = input()\nL = [-1] * K\nR = [-1] * K\nL_index = 0\nL_count = 0\nR_index = N - 1\nR_count = K - 1\n\nwhile L_index < N and L_count < K:\n if S[L_index] == "o":\n L[L_count] = L_index\n L_index += (C + 1)\n L_count += 1\n else:\n L_index += 1\nwhile R_index >= 0 and R_count >= 0:\n if S[R_index] == "o":\n R[R_count] = R_index\n R_index -= (C + 1)\n R_count -= 1\n else:\n R_index -= 1\n\nfor i in range(K):\n if L[i] == R[i]:\n print(L[i] + 1)\n'] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s212396991', 's844552244', 's484656691'] | [11472.0, 26228.0, 20616.0] | [100.0, 576.0, 375.0] | [525, 557, 536] |
p02721 | u664373116 | 2,000 | 1,048,576 | Takahashi has decided to work on K days of his choice from the N days starting with tomorrow. You are given an integer C and a string S. Takahashi will choose his workdays as follows: * After working for a day, he will refrain from working on the subsequent C days. * If the i-th character of S is `x`, he will not work on Day i, where Day 1 is tomorrow, Day 2 is the day after tomorrow, and so on. Find all days on which Takahashi is bound to work. | ['n,k,c=map(int,input().split())\ns=input()\nne=10**6*(-1)\nfow=[]\nbac=[]\nfor i in range(n):\n if i>ne and s[i]!="x":\n ne=i+c\n fow.append(i)\n if len(fow)==k:\n break\nne=10**6\nfor i in range(n-1,-1,-1):\n if i<ne and s[i]!="x":\n ne=i-c\n bac.append(i)\n if len(bac)==k:\n break\nbac.sort()\nfor i,j in zip(fow,bac):\n if i==j:\n print(i)', 'n,k,c=map(int,input().split())\ns=input()\nne=10**6*(-1)\nfow=[]\nbac=[]\nfor i in range(n):\n if i>ne and s[i]!="x":\n ne=i+c\n fow.append(i)\n if len(fow)==k:\n break\nne=10**6\nfor i in range(n-1,-1,-1):\n if i<ne and s[i]!="x":\n ne=i-c\n bac.append(i)\n if len(bac)==k:\n break\nbac.sort()\nfor i,j in zip(fow,bac):\n if i==j:\n print(i+1)'] | ['Wrong Answer', 'Accepted'] | ['s060346209', 's364462911'] | [20728.0, 20724.0] | [338.0, 358.0] | [385, 387] |
p02721 | u674052742 | 2,000 | 1,048,576 | Takahashi has decided to work on K days of his choice from the N days starting with tomorrow. You are given an integer C and a string S. Takahashi will choose his workdays as follows: * After working for a day, he will refrain from working on the subsequent C days. * If the i-th character of S is `x`, he will not work on Day i, where Day 1 is tomorrow, Day 2 is the day after tomorrow, and so on. Find all days on which Takahashi is bound to work. | ['# -*- coding: utf-8 -*-\n"""\nCreated on Sun Apr 5 22:11:18 2020\n\n@author: Kanaru Sato\n"""\n\nn,k,c = list(map(int, input().split()))\ns = list(input())\n\nearly = []\nlate = []\n\ni = 0\ncount = 0\nwhile i < n and count < k:\n if s[i] == "o":\n early.append(i)\n i = i+c+1\n count = count+1\n else:\n i = i+1\n\nprint(early)\n\ni = n-1\ncount = 0\nwhile i > -1 and count < k:\n if s[i] == "o":\n late.append(i)\n i = i-c-1\n count = count+1\n else:\n i = i-1\n\nfor i in range(len(early)):\n if early[i] == late[k-i-1]:\n print(early[i]+1)', '# -*- coding: utf-8 -*-\n"""\nCreated on Sun Apr 5 22:11:18 2020\n\n@author: Kanaru Sato\n"""\n\nn,k,c = list(map(int, input().split()))\ns = list(input())\n\nearly = []\nlate = []\n\ni = 0\ncount = 0\nwhile i < n and count < k:\n if s[i] == "o":\n early.append(i)\n i = i+c+1\n count = count+1\n else:\n i = i+1\n\nprint(early)\n\ni = n-1\ncount = 0\nwhile i > -1 and count < k:\n if s[i] == "o":\n late.append(i)\n i = i-c-1\n count = count+1\n else:\n i = i-1\n\nfor i in range(len(early)):\n if early[i] == late[k-i-1]:\n print(early[i]+1)', '# -*- coding: utf-8 -*-\n"""\nCreated on Sun Apr 5 22:11:18 2020\n\n@author: Kanaru Sato\n"""\n\nn,k,c = list(map(int, input().split()))\ns = list(input())\n\nearly = []\nlate = []\n\ni = 0\ncount = 0\nwhile i < n and count < k:\n if s[i] == "o":\n early.append(i)\n i = i+c+1\n count = count+1\n else:\n i = i+1\n\n\ni = n-1\ncount = 0\nwhile i > -1 and count < k:\n if s[i] == "o":\n late.append(i)\n i = i-c-1\n count = count+1\n else:\n i = i-1\n\nfor i in range(len(early)):\n if early[i] == late[k-i-1]:\n print(early[i]+1)'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s114629287', 's329513208', 's494770737'] | [23576.0, 23572.0, 22104.0] | [401.0, 399.0, 418.0] | [585, 585, 572] |
p02721 | u692311686 | 2,000 | 1,048,576 | Takahashi has decided to work on K days of his choice from the N days starting with tomorrow. You are given an integer C and a string S. Takahashi will choose his workdays as follows: * After working for a day, he will refrain from working on the subsequent C days. * If the i-th character of S is `x`, he will not work on Day i, where Day 1 is tomorrow, Day 2 is the day after tomorrow, and so on. Find all days on which Takahashi is bound to work. | ['N,K,C=map(int,input().split())\nS=input()\nL=[0 for i in range(K)]\nR=[0 for i in range(K)]\nn=0\nrc=0\nlc=0\nwhile True:\n if lc==K:\n break\n if S[n]=="o":\n L[lc]=n+1\n n+=C+1\n lc+=1\n else:\n n+=1\nn=N-1\nwhile True:\n if rc==K:\n break\n if S[n]=="o":\n R[N-1-rc]=n+1\n n-=C+1\n rc+=1\n else:\n n-=1\nfor i in range(K):\n if R[i]==L[i]:\n print(R[i])\n', 'N,K,C=map(int,input().split())\nS=input()\nL=[0 for i in range(K)]\nR=[0 for i in range(K)]\nn=0\nrc=0\nlc=0\nwhile True:\n if lc==K:\n break\n if S[n]=="o":\n L[lc]=n+1\n n+=C+1\n lc+=1\n else:\n n+=1\nn=N-1\nwhile True:\n if rc==K:\n break\n if S[n]=="o":\n R[K-1-rc]=n+1\n n-=C+1\n rc+=1\n else:\n n-=1\nfor i in range(K):\n if R[i]==L[i]:\n print(R[i])\n'] | ['Runtime Error', 'Accepted'] | ['s361305486', 's090028497'] | [20660.0, 20664.0] | [354.0, 376.0] | [369, 369] |
p02721 | u698176039 | 2,000 | 1,048,576 | Takahashi has decided to work on K days of his choice from the N days starting with tomorrow. You are given an integer C and a string S. Takahashi will choose his workdays as follows: * After working for a day, he will refrain from working on the subsequent C days. * If the i-th character of S is `x`, he will not work on Day i, where Day 1 is tomorrow, Day 2 is the day after tomorrow, and so on. Find all days on which Takahashi is bound to work. | ["# -*- coding: utf-8 -*-\nimport sys\n\nN,K,C = map(int,input().split())\nS = input()\n#%%\nassign_t = [False]*N\nassign_b = [False]*N\n\n\nfor i in range(10):\n nassign_t = [False]*N\n i = 0\n num = 0\n while i<N and num<K:\n if S[i]=='o':\n nassign_t[i] = True\n num += 1\n i += C+1\n else:\n i += 1\n if num==K:\n if i==0:\n for j in range(N):\n assign_t[j] |= nassign_t[j]\n else:\n for j in range(N):\n assign_t[j] &= nassign_t[j]\n \ni = N-1\nnum = 0\nwhile i>=0 and num<K:\n if S[i]=='o':\n assign_b[i]=True\n num += 1\n i -= C+1\n else:\n i -=1\n\n\nfor i in range(N):\n if assign_t[i] and assign_b[i]:\n print(i+1)", "# -*- coding: utf-8 -*-\nimport sys\n\nN,K,C = map(int,input().split())\nS = input()\n#%%\nassign_t = [False]*N\nassign_b = [False]*N\n\n\nfor i in range(10):\n nassign_t = [False]*N\n num = 0\n while i<N and num<K:\n if S[i]=='o':\n nassign_t[i] = True\n num += 1\n i += C+1\n else:\n i += 1\n if num==K:\n if i==0:\n for j in range(N):\n assign_t[j] |= nassign_t[j]\n else:\n for j in range(N):\n assign_t[j] &= nassign_t[j]\n \ni = N-1\nnum = 0\nwhile i>=0 and num<K:\n if S[i]=='o':\n assign_b[i]=True\n num += 1\n i -= C+1\n else:\n i -=1\n\n\nfor i in range(N):\n if assign_t[i] and assign_b[i]:\n print(i+1)", "# -*- coding: utf-8 -*-\nimport sys\n\nN,K,C = map(int,input().split())\nS = input()\n#%%\nassign_t = [False]*N\nassign_b = [False]*N\n\n\ni = 0\nnum = 0\nwhile i<N:\n if S[i]=='o':\n assign_t[i]=True\n num += 1\n i += C+1\n else:\n i += 1\n\nif num>K:\n print()\n sys.exit()\n\ni = N-1\nnum = 0\nwhile i>=0 and num<K:\n if S[i]=='o':\n assign_b[i]=True\n num += 1\n i -= C+1\n else:\n i -=1\n\n\nfor i in range(N):\n if assign_t[i] and assign_b[i]:\n print(i+1)"] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s243970991', 's903844945', 's641006150'] | [9580.0, 11576.0, 7876.0] | [1219.0, 855.0, 327.0] | [774, 764, 509] |
p02721 | u699765883 | 2,000 | 1,048,576 | Takahashi has decided to work on K days of his choice from the N days starting with tomorrow. You are given an integer C and a string S. Takahashi will choose his workdays as follows: * After working for a day, he will refrain from working on the subsequent C days. * If the i-th character of S is `x`, he will not work on Day i, where Day 1 is tomorrow, Day 2 is the day after tomorrow, and so on. Find all days on which Takahashi is bound to work. | ["import copy\n\nn, k, c = map(int, input().split())\ns = list(input())\n\ntmp = copy.deepcopy(s)\nwait = 0\nlast_day = k\ncount = set()\n\nfor num, i in enumerate(tmp):\n if wait>0:\n wait -= 1\n continue\n if i == 'o':\n count.add(num)\n wait = c\n last_day -= 1\n if last_day == 0:\n break\n\ntmp = copy.deepcopy(s)\nwait = 0\nlast_day = k\ncount2 = set()\nfor num, i in enumerate(reversed(tmp)):\n if wait>0:\n wait -= 1\n if i == 'o' or i == 'a':\n count2.add(n - num - 1)\n wait = c\n last_day -= 1\n if last_day == 0:\n break\n\ncount = list(count)\ncount2 = list(count2)\ncount.sort()\ncount2.sort()\nans = []\nfor i in range(len(count)):\n if count[i]==count2[i]:\n ans.append(count[i]+1)\n \nfor i in ans:\n print(i)", "import copy\n\nn, k, c = map(int, input().split())\ns = list(input())\n\ntmp = copy.deepcopy(s)\nwait = 0\nlast_day = k\ncount = set()\n\nfor num, i in enumerate(tmp):\n if wait>0:\n wait -= 1\n continue\n if i == 'o':\n count.add(num)\n wait = c\n last_day -= 1\n if last_day == 0:\n break\n\ntmp = copy.deepcopy(s)\nwait = 0\nlast_day = k\ncount2 = set()\nfor num, i in enumerate(reversed(tmp)):\n if wait>0:\n wait -= 1\n continue\n if i == 'o':\n count2.add(n - num - 1)\n wait = c\n last_day -= 1\n if last_day == 0:\n break\n\ncount = list(count)\ncount2 = list(count2)\ncount.sort()\ncount2.sort()\nans = []\nfor i in range(len(count)):\n if count[i]==count2[i]:\n ans.append(count[i]+1)\n\nfor i in ans:\n print(i)"] | ['Wrong Answer', 'Accepted'] | ['s119391928', 's071823783'] | [42488.0, 42488.0] | [718.0, 657.0] | [810, 807] |
p02721 | u700805562 | 2,000 | 1,048,576 | Takahashi has decided to work on K days of his choice from the N days starting with tomorrow. You are given an integer C and a string S. Takahashi will choose his workdays as follows: * After working for a day, he will refrain from working on the subsequent C days. * If the i-th character of S is `x`, he will not work on Day i, where Day 1 is tomorrow, Day 2 is the day after tomorrow, and so on. Find all days on which Takahashi is bound to work. | ['import itertools\nn, k, c = map(int, input().split())\ns = input()\ncounto = s.count("o")\ncount = 0\na = []\nb = [0]\nfor i in range(n):\n if s[i] == "o":\n a.append(i)\nfor i in list(itertools.combinations(a, k)):\n for j in range(len(i)-1):\n if i[j] - i[j-1]<=c:\n break\n count += 1\nprint(count) \n\n \n ', 'n, k, c = map(int, input().split())\ns = input()\nleft_dp = []\nright_dp = []\n\ni = 0\nwhile len(left_dp)<k:\n if s[i] == "o":\n left_dp.append(i+1)\n i += c+1\n else: i += 1\n \ni = n-1\nwhile len(right_dp)<k:\n if s[i] == "o":\n right_dp.append(i+1)\n i -= c+1\n else: i -= 1\n\nfor i in range(k):\n if left_dp[i] == right_dp[k-i-1]:\n print(left_dp[i])'] | ['Wrong Answer', 'Accepted'] | ['s043169075', 's218824293'] | [1919600.0, 20644.0] | [2224.0, 355.0] | [337, 392] |
p02721 | u703528810 | 2,000 | 1,048,576 | Takahashi has decided to work on K days of his choice from the N days starting with tomorrow. You are given an integer C and a string S. Takahashi will choose his workdays as follows: * After working for a day, he will refrain from working on the subsequent C days. * If the i-th character of S is `x`, he will not work on Day i, where Day 1 is tomorrow, Day 2 is the day after tomorrow, and so on. Find all days on which Takahashi is bound to work. | ['N,K,C=map(int,input().split())\nSL=input()\nSR=SL[::-1]\nLeft=[]\nRight=[]\nLast=-N\nRast=-N\ncL=cR=0\nfor i in range(N):\n if SL[i]=="o" and i-Last>C and cL<=K:\n Left.append(i)\n Last=i\n cL+=1\n if SR[i]=="o" and i-Rast>C and cR<=K:\n Right.append(N-i-1)\n Rast=i\n cR+=1\nRight=Right[::-1]\n\nans=[]\n\nfor k in range(K):\n if Left[k]==Right[k]:\n ans.append(Left[k]+1)\nprint(ans)', 'N,K,C=map(int,input().split())\nSL=input()\nSR=SL[::-1]\nLeft=[]\nRight=[]\nLast=-N-1\nRast=-N-1\ncL=cR=0\nfor i in range(N):\n if SL[i]=="o" and i-Last>C and cL<=K:\n Left.append(i)\n Last=i\n cL+=1\n if SR[i]=="o" and i-Rast>C and cR<=K:\n Right.append(N-i-1)\n Rast=i\n cR+=1\nRight=Right[::-1]\n\nans=[]\nfor k in range(K):\n if Left[k]==Right[k]:\n ans.append(Left[k]+1)\n\nif len(ans)==0:\n print()\nelse:\n for a in ans:\n print(a)'] | ['Runtime Error', 'Accepted'] | ['s151437901', 's206601141'] | [32032.0, 29044.0] | [296.0, 389.0] | [419, 481] |
p02721 | u707960254 | 2,000 | 1,048,576 | Takahashi has decided to work on K days of his choice from the N days starting with tomorrow. You are given an integer C and a string S. Takahashi will choose his workdays as follows: * After working for a day, he will refrain from working on the subsequent C days. * If the i-th character of S is `x`, he will not work on Day i, where Day 1 is tomorrow, Day 2 is the day after tomorrow, and so on. Find all days on which Takahashi is bound to work. | ["N, K, C = map(int, input().split())\nS = input()\nL, R = [0]*N, [0]*N\ni = 0\ncount = 1\nwhile count <= K:\n if S[i] == 'x':\n i += 1\n continue\n L[i] = count\n count += 1\n i += C+1\ni = N-1\ncount = K\nwhile count > 0:\n if S[i] == 'x':\n i -= 1\n continue\n print(i, count)\n R[i] = count\n count -= 1\n i -= C+1\nfor i in range(N):\n if L[i] == 0:\n continue\n if L[i] == R[i]:\n print(i+1)", "N, K, C = map(int, input().split())\nS = input()\nL, R = [0]*N, [0]*N\ni = 0\ncount = 1\nwhile count <= K:\n if S[i] == 'x':\n i += 1\n continue\n L[i] = count\n count += 1\n i += C+1\ni = N-1\ncount = K\nwhile count > 0:\n if S[i] == 'x':\n i -= 1\n continue\n R[i] = count\n count -= 1\n i -= C+1\nfor i in range(N):\n if L[i] == 0:\n continue\n if L[i] == R[i]:\n print(i+1)"] | ['Wrong Answer', 'Accepted'] | ['s947939302', 's235173279'] | [23124.0, 20628.0] | [619.0, 376.0] | [444, 424] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.