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
|
---|---|---|---|---|---|---|---|---|---|---|
p03317 | u623819879 | 2,000 | 1,048,576 | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N. On this sequence, Snuke can perform the following operation: * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements. Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable. | ['n,k=map(int,input().split())\nprint((n-1+k)//(k-1))', 'n,k=map(int,input().split())\nprint(int((n-1)/(k-1)))', 'n,k=map(int,input().split())\nprint((n-1)//(k-1))', 'n,k=map(int,input().split())\nprint(int((n-1)/k))', 'n,k=map(int,input().split())\nprint(int((n-1)/k))', 'n,k=map(int,input().split())\nprint(int((n-1)/(k-1))', 'n,k=map(int,input().split())\nprint((n+k-3)//(k-1))'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s026671942', 's109836776', 's139798426', 's153923352', 's218207039', 's529908567', 's732608853'] | [2940.0, 2940.0, 2940.0, 3060.0, 2940.0, 2940.0, 2940.0] | [17.0, 18.0, 17.0, 20.0, 18.0, 17.0, 17.0] | [50, 52, 48, 48, 48, 51, 50] |
p03317 | u631914718 | 2,000 | 1,048,576 | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N. On this sequence, Snuke can perform the following operation: * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements. Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable. | ['n, k = LI()\na = LI()\nl = len(a[:a.index(1)])\nr = len(a[a.index(1):])\n\nif l == 0:\n left = 0\nelif l < k:\n left = 1\nelse:\n left = math.ceil((l - k) / (k - 1)) + 1\n\nif r == 0:\n right = 0\nelif r < k:\n right = 1\nelse:\n right = math.ceil((r - k) / (k - 1)) + 1\n\nprint(left + right)', 'import math\n\ndef LI(): return [int(x) for x in sys.stdin.readline().split()]\n\nn, k = LI()\na = LI()\nl = len(a[:a.index(1)])\nr = len(a[a.index(1):])\n\nleft = math.ceil((l - k) / (k - 1)) + 1\nright = math.ceil((r - k) / (k - 1)) + 1\n\nprint(left + right)', 'n, k = LI()\na = LI()\nl = len(a[:a.index(1)]) + 1\nr = len(a[a.index(1):])\n\nif l == 1:\n left = 0\nelif l < k:\n left = 1\nelse:\n left = math.ceil((l - k) / (k - 1)) + 1\n\nif r == 1:\n right = 0\nelif r < k:\n right = 1\nelse:\n right = math.ceil((r - k) / (k - 1)) + 1\n\nprint(left + right)', 'import math, sys\ndef LI(): return [int(x) for x in sys.stdin.readline().split()]\n\n\nn, k = LI()\na = LI()\n\nresult = math.ceil((n - k) / (k - 1)) + 1\n\nprint(result)'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s015898062', 's372012616', 's831199316', 's305640161'] | [3064.0, 3064.0, 3064.0, 13876.0] | [17.0, 17.0, 17.0, 45.0] | [292, 249, 296, 161] |
p03317 | u634208461 | 2,000 | 1,048,576 | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N. On this sequence, Snuke can perform the following operation: * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements. Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable. | ['N, K = map(int, input().split())\nA = list(map(int, input().split()))\ncount = 0\nfor i in range(int(N / (K - 1))):\n if i * (K - 1) + K <= N - 1:\n m = min(A[i * (K - 1):i * (K - 1) + K])\n for j in range(i * (K - 1), i * (K - 1) + K):\n A[j] = m\n count += 1\n else:\n m = min(A[N - K:N])\n for j in range(N - K, N):\n A[j] = m\n print(A)\ncount += 1\nA.reverse()\na = 0\nfor i in range(1, N):\n if A[i] != A[0]:\n a = i\n break\nif a != 0:\n count += int((N - a) / (K - 1))\nprint(count)\n', 'import math\nN, K = map(int, input().split())\nA = list(map(int, input().split()))\nprint(math.ceil((N - 1) / (K - 1)))\n'] | ['Runtime Error', 'Accepted'] | ['s658656090', 's280138798'] | [141088.0, 13812.0] | [1862.0, 39.0] | [554, 117] |
p03317 | u636162168 | 2,000 | 1,048,576 | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N. On this sequence, Snuke can perform the following operation: * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements. Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable. | ['n,k=map(int,input().split())\na=list(map(int,input().split()))\ntmp=min(a)\ncount_min=Counter(a)[tmp]\nkazu=n-count_min\nif kazu%(k-1)==0:\n print(kazu//(k-1))\nelse:\n print(kazu//(k-1)+1)', 'from collections import Counter\nn,k=map(int,input().split())\na=list(map(int,input().split()))\ntmp=min(a)\ncount_min=Counter(a)[tmp]\nkazu=n-count_min\nif kazu%(k-1)==0:\n print(kazu//(k-1))\nelse:\n print(kazu//(k-1)+1)'] | ['Runtime Error', 'Accepted'] | ['s669613594', 's271072389'] | [13880.0, 19936.0] | [43.0, 56.0] | [187, 219] |
p03317 | u637918426 | 2,000 | 1,048,576 | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N. On this sequence, Snuke can perform the following operation: * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements. Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable. | ['import math\n\nN, K = map(int, input().split())\nA = list(input().split())\nA_lis = [int(A[i]) for i in range(N)]\nindex = A_lis.index(1)\n\nif N == K:\n print(1)\nelse:\n left = math.ceil(index / (K-1))\n leftamari = index % (K-1)\n right = math.ceil(max(0, N - K - index + leftamari) / (K-1))\n print(left + right)\n ', 'import math\n\nN, K = map(int, input().split())\nA = list(input().split())\nA_lis = [int(A[i]) for i in range(N)]\nindex = A_lis.index(1)\n\nif N == K:\n print(1)\nelse:\n left = math.ceil(index / (K-1))\n leftamari = index % (K-1)\n right = math.ceil(max(0, N - 1 - index - (K - 1 - leftamari if leftamari != 0 else 0)) / (K-1))\n print(left + right)\n '] | ['Wrong Answer', 'Accepted'] | ['s586182166', 's691113034'] | [13796.0, 13924.0] | [50.0, 48.0] | [323, 358] |
p03317 | u638902622 | 2,000 | 1,048,576 | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N. On this sequence, Snuke can perform the following operation: * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements. Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable. | ['from sys import stdin\n\nN, K = [int (x) for x in stdin.readline().rstrip().split()]\nA = [int (x) for x in stdin.readline().rstrip().split()]\n\nfront = 0\ntail = 0\ncount = 0\n\nfor i in range(N):\n if A[i] == 1:\n break\n else:\n front += 1\ntail = N - (front + 1)\n\ncount += (front + 1)//2\ncount += (tail + 1)//2\n\nif front == 1:\n count += 1\nif tail == 1:\n count += 1\n\nprint(count)\n', 'from sys import stdin\n\nN, K = [int (x) for x in stdin.readline().rstrip().split()]\nA = [int (x) for x in stdin.readline().rstrip().split()]\n\nfront = 0\ntail = 0\ncount = 0\n\nfor i in range(N):\n if A[i] == 1:\n break\n else:\n front += 1\ntail = N - (front + 1)\n\ncount += (front + 1)//2\ncount += (tail + 1)//2\nif front <= 1:\n count += 1\nif tail <= 1:\n count += 1\n\nprint(count)\n', "import sys\n\ndef IS(): return sys.stdin.readline().rstrip()\ndef II(): return int(IS())\ndef MII(): return list(map(int, IS().split()))\n#======================================================#\ndef main():\n n, k = MII()\n aa = MII()\n print((-(-(n-1)//(k-1))) if n > 3 else 1)\n\n\nif __name__ == '__main__':\n main()"] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s888378184', 's916421135', 's528501279'] | [13880.0, 13880.0, 14008.0] | [55.0, 54.0, 39.0] | [396, 395, 327] |
p03317 | u648901783 | 2,000 | 1,048,576 | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N. On this sequence, Snuke can perform the following operation: * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements. Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable. | ['N,K = map(int,input().split())\nA = list(map(int, input().split()))\n\nmin_ind = A.index(1)\n\n\nprint((N-1)//(K-1))', 'N,K = map(int,input().split())\nA = list(map(int, input().split()))\n\nmin_ind = A.index(1)\n\nprint(int((N-1)/(K-1)) if (N-1)%(K-1)==0 else (N-1)//(K-1)+1)'] | ['Wrong Answer', 'Accepted'] | ['s010290967', 's383180329'] | [13880.0, 14008.0] | [40.0, 42.0] | [110, 151] |
p03317 | u656487313 | 2,000 | 1,048,576 | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N. On this sequence, Snuke can perform the following operation: * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements. Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable. | ["\n\nN, K = map(int, input().split())\nA = [input().split()]\n\n# if N == K:\n# print(1)\n# elif N - K == 1:\n# print(2)\n# else:\n# print(N/K-1)\ni = 1\nwhile N-K > 0:\n N = N-K +1\n i = i+1\n print('Nの中身'+str(N))\n print('iの中身'+str(i))\n\nprint(i)\n\n\n # if N != K:\n \n \n # else:\n \n \n\n# if N == K:\n# print(1)\n# elif N - K <= N/2 :\n# print(2)\n# else:\n\n\n# 8 2\n# 5\n#\n# 8 3\n# 4\n#\n# 8 4\n# 3\n#\n# 8 5\n# 2\n#\n# 8 6\n# 2\n# 8 7\n\n# 7 2\n# 4\n#\n# 7 3\n#\n", '\n\nN, K = map(int, input().split())\nA = [input().split()]\ni = 1\nwhile N-K > 0:\n N = N-K +1\n i = i+1\n\nprint(i)\n\n\n # if N != K:\n \n \n # else:\n \n \n\n# if N == K:\n# print(1)\n# elif N - K <= N/2 :\n# print(2)\n# else:\n\n\n# 8 2\n# 5\n#\n# 8 3\n# 4\n#\n# 8 4\n# 3\n#\n# 8 5\n# 2\n#\n# 8 6\n# 2\n# 8 7\n\n# 7 2\n# 4\n#\n# 7 3\n#\n'] | ['Wrong Answer', 'Accepted'] | ['s830715842', 's201543811'] | [10736.0, 10420.0] | [125.0, 35.0] | [613, 461] |
p03317 | u657541767 | 2,000 | 1,048,576 | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N. On this sequence, Snuke can perform the following operation: * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements. Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable. | ['N, K = map(int, input().split())\nA = [int(x) for x in input().split()]\nminIndex = A.index(min(A))\nif K == len(A):\n print(1)\nelse:\n if K == 2:\n cnt1 = (minIndex+1) - 1\n cnt2 = (len(A)-minIndex) - 1\n else:\n cnt1 = (minIndex+1)//(K-1)\n cnt2 = (len(A)-minIndex)//(K-1)\n print(cnt1, cnt2)\n print(cnt1 + cnt2)\n', 'import math\nN, K = map(int, input().split())\nA = [int(x) for x in input().split()]\nminIndex = A.index(min(A))\nif K == len(A):\n print(1)\nelse:\n print(math.ceil((N-1)/(K-1)))\n'] | ['Wrong Answer', 'Accepted'] | ['s928373568', 's700996106'] | [13880.0, 13812.0] | [46.0, 45.0] | [348, 179] |
p03317 | u658113376 | 2,000 | 1,048,576 | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N. On this sequence, Snuke can perform the following operation: * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements. Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable. | ['Len, Split = map(int,input().split())\nNums = map(int,input().split())\nprint(Len/(Split-1))', 'Len, Split = map(int, input().split())\n_res = Len % Split\nif _res:\n print(int((Len / (Split - 1))) + 1)\nelse:\n print(int((Len / (Split - 1))))\n', 'Len, Split = map(int, input().split())\n_res = (Len - 1) % (Split - 1)\nif _res:\n res = int(((Len - 1) // (Split - 1)) + 1)\n print(res)\nelse:\n res = int((Len - 1) // (Split - 1))\n print(res)'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s512787989', 's935654816', 's314130301'] | [10420.0, 3060.0, 3060.0] | [27.0, 19.0, 17.0] | [90, 149, 200] |
p03317 | u665038048 | 2,000 | 1,048,576 | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N. On this sequence, Snuke can perform the following operation: * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements. Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable. | ['import statistics\n\n\ndef calculate_median(lst):\n lst.sort()\n median_right = lst[int(len(lst)/2)]\n median_left = lst[int(len(lst)/2)-1]\n return median_right, median_left\n\n\nN = int(input())\nX = list(map(int, input().split()))\nX_copy = X.copy()\nmedian_right, median_left = calculate_median(X)\nfor i in range(N):\n if X_copy[i] >= median_right:\n print(median_left)\n elif X_copy[i] < median_right:\n print(median_right)', 'def calculate_median(lst):\n lst.sort()\n median_right = lst[int(len(lst)/2)]\n median_left = lst[int(len(lst)/2)-1]\n return median_right, median_left\n\n\nN = int(input())\nX = list(map(int, input().split()))\nX_copy = X.copy()\nmedian_right, median_left = calculate_median(X)\nfor i in range(N):\n if X_copy[i] >= median_right:\n print(median_left)\n elif X_copy[i] < median_right:\n print(median_right)', 'from math import ceil\nn, k = map(int, input().split())\na = list(map(int, input().split()))\nprint(ceil((n-1)/(k-1)))'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s593664988', 's779462800', 's204526188'] | [5148.0, 3064.0, 13812.0] | [36.0, 18.0, 41.0] | [443, 423, 115] |
p03317 | u670180528 | 2,000 | 1,048,576 | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N. On this sequence, Snuke can perform the following operation: * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements. Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable. | ['n,k,*l=map(int,open(0).read().split());i=l.index(1);k-=1;print(i//k+(n-i-1)//k)', 'from math import*\nn,k=map(int,input().split())\nprint(ceil(~-n/~-k))'] | ['Wrong Answer', 'Accepted'] | ['s540262601', 's566541238'] | [13940.0, 3060.0] | [41.0, 18.0] | [79, 67] |
p03317 | u686036872 | 2,000 | 1,048,576 | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N. On this sequence, Snuke can perform the following operation: * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements. Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable. | ['N, K = map(int, input().split())\nA = list(map(int, input().split()))\n\nprint(1+(N-K)//(K-1))\n\ncnt = 1\nlength = K\nwhile True:\n if length >= N:\n print(cnt)\n break\n length += K-1 \n cnt += 1', 'N, K = map(int, input().split())\nA = list(map(int, input().split()))\n\ncnt = 1\nlength = K\nwhile True:\n if length >= N:\n print(cnt)\n break\n length += K-1 \n cnt += 1'] | ['Wrong Answer', 'Accepted'] | ['s428418637', 's749131708'] | [13880.0, 13880.0] | [48.0, 49.0] | [208, 185] |
p03317 | u686230543 | 2,000 | 1,048,576 | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N. On this sequence, Snuke can perform the following operation: * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements. Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable. | ['n, k = map(int, input().split())\nprint((n - 1) // (k - 1))', 'n, k = map(int, input().split())\nprint(1 + (n - 2) // (k - 1))'] | ['Wrong Answer', 'Accepted'] | ['s518134200', 's678772018'] | [3060.0, 3060.0] | [17.0, 17.0] | [58, 62] |
p03317 | u689322583 | 2,000 | 1,048,576 | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N. On this sequence, Snuke can perform the following operation: * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements. Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable. | ['#coding: utf-8\n \nN, K = map(int, input().split())\nA = list(map(int, input().split()))\n \nif(N==K):\n ans = 1\n \nprint(ans)', "N, K = list(map(int, input().strip().split(' ')))\nA = list(map(int, input().strip().split(' ')))\n\n\nmin_idx = A.index(min(A))\n\nif min_idx < K:\n min_idx = K - 1\n\n\nelif (N - 1 - min_idx) < K:\n min_idx = N - K\n\n\nelse:\n pass\n\nleft_step = min_idx //(K - 1)\nif(min_idx %(K - 1) != 0):\n left_step += 1\n\nright_step = (N - 1 - min_idx) // (K - 1)\nif((N - 1 - min_idx) % (K - 1) != 0):\n right_step += 1\n\nprint(left_step + right_step +1 )", '#coding: utf-8\n\nN, K = map(int, input().split())\nA = list(map(int, input().split()))\n\nfor i in range(N):\n if(A[i] == 1):\n one = i\n \n\nans = []\n\nfor i in range(K):\n start = one - (K - 1) + i\n end = one + i\n\n before = start\n after = N - (end+1)\n\n before_num = before//(K-1)\n if(before%(K-1) != 0):\n before_num += 1\n\n after_num = after//(K-1)\n if(after%(K-1) != 0):\n after_num += 1\n\n answer = before_num + after_num + 1\n ans.append(answer)\n\nprint(min(ans))'] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s329701400', 's778679471', 's753146911'] | [14004.0, 14008.0, 14008.0] | [40.0, 42.0, 168.0] | [122, 627, 544] |
p03317 | u689701565 | 2,000 | 1,048,576 | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N. On this sequence, Snuke can perform the following operation: * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements. Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable. | ['#coding: utf-8\n\ninputN, inputK = map(int, input().split())\ninputA = list(map(int, input().split()))\nminNumber = inputN\nminPos = 0\n\nfor i in range(len(inputA)):\n if inputA[i] < minNumber:\n minNumber = inputA[i]\n minPos = i\n\nsplitNumber = (inputN+1) / (inputK-1)\nprint (splitNumber)\n\n', '#coding: utf-8\n\ninputN, inputK = map(int, input().split())\ninputA = list(map(int, input().split()))\nminNumber = inputN\nminPos = 0\n\nif inputN == inputK:\n print (1)\nelif inputN <= (inputK-1)*10 + 1:\n for i in range(2, 11):\n if inputN <= (inputK - 1) * i + 1:\n print (i)\nelse:\n\n for i in range(len(inputA)):\n if inputA[i] < minNumber:\n minNumber = inputA[i]\n minPos = i\n\n splitNumber = (inputN + 1) / (inputK - 1)\n print (int(splitNumber))\n', '#coding: utf-8\n\ninputN, inputK = map(int, input().split())\ninputA = list(map(int, input().split()))\nminNumber = inputN\nminPos = 0\n\nif inputN == inputK:\n print (1)\nelse:\n\n if inputN > (inputK-1)*10 + 1:\n for i in range(len(inputA)):\n if inputA[i] < minNumber:\n minNumber = inputA[i]\n minPos = i\n\n splitNumber = (inputN + 1) / (inputK - 1)\n print (int(splitNumber))\n else:\n for i in range(2, 11):\n if inputN <= (inputK-1)*i + 1:\n print (i)\n\n', '#coding: utf-8\n\ninputN, inputK = map(int, input().split())\ninputA = list(map(int, input().split()))\nminNumber = inputN\nminPos = 0\n\nif inputN == inputK:\n print (1)\nelif inputN <= (inputK-1)*100000 + 1:\n for i in range(2, 100001):\n if inputN <= (inputK-1)*i + 1:\n print (i)\n break\nelse:\n\n for i in range(len(inputA)):\n if inputA[i] < minNumber:\n minNumber = inputA[i]\n minPos = i\n\n splitNumber = (inputN + 1) / (inputK - 1)\n print (int(splitNumber))\n'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s051169588', 's081155011', 's662030596', 's005445328'] | [14008.0, 14008.0, 14004.0, 14008.0] | [49.0, 47.0, 47.0, 46.0] | [299, 499, 543, 521] |
p03317 | u695079172 | 2,000 | 1,048,576 | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N. On this sequence, Snuke can perform the following operation: * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements. Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable. | ['n,k = map(int,input().split())\n\nlst = list(map(int,input().split()))\n\nid_one = lst.index(1)\nleft_length = len(lst[0:id_one])\n#print(left_length)\nright_length = len(lst[id_one:])-1\n#print(right_length)\n\ncounter = 0\nmn = min(left_length,right_length)\nmx = max(left_length,right_length)\n\nmx -= mn % (k-1)\n\nwhile mn > 0:\n counter += 1\n mn -= k-1\n\nmx -= mn % (k-1)\n\nwhile mx > 0:\n counter += 1\n mx -= k-1\n\n\n\n\nprint(counter)', '#n=6 k=4\n#\n# 3 1 2 4 5 6\n\n\nn,k = map(int,input().split())\nlst = list(map(int,input().split()))\n\nid_of_one = lst.index(1) \n\nleft = len(lst[0:id]) \nright = len(lst[id+1:]) \ntotal = left + right\n\namari = max(left%(k-1),right%(k-1))\ntotal -= amari\n\n\n\ncounter = 0\nwhile total > 0:\n counter += 1\n total -= k - 1\n\nprint(counter)', 'n,k = map(int,input().split())\n\nlst = list(map(int,input().split()))\n\nid_one = lst.index(1)\nleft_length = len(lst[0:id_one]-1)\nright_length = len(lst[id_one:]-1)\n\ncounter = 0\n\nif left_length > 0:\n left_length -= k\n counter += 1\n\nwhile left_length > 0:\n counter += 1\n left_length -= k-1\n\nif right_length > 0:\n counter += 1\n right_length -= k\n\nwhile right_length > 0:\n counter += 1\n right_length -= k-1\n\nprint(counter)', 'n,k = map(int,input().split())\n\nlst = list(map(int,input().split()))\n\nid_one = lst.index(1)\nleft_length = len(lst[0:id_one])\nprint(left_length)\nright_length = len(lst[id_one:])-1\nprint(right_length)\ncounter = 0\n\n\nif min(left_length,right_length) < k-1:\n if left_length < right_length:\n right_length -= left_length%(k-1)\n else:\n left_length -= right_length%(k-1)\n\n\nwhile left_length > 0:\n counter += 1\n left_length -= k-1\n\n\nwhile right_length > 0:\n counter += 1\n right_length -= k-1\n\nprint(counter)', 'n,k = map(int,input().split())\n\nlst = list(map(int,input().split()))\n\nid_one = lst.index(1)\nleft_length = len(lst[0:id_one])\n#print(left_length)\nright_length = len(lst[id_one:])-1\n#print(right_length)\n\ncounter = 0\nmn = min(left_length,right_length)\nmx = max(left_length,right_length)\ntotal = mn + mx\ntotal -= mn % (k-1)\n\nwhile total > 0:\n total -= k-1\n counter += 1\n\n\n\nprint(counter)', 'n,k = map(int,input().split())\nlst = list(map(int,input().split()))\n\nid_of_one = lst.index(1) \n\nleft = len(lst[0:id_of_one]) \nright = len(lst[id_of_one+1:]) \ntotal = left + right\n\namari = max(left%(k-1),right%(k-1))\ntotal -= amari\n\n\n\ncounter = 0\nwhile total > 0:\n counter += 1\n total -= k - 1\n\nprint(counter)', 'n,k = map(int,input().split())\nlst = list(map(int,input().split()))\n\nid_of_one = lst.index(1) \n\nleft = len(lst[0:id_of_one]) \nright = len(lst[id_of_one+1:]) \ntotal = left + right\n\n\n\n\n\ncounter = 0\nwhile total > 0:\n counter += 1\n total -= k - 1\n\nprint(counter)'] | ['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s031992923', 's065870159', 's582425438', 's662413869', 's732078030', 's883649202', 's152943234'] | [14008.0, 13880.0, 13880.0, 14008.0, 13880.0, 14008.0, 13812.0] | [50.0, 44.0, 42.0, 48.0, 50.0, 50.0, 48.0] | [431, 459, 441, 530, 390, 446, 396] |
p03317 | u698479721 | 2,000 | 1,048,576 | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N. On this sequence, Snuke can perform the following operation: * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements. Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable. | ['import sys\nN,K = map(int, input().split())\nlis = [int(i) for i in input().split()]\nif N == 1:\n print(1)\n sys.exit()\nind = lis.index(1)+1\npre = ind-1\npos = N-ind\nif pre%(K-1)==0:\n a = pre//(K-1)\nelse:\n a = pre//(K-1)+1\nif pos%(K-1)==0:\n b = pos//(K-1)\nelse:\n b = pos//(K-1)+1\nprint(1+a+b)', 'import sys\nN,K = map(int, input().split())\nlis = [int(i) for i in input().split()]\nif N == 1:\n print(1)\n sys.exit()\nind = lis.index(1)+1\nprint(ind)\npre = ind-1\npos = l-ind-1\nif pre%(K-1)==0:\n a = pre//(K-1)\nelse:\n a = pre//(K-1)+1\nif pos%(K-1)==0:\n b = pos//(K-1)\nelse:\n b = pos//(K-1)+1\nprint(1+a+b)', 'import sys\nN,K = map(int, input().split())\nlis = [int(i) for i in input().split()]\nif N == 1:\n print(0)\n sys.exit()\nif N<=K:\n print(1)\n sys.exit()\nind = lis.index(1)+1\nif (N-1)%(K-1)==0:\n print(int((N-1)/(K-1)))\nelse:\n print(int((N-1)//(K-1))+1)'] | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s122272621', 's778370147', 's406524363'] | [13812.0, 13880.0, 13880.0] | [44.0, 45.0, 47.0] | [293, 306, 251] |
p03317 | u716043626 | 2,000 | 1,048,576 | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N. On this sequence, Snuke can perform the following operation: * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements. Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable. | ['import math\nn, k = map(int,input().split())\na = list(map(int,input().split()))\nprint(math.ceil(n-1)/(k-1))', 'import math\nn, k = map(int,input().split())\na = list(map(int,input().split()))\nprint(math.ceil((n-1)/(k-1)))'] | ['Wrong Answer', 'Accepted'] | ['s508648458', 's195305435'] | [13812.0, 13812.0] | [39.0, 39.0] | [106, 108] |
p03317 | u723590269 | 2,000 | 1,048,576 | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N. On this sequence, Snuke can perform the following operation: * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements. Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable. | ['def function(n,k,a):\n ind1 = a.index(1)\n pre = len(a[:ind1])\n ex = len(a[ind1:]) \n ans = -(-pre//(k-1)) + -(-ex//(k-1))\n if n == k:\n ans = 1\n return int(ans)\n\nprint(function(n,k,a))', 'n,k = map(int,input().split())\na = list(map(int,input().split()))\n\nans = -(-(n-1)//(k-1))\n\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s900269496', 's259401704'] | [3060.0, 13812.0] | [17.0, 39.0] | [209, 101] |
p03317 | u731368968 | 2,000 | 1,048,576 | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N. On this sequence, Snuke can perform the following operation: * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements. Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable. | ['n,k=map(int, input().split())\na=map(int, input().split())\nprint(N-K+1)', 'n, k = map(int, input().split())\na = list(map(int, input().split()))\nans = 0\nfor i in range(1, n, k - 1):\n ans += 1\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s136275984', 's311609979'] | [10420.0, 14004.0] | [26.0, 45.0] | [70, 129] |
p03317 | u734816542 | 2,000 | 1,048,576 | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N. On this sequence, Snuke can perform the following operation: * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements. Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable. | ['import math\nn, m = map(int, input().split())\ns = map(int, input().split())\nprint(math.ceil(m-1/2))', 'import math\nn, m = map(int, input().split())\ns = map(int, input().split())\nprint(math.ceil((n-1)/(m-1)))\n'] | ['Wrong Answer', 'Accepted'] | ['s019372906', 's306954853'] | [10420.0, 10420.0] | [25.0, 26.0] | [98, 105] |
p03317 | u738835924 | 2,000 | 1,048,576 | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N. On this sequence, Snuke can perform the following operation: * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements. Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable. | ['N, k = map(int, input().split())\nnum = input().rstrip().split()\n\nt = 0\n\nfor i in range(N):\n if num[i] == "1":\n one = i\n break\n \nleft = one\nright = N - one - 1\n\nif left + right + 1 <= k:\n t = 1\n left=0\n right=0\n \nelif left <= k - 1:\n left = 0\n right -= (k - 1) - left - 1\n t += 1\n \nelif right <= k - 1:\n right = 0\n left -= (k - 1) - right - 1\n t+=1\n\n\nwhile(right > 0):\n right -= (k-1)\n t += 1\n\nwhile(left > 0):\n left -= (k-1)\n t += 1\n\n\nprint(t)', 'N, k = map(int, input().split())\nnum = input().rstrip().split()\n\nt = 0\n\nfor i in range(N):\n if num[i] == "1":\n one = i\n break\n \nleft = one\nright = N - one - 1\n\nif left + right + 1 <= k:\n t = 1\n left=0\n right=0\n \nelif left < k - 1:\n left = 0\n right -= (k - 1) - left\n t += 1\n \nelif right < k - 1:\n right = 0\n left -= (k - 1) - right\n t+=1\n\n\nwhile(right > 0):\n right -= (k-1)\n t += 1\n\nwhile(left > 0):\n left -= (k-1)\n t += 1\n\n\nprint(t)', 'N, k = map(int, input().split())\nnum = input().rstrip().split()\n\nt = 0\n\nfor i in range(N):\n if num[i] == "1":\n one = i\n break\n \nleft = one\nright = N - one - 1\n\nif N == k:\n t = 1\n left=0\n right=0\n \nelif left < k - 1:\n left = 0\n right -= (k - 1) - left\n t += 1\n \nelif right < k - 1:\n right = 0\n left -= (k - 1) - right\n t+=1\n\n\nwhile(right > 0):\n right -= (k-1)\n t += 1\n\nwhile(left > 0):\n left -= (k-1)\n t += 1\n\n\nprint(t)', 'N, k = map(int, input().split())\nnum = input().rstrip().split()\n\nt = 0\n\nfor i in range(N):\n if num[i] == "1":\n one = i\n break\n \nN -= 1\n\n\nwhile(N > 0):\n N -= (k-1)\n t += 1\n\n\n\nprint(t)'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s420815303', 's641144206', 's737243648', 's262900634'] | [10420.0, 10420.0, 10420.0, 9848.0] | [35.0, 37.0, 35.0, 35.0] | [468, 458, 443, 194] |
p03317 | u747602774 | 2,000 | 1,048,576 | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N. On this sequence, Snuke can perform the following operation: * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements. Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable. | ['N,K = map(int,input().split())\nA = list(map(int,input().split()))\nind = A.index(1)\nans = (ind+K-2)//(K-1)+(N-1-ind+K-2)//(K-1)\nif (ind+K-2)%(K-1)+(N-1-ind+K-2)%(K-1) <= K-1:\n ans -= 1\nprint(ans)\n', 'N,K=map(int,input().split())\nprint((N-2)//(K-1))', 'N,K=map(int,input().split())\nprint((N-2)//(K-1)+1)'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s548421882', 's563314528', 's025699480'] | [13880.0, 2940.0, 2940.0] | [40.0, 17.0, 17.0] | [199, 48, 50] |
p03317 | u762420987 | 2,000 | 1,048,576 | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N. On this sequence, Snuke can perform the following operation: * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements. Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable. | ['N, K = map(int, input().split())\nAlist = list(map(int, input().split()))\nsplit_index = Alist.index(1)\nleft_l, right_l = split_index, N - split_index - 1\nprint(left_l, right_l)\nif N <= K:\n print(1)\nelse:\n print(left_l // (K - 1) + int(left_l % (K - 1) != 0) + right_l // (K - 1) + int(right_l % (K - 1) != 0))\n', 'N, K = map(int, input().split())\nAlist = list(map(int, input().split()))\nprint((N - 1) // (K - 1) + int((N - 1) % (K - 1) != 0))\n'] | ['Wrong Answer', 'Accepted'] | ['s686175905', 's082353851'] | [13880.0, 14004.0] | [41.0, 40.0] | [315, 129] |
p03317 | u764956288 | 2,000 | 1,048,576 | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N. On this sequence, Snuke can perform the following operation: * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements. Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable. | ['n, k = map(int, input().split())\nAs = list(map(int, input().split()))\n\nidx = As.index(i)\nleft = idx\nright = n - idx - 1\n\nn_l = (left + k - 1) // (k - 1)\nn_r = (right + k - 1) // (k - 1)\n\nprint(n_l + n_r)', 'n, k = map(int, input().split())\nAs = list(map(int, input().split()))\n\nidx = As.index(min(As))\nleft = idx\n\nn_l = (left + k - 2) // (k - 1)\n\nright = n - ((n_l) * (k-1)) - 1\n\nn_r = (right + k - 2) // (k - 1)\n\nprint(n_l + n_r)'] | ['Runtime Error', 'Accepted'] | ['s992684918', 's137640326'] | [13880.0, 14008.0] | [40.0, 43.0] | [203, 223] |
p03317 | u770077083 | 2,000 | 1,048,576 | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N. On this sequence, Snuke can perform the following operation: * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements. Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable. | ['n, k = map(int, input().split())\na = list(map(int, input().split()))\nmin_idx = a.index(1)\nmin_count = n\nfor i in range(min_idx-2, min_idx+3):\n if 0 <= i < n - 2:\n s_idx = l_idx = min_idx\n if s_idx > 0: s_idx = i\n if l_idx < n: l_idx = i + 2\n print("Start: {}..{}".format(s_idx, l_idx))\n count = 1\n while s_idx > 0:\n s_idx -= 2\n count += 1\n print("s_idx: {}..{}".format(s_idx, l_idx))\n while l_idx < n - 1:\n l_idx += 2\n count += 1\n print("l_idx: {}..{}".format(s_idx, l_idx))\n if min_count > count: min_count = count\nprint(min_count)', 'from math import ceil\nn, k = map(int, input().split())\nprint(ceil((n-1)/(k-1)))'] | ['Wrong Answer', 'Accepted'] | ['s327093579', 's230316917'] | [13812.0, 3060.0] | [369.0, 17.0] | [657, 79] |
p03317 | u774160580 | 2,000 | 1,048,576 | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N. On this sequence, Snuke can perform the following operation: * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements. Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable. | ['N, K = list(map(int, input().split()))\nA = [int(a) for a in input().split()]\nprint((N - 1 + K - 2) / (K - 1))\n', 'N, K = list(map(int, input().split()))\nA = [int(a) for a in input().split()]\nprint((N - 2) // (K - 1) + 1)\n'] | ['Wrong Answer', 'Accepted'] | ['s026579963', 's400791318'] | [13880.0, 13880.0] | [45.0, 44.0] | [110, 107] |
p03317 | u780698286 | 2,000 | 1,048,576 | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N. On this sequence, Snuke can perform the following operation: * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements. Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable. | ['n, k = map(int, input().split())\na = list(map(int, input().split()))\nans = (n-1)/(k-1)\nif ans % 1 == 0:\n print(int(ans))\nelse:\n print(ans // 1 + 1)', 'from math import ceil\nn, k = map(int, input().split())\na = list(map(int, input().split()))\nprint(ceil((n-1)/(k-1)))'] | ['Wrong Answer', 'Accepted'] | ['s169831397', 's716302043'] | [20500.0, 20496.0] | [50.0, 54.0] | [162, 115] |
p03317 | u781262926 | 2,000 | 1,048,576 | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N. On this sequence, Snuke can perform the following operation: * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements. Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable. | ['import sys\nfrom math import ceil\ninputs = sys.stdin.readlines()\n\nn, k = map(int, inputs[0].split())\nA = list(map(int, inputs[1].split()))\n\nif n == k:\n print(1)\nelse:\n former = index_min(A)[0]\n latter = n - 1 - former\n ceil(former / (k-1)), ceil(latter / (k-1))\n print(ceil(former / (k-1)) + ceil(latter / (k-1)))', 'import sys\nfrom math import ceil\ninputs = sys.stdin.readlines()\n\nn, k = map(int, inputs[0].split())\nA = list(map(int, inputs[1].split()))\n\nif n == k:\n print(1)\nelse:\n former = index_min(A)[0]\n latter = n - 1 - former\n ceil(former / (k-1)), ceil(latter / (k-1))\n print(ceil(former / (k-1)) + ceil(latter / (k-1)))', 'import sys\nfrom math import ceil\ninputs = sys.stdin.readlines()\n\nn, k = map(int, inputs[0].split())\nA = list(map(int, inputs[1].split()))\n\nprint(ceil((n-k)/(k-1))+1)'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s011051748', 's160415129', 's354485533'] | [13992.0, 13992.0, 13992.0] | [39.0, 40.0, 40.0] | [327, 327, 165] |
p03317 | u790301364 | 2,000 | 1,048,576 | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N. On this sequence, Snuke can perform the following operation: * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements. Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable. | ["import math\ndef main15():\n strbuf1 = input('');\n strbuf2 = input('');\n strbufs1 = strbuf1.split();\n strbufs2 = strbuf2.split();\n buf1 = [];\n buf2 = [];\n ba = 0;\n for i in range(2):\n buf1.append(int(strbufs1[i]));\n for i in range(buf1[0]):\n buf2.append(int(strbufs2[i]));\n if(buf2[i] == 1):\n ba = i;\n break;\n are = buf1[1] - 1;\n kai1 = ceil(ba/are);\n kk = ba - are * kai1;\n kai2 = ceil((buf1[0] -(ba+1+kk))/are)\n print(int(kai1+kai2));\n\ndef main16():\n strbuf = input('');\n num = int(strbuf);\n kazu = 0;\n number = 1;\n while(kazu<num):\n\n\n kazu = kazu + 1;\n\n number = number + 1;\n\n\nif __name__ == '__main__':\n main15()", "def main15():\n strbuf1 = input('');\n strbuf2 = input('');\n strbufs1 = strbuf1.split();\n strbufs2 = strbuf2.split();\n buf1 = [];\n buf2 = [];\n ba = 0;\n for i in range(2):\n buf1.append(int(strbufs1[i]));\n for i in range(buf1[0]):\n buf2.append(int(strbufs2[i]));\n if(buf2[i] == 1):\n ba = i;\n break;\n are = buf1[1] - 1;\n kai1 = math.ceil(ba/are);\n kk = ba - are * kai1;\n kai2 = math.ceil((buf1[0] -(ba+1+kk))/are)\n print(int(kai1+kai2));\n\ndef main16():\n strbuf = input('');\n num = int(strbuf);\n kazu = 0;\n number = 1;\n while(kazu<num):\n\n\n kazu = kazu + 1;\n\n number = number + 1;\n\n\nif __name__ == '__main__':\n main15()", "import math\ndef main15():\n strbuf1 = input('');\n strbuf2 = input('');\n strbufs1 = strbuf1.split();\n strbufs2 = strbuf2.split();\n buf1 = [];\n buf2 = [];\n ba = 0;\n for i in range(2):\n buf1.append(int(strbufs1[i]));\n for i in range(buf1[0]):\n buf2.append(int(strbufs2[i]));\n if(buf2[i] == 1):\n ba = i;\n break;\n are = buf1[1] - 1;\n kai1 = math.ceil(ba/are);\n kk = are * kai1 - ba;\n kai2 = math.ceil((buf1[0] -(ba+1+kk))/are)\n print(int(kai1+kai2));\n\ndef main16():\n strbuf = input('');\n num = int(strbuf);\n kazu = 0;\n number = 1;\n while(kazu<num):\n\n\n kazu = kazu + 1;\n\n number = number + 1;\n\n\nif __name__ == '__main__':\n main15()"] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s564001698', 's669282150', 's859248504'] | [12724.0, 12792.0, 12724.0] | [50.0, 50.0, 50.0] | [731, 729, 741] |
p03317 | u794652722 | 2,000 | 1,048,576 | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N. On this sequence, Snuke can perform the following operation: * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements. Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable. | ['import math\n\nN,K = map(int,input().split())\nA = list(map(int,input().split()))\n\nprint(math.floor((N-1)/(K-1)))\n', 'import math\n\nN,K = map(int,input().split())\nA = list(map(int,input().split()))\n\nprint(math.ceil((N-1)/(K-1)))\n'] | ['Wrong Answer', 'Accepted'] | ['s551429310', 's916353997'] | [13812.0, 13812.0] | [41.0, 39.0] | [111, 110] |
p03317 | u799065076 | 2,000 | 1,048,576 | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N. On this sequence, Snuke can perform the following operation: * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements. Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable. | ['def f(m,n):\n ret=m/n\n ret_=int(ret)\n if ret_==ret:\n return ret_\n else:\n return ret_+1\n \nN,K=list(map(int,input().split()))\na=np.array(list(map(int,input().split())))\nprint(f(np.sum(a!=min(a)),K-1))', 'import numpy as np\n\ndef f(m,n):\n ret=m/n\n ret_=int(ret)\n if ret_==ret:\n return ret_\n else:\n return ret_+1\n \nN,K=list(map(int,input().split()))\na=np.array(list(map(int,input().split())))\nprint(f(np.sum(a!=min(a)),K-1))'] | ['Runtime Error', 'Accepted'] | ['s420703572', 's159437345'] | [3060.0, 23972.0] | [18.0, 299.0] | [228, 248] |
p03317 | u801359367 | 2,000 | 1,048,576 | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N. On this sequence, Snuke can perform the following operation: * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements. Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable. | ['A,B = map(int,input().split())\nprint(math.ceil((A-B)/(B-1))+1)', 'A,B = list(map(int,input().split()))\n_ =input()\nprint(math.ceil((A-B)/(B-1))+1)', 'A,B = list(map(int,input().split()))\nprint(math.ceil((A-B)/(B-1))+1)', 'import math\nA,B = list(map(int,input().split()))\n_ =input()\nprint(math.ceil((A-B)/(B-1))+1)'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s110679846', 's314585460', 's486719057', 's090870638'] | [3060.0, 4724.0, 3060.0, 4724.0] | [18.0, 18.0, 18.0, 19.0] | [62, 79, 68, 91] |
p03317 | u809108154 | 2,000 | 1,048,576 | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N. On this sequence, Snuke can perform the following operation: * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements. Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable. | ['n, k=map(int,input().split())\na=list(map(int,input().split()))\nprint((n-1)//(k-1))', 'n,k=map(int,input().split())\na=(n-1)/(k-1)\nif a!=int(a):\n print(int(a)+1)\nelse:\n print(int(a))'] | ['Wrong Answer', 'Accepted'] | ['s513907709', 's101133828'] | [13880.0, 3060.0] | [40.0, 17.0] | [82, 100] |
p03317 | u814271993 | 2,000 | 1,048,576 | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N. On this sequence, Snuke can perform the following operation: * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements. Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable. | ['a,b=map(int, input().split())\nc=list(map(int, input().split()))\nd -= 1\nprint(a//d)', 'import math\nn, k = map(int,input().split())\ninput()\nprint(math.ceil((n-1)/(k-1)))'] | ['Runtime Error', 'Accepted'] | ['s788442096', 's707451446'] | [20284.0, 10140.0] | [46.0, 32.0] | [82, 81] |
p03317 | u814986259 | 2,000 | 1,048,576 | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N. On this sequence, Snuke can perform the following operation: * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements. Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable. | ['N,K=map(int,input().split())\nimport math\nA=int(input().split())\nans=1\nans+=math.ceil(N-K)/(K-1)\nprint(ans)', 'N,K=map(int,input().split())\nimport math\nA=list(map(int,input().split()))\nans=1\nans+=math.ceil(N-K)/(K-1)\nprint(ans)', 'N,K=map(int,input().split())\nimport math\nA=list(map(int,input().split()))\nans=1\nans+=math.ceil((N-K)/(K-1))\nprint(ans)'] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s715315299', 's731285070', 's786601805'] | [10420.0, 13812.0, 13812.0] | [24.0, 40.0, 40.0] | [106, 116, 118] |
p03317 | u818213347 | 2,000 | 1,048,576 | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N. On this sequence, Snuke can perform the following operation: * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements. Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable. | ['n,k = map(int,input().split())\nA = list(map(int,input.split()))\n\nif (n-1)%%(k-1) == 0:\n print(n-1/k-1)\nelse:\n print((n-1//k-1)+1)\n \n\n\n\n\n', 'n,k = map(int,input().split())\nA = list(map(int,input().split()))\n\nprint(-((1-n)//(k-1)))\n'] | ['Runtime Error', 'Accepted'] | ['s684719558', 's533505009'] | [9016.0, 20512.0] | [22.0, 48.0] | [139, 90] |
p03317 | u820560680 | 2,000 | 1,048,576 | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N. On this sequence, Snuke can perform the following operation: * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements. Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable. | ['N, K = map(int, input().split())\nA = list(map(int, input().split()))\ndef kiriage(a, b): \n return (a + b - 1) // b\n\nprint(kiriage((N - 1, K - 1)))\n', 'N, K = map(int, input().split())\nA = list(map(int, input().split()))\ndef kiriage(a, b): \n return (a + b - 1) // b\n\nprint(kiriage(N - 1, K - 1))\n'] | ['Runtime Error', 'Accepted'] | ['s451834286', 's043263259'] | [14008.0, 14008.0] | [41.0, 42.0] | [162, 160] |
p03317 | u826929627 | 2,000 | 1,048,576 | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N. On this sequence, Snuke can perform the following operation: * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements. Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable. | ['N,K = map(int,input().split())\nA = list(map(int,input().split()))\n\ninf = 10 ** 18\n\nfor i in range(1,inf):\n N -= (K - 1)a\n if N <= 1:\n print(i)\n break\n ', 'N,K = map(int,input().split())\nA = list(map(int,input().split()))\n\ninf = 10 ** 18\n\nfor i in range(1,inf):\n N -= (K - 1)\n if N <= 1:\n print(i)\n break\n '] | ['Runtime Error', 'Accepted'] | ['s960454637', 's758983287'] | [2940.0, 13880.0] | [17.0, 46.0] | [160, 159] |
p03317 | u842964692 | 2,000 | 1,048,576 | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N. On this sequence, Snuke can perform the following operation: * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements. Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable. | ['N,K=map(int,input().split())\nA=list(map(int,input.split()))\n\nans=1\nX=N-K\n\nwhile X>0:\n X-=K-1\n ans+=1\nprint(ans)', 'N,K=map(int,input().split())\nA=list(map(int,input().split()))\n\nans=1\nX=N-K\n\nwhile X>0:\n X-=K-1\n ans+=1\nprint(ans)\n'] | ['Runtime Error', 'Accepted'] | ['s048989666', 's536940709'] | [3060.0, 13880.0] | [17.0, 46.0] | [113, 116] |
p03317 | u853010060 | 2,000 | 1,048,576 | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N. On this sequence, Snuke can perform the following operation: * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements. Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable. | ['N, K = map(int, input().split())\nA = [int(x) for x in input().split()]\nans = 1\nif N == K:\n print(1)\n exit()\nelse:\n if (N-K+1)%K == 0:\n ans += N-K+1\n else:\n ans += (N-K+1)%K+1\nprint(ans)\n', 'N, K = map(int, input().split())\nA = [int(x) for x in input().split()]\nans = 1\nn = (N-K)//(K-1)\nans += n\nif N-K-n*(K-1) > 0:\n ans += 1\nprint(ans)\n'] | ['Wrong Answer', 'Accepted'] | ['s762258562', 's071831370'] | [13880.0, 13880.0] | [44.0, 44.0] | [212, 149] |
p03317 | u853900545 | 2,000 | 1,048,576 | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N. On this sequence, Snuke can perform the following operation: * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements. Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable. | ['import math\nn,k = map(int,input().split())\na = list(map(int,input().split()))\nprint(math.floor((n-1)/(k-1)))\n', 'import math\nn,k = map(int,input().split())\na = list(map(int,input().split()))\nprint(math.floor((n-1)//(k-1)))\n', 'n,k = map(int,input().split())\na = list(map(int,input().split()))\nprint((n-1)//(k-1))', 'import math\nn,k = map(int,input().split())\na = list(map(int,input().split()))\nprint(math.ceil((n-1)/(k-1)))\n'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s267169236', 's708604471', 's709064984', 's254658288'] | [13812.0, 13812.0, 13880.0, 13812.0] | [43.0, 41.0, 40.0, 39.0] | [109, 110, 85, 108] |
p03317 | u855380359 | 2,000 | 1,048,576 | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N. On this sequence, Snuke can perform the following operation: * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements. Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable. | ['n, k = map(int, input().split())\na = list(map(int, input().split()))\n\nif (n-k)%(k-1) ==0:\n print((n-k)//(k-1)+1)\nelse:\n print((n-k)//(k-1)+3)\n ', 'n, k = map(int, input().split())\na = list(map(int, input().split()))\n\nx = n//(k-1) + 1\nprint(x)', 'n, k = map(int, input().split())\na = list(map(int, input().split()))\n\nif (n-k)%(k-1) == 0:\n print((n-k)//(k-1)+1)\nelse:\n print((n-k)//(k-1)+2)'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s178150974', 's312467118', 's795240021'] | [13880.0, 13880.0, 13880.0] | [43.0, 40.0, 40.0] | [146, 95, 144] |
p03317 | u857070771 | 2,000 | 1,048,576 | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N. On this sequence, Snuke can perform the following operation: * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements. Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable. | ['n,k=map(int,input().split())\n*a,=map(int,input().split())\nprint(((n-2)//(k-1)+1)', 'n,k=map(int,input().split())\n*a,=map(int,input().split())\nprint((n-2)//(k-1)+1)'] | ['Runtime Error', 'Accepted'] | ['s600794962', 's552600057'] | [2940.0, 13880.0] | [17.0, 40.0] | [80, 79] |
p03317 | u858523893 | 2,000 | 1,048,576 | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N. On this sequence, Snuke can perform the following operation: * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements. Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable. | ['N, K = map(int, input().split())\na = list(map(int, input().split()))\n\namin = min(a)\n\nif len(myarr) == myarr.count(amin) :\n print("0")\nelse :\n if K == 1 : \n print(N - myarr.count(amin))\n else :\n if (N - a.count(amin)) % (K - 1) == 0 :\n print((N - a.count(amin)) // (K - 1))\n else :\n print((N - a.count(amin)) // (K - 1) + 1)', 'N, K = map(int, input().split())\na = list(map(int, input().split()))\n\namin = min(a)\n\nif len(myarr) == myarr.count(amin) :\n print("0")\nelse :\n if K == 1 : \n print(N - myarr.count(amin))\n else :\n if (N - a.count(amin)) % (K - 1) == 0 :\n print((N - a.count(amin)) // (K - 1))\n else :\n print((N - a.count(amin)) // (K - 1) + 1)', 'N, K = map(int, input().split())\na = list(map(int, input().split()))\n\namin = min(a)\n\nif len(a) == a.count(amin) :\n print("0")\nelse :\n if K == 1 : \n print(N - a.count(amin))\n else :\n if (N - a.count(amin)) % (K - 1) == 0 :\n print((N - a.count(amin)) // (K - 1))\n else :\n print((N - a.count(amin)) // (K - 1) + 1)'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s026481427', 's489593910', 's237792433'] | [13812.0, 14008.0, 14008.0] | [42.0, 43.0, 46.0] | [375, 375, 363] |
p03317 | u867826040 | 2,000 | 1,048,576 | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N. On this sequence, Snuke can perform the following operation: * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements. Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable. | ['//#define _GLIBCXX_DEBUG\n//\n#include <bits/stdc++.h>\nusing namespace std;\ntypedef long long ll;\n\nint main() {\n cin.tie(0);\n ios::sync_with_stdio(false);\n int n,k; cin >> n >> k;\n int a[n]; for (int i = 0; i<n; i++) cin >> a[i];\n cout << (((n-k)+(k-2))/(k-1))+1 << "\\n";\n}', '//#define _GLIBCXX_DEBUG\n//\n#include <bits/stdc++.h>\nusing namespace std;\ntypedef long long ll;\n\nint main() {\n cin.tie(0);\n ios::sync_with_stdio(false);\n int n,k; cin >> n >> k;\n int a[n];\n cout << (((n-k)+(k-2))/(k-1))+1 << "\\n";\n}', 'import math\n\nn,k = map(int,input().split())\na = list(map(int,input().split()))\nprint(math.ceil((n-1)/(k-1)))\n'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s636876510', 's933652427', 's901820705'] | [8768.0, 9000.0, 20312.0] | [21.0, 25.0, 50.0] | [337, 298, 109] |
p03317 | u868600519 | 2,000 | 1,048,576 | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N. On this sequence, Snuke can perform the following operation: * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements. Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable. | ['N, K = map(int, input().split())\nA = list(map(int, input().split()))\n\nprint(ceil((N - 1) / (K - 1)))\n', 'from math import ceil\n\nN, K = map(int, input().split())\nA = list(map(int, input().split()))\n\nprint(ceil((N - 1) / (K - 1)))\n'] | ['Runtime Error', 'Accepted'] | ['s958047974', 's734135688'] | [14004.0, 13812.0] | [40.0, 43.0] | [101, 124] |
p03317 | u875855656 | 2,000 | 1,048,576 | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N. On this sequence, Snuke can perform the following operation: * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements. Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable. | ['n,k=map(int,input().split())\nl=[int(i) for i in input().split()]\nc=0\nmn=min(l)\nwhile len(l)>=1:\n if mn==min(l):\n m=l.index(min(l))\n if m==0:\n l=l[m+1:]\n elif m+l[k-1::-1].index(min(l))==len(l):\n c+=m//(k-1)\n if m%(k-1)!=0:\n c+=1\n l=l[m+1:]\n else:\n c+=1\n l=l[k:]\n else:\n c+=len(l)//(k-1)\n if len(l)%(k-1)!=0:\n c+=1\n l=[]', 'n,k=map(int,input().split())\nl=[int(i) for i in input().split()]\nc=0\nmn=min(l)\nwhile len(l)>=1:\n if mn==min(l):\n m=l.index(min(l))\n if m!=0:\n if l[:k].count(mn)==1:\n c+=m//(k-1)\n if m%(k-1)!=0:\n c+=1\n l=l[m+1:]\n else:\n c+=1\n l=l[k:]\n else:\n l=l[m+1:]\n else:\n print("start",l)\n print(m,len(l)//(k-1),len(l)%(k-1))\n c+=len(l)//(k-1)\n if len(l)%(k-1)!=0:\n c+=1\n l=[]\nprint(c)', 'n,k=map(int,input().split())\nl=[int(i) for i in input().split()]\nc=0\nr=0\nmn=min(l)\nwhile len(l)>=1:\n if mn==min(l):\n m=l.index(mn)\n if m==0:\n l=l[1:]\n if not mn in l[:k]:\n r+=1\n l=l[k:]\n else:\n c+=(r*k+m)//(k-1)\n if (r*k+m)%(k-1)!=0:\n c+=1\n l=l[m:]\n r=0\n else:\n c+=(r*k+len(l))//(k-1)\n if (r*k+len(l))%(k-1)!=0:\n c+=1\n l=[]\nprint(c)', 'n,k=map(int,input().split())\na=list(map(int,input().split()))\ng=1\nwhile k+(k-1)*(g-1)< n:\n g+=1\nprint(g)'] | ['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s073016063', 's117117754', 's896775114', 's943186746'] | [13880.0, 13812.0, 13880.0, 14008.0] | [52.0, 2104.0, 2104.0, 50.0] | [384, 462, 402, 105] |
p03317 | u902151549 | 2,000 | 1,048,576 | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N. On this sequence, Snuke can perform the following operation: * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements. Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable. | ['# coding: utf-8\nimport re\nimport math\nfrom collections import defaultdict\nfrom collections import deque\nfrom fractions import Fraction\nimport itertools\nfrom copy import deepcopy\nimport random\nimport time\nimport os\nimport queue\nimport sys\nimport datetime\nfrom functools import lru_cache\n#@lru_cache(maxsize=None)\nreadline=sys.stdin.readline\nsys.setrecursionlimit(2000000)\n#import numpy as np\nalphabet="abcdefghijklmnopqrstuvwxyz"\nmod=int(10**9+7)\ninf=int(10**20)\ndef yn(b):\n if b:\n print("yes")\n else:\n print("no")\ndef Yn(b):\n if b:\n print("Yes")\n else:\n print("No")\ndef YN(b):\n if b:\n print("YES")\n else:\n print("NO")\nclass union_find():\n def __init__(self,n):\n self.n=n\n self.P=[a for a in range(N)]\n self.rank=[0]*n\n \n def find(self,x):\n if(x!=self.P[x]):self.P[x]=self.find(self.P[x])\n return self.P[x]\n \n def same(self,x,y):\n return self.find(x)==self.find(y)\n \n def link(self,x,y):\n if self.rank[x]<self.rank[y]:\n self.P[x]=y\n elif self.rank[y]<self.rank[x]:\n self.P[y]=x\n else:\n self.P[x]=y\n self.rank[y]+=1\n \n def unite(self,x,y):\n self.link(self.find(x),self.find(y))\n \n def size(self):\n S=set()\n for a in range(self.n):\n S.add(self.find(a))\n return len(S)\ndef is_pow(a,b):\n now=b\n while now<a:\n now*=b\n if now==a:return True\n else:return False\ndef getbin(num,size):\n A=[0]*size\n for a in range(size):\n if (num>>(size-a-1))&1==1:\n A[a]=1\n else:\n A[a]=0\n return A\ndef get_facs(n,mod_=0):\n A=[1]*(n+1)\n for a in range(2,len(A)):\n A[a]=A[a-1]*a\n if(mod_>0):A[a]%=mod_\n return A\ndef comb(n,r,mod,fac):\n if(n-r<0):return 0\n return (fac[n]*pow(fac[n-r],mod-2,mod)*pow(fac[r],mod-2,mod))%mod\ndef next_comb(num,size):\n x=num&(-num)\n y=num+x\n z=num&(~y)\n z//=x\n z=z>>1\n num=(y|z)\n if(num>=(1<<size)):return False\n else:return num\ndef get_primes(n,type="int"):\n if n==0:\n if type=="int":return []\n else:return [False]\n A=[True]*(n+1)\n A[0]=False\n A[1]=False\n for a in range(2,n+1):\n if A[a]:\n for b in range(a*2,n+1,a):\n A[b]=False\n if(type=="bool"):return A\n B=[]\n for a in range(n+1):\n if(A[a]):B.append(a)\n return B\ndef is_prime(num):\n if(num<=1):return False\n i=2\n while i*i<=num:\n if(num%i==0):return False\n i+=1\n return True\ndef ifelse(a,b,c):\n if a:return b\n else:return c\ndef join(A,c=""):\n n=len(A)\n A=list(map(str,A))\n s=""\n for a in range(n):\n s+=A[a]\n if(a<n-1):s+=c\n return s\ndef factorize(n,type_="dict"):\n b = 2\n list_ = []\n while b * b <= n:\n while n % b == 0:\n n //= b\n list_.append(b)\n b+=1\n if n > 1:list_.append(n)\n if type_=="dict":\n dic={}\n for a in list_:\n if a in dic:\n dic[a]+=1\n else:\n dic[a]=1\n return dic\n elif type_=="list":\n return list_\n else:\n return None\ndef pm(x):\n return x//abs(x)\ndef inputintlist():\n return list(map(int,input().split()))\n######################################################################################################\ndef main():\n N,K=inputintlist()\n A=inputintlist()\n K-=1\n ans=N//K\n if N%K!=1:ans+=1\n print(ans)\nmain()\n', '# coding: utf-8\nimport re\nimport math\nfrom collections import defaultdict\nfrom collections import deque\nfrom fractions import Fraction\nimport itertools\nfrom copy import deepcopy\nimport random\nimport time\nimport os\nimport queue\nimport sys\nimport datetime\nfrom functools import lru_cache\n#@lru_cache(maxsize=None)\nreadline=sys.stdin.readline\nsys.setrecursionlimit(2000000)\n#import numpy as np\nalphabet="abcdefghijklmnopqrstuvwxyz"\nmod=int(10**9+7)\ninf=int(10**20)\ndef yn(b):\n if b:\n print("yes")\n else:\n print("no")\ndef Yn(b):\n if b:\n print("Yes")\n else:\n print("No")\ndef YN(b):\n if b:\n print("YES")\n else:\n print("NO")\nclass union_find():\n def __init__(self,n):\n self.n=n\n self.P=[a for a in range(N)]\n self.rank=[0]*n\n \n def find(self,x):\n if(x!=self.P[x]):self.P[x]=self.find(self.P[x])\n return self.P[x]\n \n def same(self,x,y):\n return self.find(x)==self.find(y)\n \n def link(self,x,y):\n if self.rank[x]<self.rank[y]:\n self.P[x]=y\n elif self.rank[y]<self.rank[x]:\n self.P[y]=x\n else:\n self.P[x]=y\n self.rank[y]+=1\n \n def unite(self,x,y):\n self.link(self.find(x),self.find(y))\n \n def size(self):\n S=set()\n for a in range(self.n):\n S.add(self.find(a))\n return len(S)\ndef is_pow(a,b):\n now=b\n while now<a:\n now*=b\n if now==a:return True\n else:return False\ndef getbin(num,size):\n A=[0]*size\n for a in range(size):\n if (num>>(size-a-1))&1==1:\n A[a]=1\n else:\n A[a]=0\n return A\ndef get_facs(n,mod_=0):\n A=[1]*(n+1)\n for a in range(2,len(A)):\n A[a]=A[a-1]*a\n if(mod_>0):A[a]%=mod_\n return A\ndef comb(n,r,mod,fac):\n if(n-r<0):return 0\n return (fac[n]*pow(fac[n-r],mod-2,mod)*pow(fac[r],mod-2,mod))%mod\ndef next_comb(num,size):\n x=num&(-num)\n y=num+x\n z=num&(~y)\n z//=x\n z=z>>1\n num=(y|z)\n if(num>=(1<<size)):return False\n else:return num\ndef get_primes(n,type="int"):\n if n==0:\n if type=="int":return []\n else:return [False]\n A=[True]*(n+1)\n A[0]=False\n A[1]=False\n for a in range(2,n+1):\n if A[a]:\n for b in range(a*2,n+1,a):\n A[b]=False\n if(type=="bool"):return A\n B=[]\n for a in range(n+1):\n if(A[a]):B.append(a)\n return B\ndef is_prime(num):\n if(num<=1):return False\n i=2\n while i*i<=num:\n if(num%i==0):return False\n i+=1\n return True\ndef ifelse(a,b,c):\n if a:return b\n else:return c\ndef join(A,c=""):\n n=len(A)\n A=list(map(str,A))\n s=""\n for a in range(n):\n s+=A[a]\n if(a<n-1):s+=c\n return s\ndef factorize(n,type_="dict"):\n b = 2\n list_ = []\n while b * b <= n:\n while n % b == 0:\n n //= b\n list_.append(b)\n b+=1\n if n > 1:list_.append(n)\n if type_=="dict":\n dic={}\n for a in list_:\n if a in dic:\n dic[a]+=1\n else:\n dic[a]=1\n return dic\n elif type_=="list":\n return list_\n else:\n return None\ndef pm(x):\n return x//abs(x)\ndef inputintlist():\n return list(map(int,input().split()))\n######################################################################################################\ndef main():\n N,K=inputintlist()\n A=inputintlist()\n N-=1\n K-=1\n ans=(N+K-1)//K\n print(ans)\nmain()\n'] | ['Wrong Answer', 'Accepted'] | ['s877191477', 's277757179'] | [17120.0, 17120.0] | [66.0, 63.0] | [3551, 3545] |
p03317 | u905582793 | 2,000 | 1,048,576 | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N. On this sequence, Snuke can perform the following operation: * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements. Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable. | ['N,K = map(int, input().split())\nA = list(map(int, input().split()))\nprint((N-1)//(K-1))', 'N,K = map(int, input().split())\nA = list(map(int, input().split()))\nprint((N-1+K-1-1)//(K-1))'] | ['Wrong Answer', 'Accepted'] | ['s280308641', 's847479129'] | [14008.0, 14004.0] | [41.0, 41.0] | [87, 93] |
p03317 | u906428167 | 2,000 | 1,048,576 | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N. On this sequence, Snuke can perform the following operation: * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements. Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable. | ['n,k = map(int,input().split())\n\nif n == k:\n print(1)\nelse:\n c = 1\n a = n-k\n while a > 0:\n c = +1\n a -= k-1\n print(c)', 'n,k = map(int,input().split())\n\nif n == k:\n print(1)\nelse:\n c = 1\n a = n-k\n while a > 0:\n c += 1\n a -= k-1\n print(c)'] | ['Wrong Answer', 'Accepted'] | ['s297062099', 's203352246'] | [3060.0, 3060.0] | [23.0, 27.0] | [127, 127] |
p03317 | u908349502 | 2,000 | 1,048,576 | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N. On this sequence, Snuke can perform the following operation: * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements. Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable. | ['n, k = map(int,input().split())\na = list(map(int,input().split()))\nplace = 0\nfor i in range(n):\n if a[i] == 1:\n place = i+1\n\nl = (place-1)//(k-1) if (place-1)%(k-1)==0 else (place-1)//(k-1)+1\na = k-1-(place-1)%(k-1)\nr = (n-place)//(k-1) if (n-place)%(k-1)==0 else (n-place)//(k-1)+1\na += k-1-(n-place)%(k-1)\n\nif a < k-1:\n print(l+r)\nelse:\n print(l+r-a//(k-1))', 'n, k = map(int,input().split())\na = list(map(int,input().split()))\nc = 0 if (n-1)%(k-1)==0 else 1\nans = (n-1)//(k-1) + c\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s253697516', 's773818294'] | [14008.0, 13880.0] | [49.0, 40.0] | [365, 131] |
p03317 | u909991537 | 2,000 | 1,048,576 | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N. On this sequence, Snuke can perform the following operation: * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements. Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable. | ['import numpy as np\nimport math\n\nn, k = (int(i) for i in input().split()) \nx_list = [int(i) for i in input().split()] \n\nmin_num = min(x_list)\ngroup_list = []\n\ncount = 0\nfor x in x_list:\n if x == min_num:\n group_list.append(count)\n count = 0\n continue\n count += 1\n\nif x != min_num:\n group_list.append(count)\nprint(group_list)\nans = 0\nfor count in group_list:\n ans += math.ceil(count / (k - 1))\n \nprint(ans)\n \n \n \n\n', 'import math\nn, k = (int(i) for i in input().split()) \nprint(math.ceil((n-1)/(k-1)))'] | ['Wrong Answer', 'Accepted'] | ['s255619226', 's190708715'] | [23424.0, 3060.0] | [188.0, 18.0] | [432, 84] |
p03317 | u918601425 | 2,000 | 1,048,576 | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N. On this sequence, Snuke can perform the following operation: * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements. Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable. | ['N,K=[int(s) for s in input().split()]\nls=[int(s) for s in input().split()]\ndef ceil(n,m):\n if n%m==0:\n return n//m\n else:\n return (n//m)+1\na=ls.index(1)\nif K==N:\n print(1)\nelif (K==N-1 and (a==0 or a==N-1)):\n print(1):\nelse:\n print(ceil(a,K-1)+ceil(N-a-1,K-1))\n\n\n', 'N,K=[int(s) for s in input().split()]\nprint((N+K-3)//(K-1))'] | ['Runtime Error', 'Accepted'] | ['s375540825', 's066389590'] | [2940.0, 3060.0] | [17.0, 17.0] | [274, 59] |
p03317 | u924406834 | 2,000 | 1,048,576 | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N. On this sequence, Snuke can perform the following operation: * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements. Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable. | ['N,K = map(int,input().split())\nA = list(map(int,input().split()))\nprint((N-K)//(K-1)+1)', 'n,k = map(int,input().split())\na = list(map(int,input().split()))\nif (n - 1) % (k - 1) == 0:\n print((n-1) // (k-1))\nelse:\n print((n-1) // (k-1) + 1)'] | ['Wrong Answer', 'Accepted'] | ['s066613397', 's367596588'] | [14008.0, 13880.0] | [40.0, 39.0] | [87, 150] |
p03317 | u928758473 | 2,000 | 1,048,576 | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N. On this sequence, Snuke can perform the following operation: * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements. Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable. | ['import os\nimport sys\nfrom collections import defaultdict, Counter\nfrom itertools import product, permutations,combinations, accumulate\nfrom operator import itemgetter\nfrom bisect import bisect_left,bisect\nfrom heapq import heappop,heappush,heapify\nfrom math import ceil, floor, sqrt\nfrom copy import deepcopy\n\ndef main():\n n,k = map(int, input().split())\n a_list = list(map(int, input().split()))\n if n == k:\n print(1)\n else:\n print(ceil(n/k) + 1)\n\nif __name__ == "__main__":\n main()', 'import os\nimport sys\nfrom collections import defaultdict, Counter\nfrom itertools import product, permutations,combinations, accumulate\nfrom operator import itemgetter\nfrom bisect import bisect_left,bisect\nfrom heapq import heappop,heappush,heapify\nfrom math import ceil, floor, sqrt\nfrom copy import deepcopy\n\ndef main():\n n,k = map(int, input().split())\n a_list = list(map(int, input().split()))\n print(ceil((n-1)/(k-1)))\n\nif __name__ == "__main__":\n main()'] | ['Wrong Answer', 'Accepted'] | ['s396610199', 's226868266'] | [14516.0, 14324.0] | [46.0, 44.0] | [512, 470] |
p03317 | u928784113 | 2,000 | 1,048,576 | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N. On this sequence, Snuke can perform the following operation: * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements. Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable. | ['N,K = list(map(int,input().split()))\nA = list(map(int,input().split()))\n\nprint((N-1) // (K-1))', 'N,K = map(int,input().split())\nA = list(map(int,input().split()))\n\nfor i in range(1,10**5+1):\n if i >= (N-K)/(K-1) + 1:\n print(i)\n exit()'] | ['Wrong Answer', 'Accepted'] | ['s333283942', 's586103915'] | [14004.0, 14004.0] | [42.0, 54.0] | [94, 154] |
p03317 | u933341648 | 2,000 | 1,048,576 | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N. On this sequence, Snuke can perform the following operation: * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements. Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable. | ['n, k = map(int, input().split())\na = input()\n\nprint((n-1)//(k-1))', 'n, k = map(int, input().split())\na = input()\n\nprint((n-1)//(k-1) if n > k else 1)', 'n, k = map(int, input().split())\na = input()\n\nprint(((n-1)+(k-2))//(k-1))'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s171247338', 's257840580', 's330084578'] | [4724.0, 4724.0, 4724.0] | [18.0, 18.0, 18.0] | [65, 81, 73] |
p03317 | u934246119 | 2,000 | 1,048,576 | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N. On this sequence, Snuke can perform the following operation: * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements. Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable. | ['n, k = map(int, input().split())\na_tmp = input().split()\na = [[] for i in range(n)]\nfor i in range(n):\n a[i] = int(a_tmp[i])\nif n != k:\na1 = a.index(1)\nsol = 0\na_left = a1\na_right = len(a)-1-a1\nif a_left % (k-1) == 0:\n sol += int(a_left / (k-1))\nelse:\n sol += int(a_left / (k-1)) + 1\nif a_right % (k-1) == 0:\n sol += int(a_right / (k-1))\nelse:\n sol += int(a_right / (k-1)) + 1\n\nif sol != 0:\n print(sol)\nelse:\n print(1)\n', 'n, k = map(int, input().split())\na_tmp = input().split()\na = [[] for i in range(n)]\nfor i in range(n):\n a[i] = int(a_tmp[i])\na1 = a.index(1)\nif a1 < k or n-1-k < a1:\n if n-k+1 % k == 0:\n sol = (n-k+1) / k + 1\n else:\n sol = (n-k+1) / k + 2\n print(sol)\nelse:\n sol = 0\n a_left = a1\n a_right = len(a)-1-a1\n if a_left % (k-1) == 0:\n sol += int(a_left / (k-1))\n else:\n sol += int(a_left / (k-1)) + 1\n if a_right % (k-1) == 0:\n sol += int(a_right / (k-1))\n else:\n sol += int(a_right / (k-1)) + 1\n print(sol)\n', '\nn, k = map(int, input().split())\na_tmp = input().split()\na = []\nfor _ in a_tmp:\n a.append(int(_))\ng = 1\nwhile n > (k + (k-1)*(g-1)):\n g += 1\nprint(g)\n'] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s795154265', 's872365436', 's576560862'] | [2940.0, 17208.0, 13812.0] | [17.0, 75.0, 63.0] | [440, 579, 225] |
p03317 | u940102677 | 2,000 | 1,048,576 | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N. On this sequence, Snuke can perform the following operation: * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements. Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable. | ['n,k = map(int,input().split())\nprint((n-1)//(k-1))', 'n,k = map(int,input().split())\nprint((n-1)//(k-1) + ((n-1)%(k-1) > 0))'] | ['Wrong Answer', 'Accepted'] | ['s448569741', 's296719545'] | [2940.0, 3060.0] | [19.0, 17.0] | [50, 70] |
p03317 | u941434715 | 2,000 | 1,048,576 | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N. On this sequence, Snuke can perform the following operation: * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements. Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable. | ['#coding: utf-8\nimport math\nimport heapq\nimport bisect\nimport numpy as np\nfrom collections import Counter\n#from scipy.misc import comb\n\nN,K = map(int, input().split())\nA = list(map(int, input().split()))\n\nans = math.floor((N-1)/(K-1))\nprint(ans)', '#coding: utf-8\nimport math\nimport heapq\nimport bisect\nimport numpy as np\nfrom collections import Counter\n#from scipy.misc import comb\n\nN,K = map(int, input().split())\nA = list(map(int, input().split()))\n\nans = math.ceil((N-1)/(K-1))\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s049573053', 's889230662'] | [23464.0, 23464.0] | [173.0, 172.0] | [244, 243] |
p03317 | u941489790 | 2,000 | 1,048,576 | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N. On this sequence, Snuke can perform the following operation: * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements. Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable. | ['import math\n\nN,K=list(map(int, input().split()))\nA=list(map(int, input().split()))\n\nif(N!=K):\n print(math.ceil(N/(K-1)))\nelse if((N+1)/K==2):\n print(2)\nelse:\n print(1)', 'import math\n\nN,K=list(map(int, input().split()))\nA=list(map(int, input().split()))\n\n\nprint(math.ceil((N-1)/(K-1)))'] | ['Runtime Error', 'Accepted'] | ['s743992103', 's584198895'] | [2940.0, 13812.0] | [18.0, 39.0] | [176, 114] |
p03317 | u941753895 | 2,000 | 1,048,576 | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N. On this sequence, Snuke can perform the following operation: * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements. Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable. | ['import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time\n\nsys.setrecursionlimit(10**7)\ninf=10**20\nmod=10**9+7\n\ndef LI(): return list(map(int,input().split()))\ndef I(): return int(input())\ndef LS(): return input().split()\ndef S(): return input()\n\ndef main():\n a,b=LI()\n l=LI()\n\n return -(-(a-1)//b)\n\nprint(main())\n', 'import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time\n\nsys.setrecursionlimit(10**7)\ninf=10**20\nmod=10**9+7\n\ndef LI(): return list(map(int,input().split()))\ndef I(): return int(input())\ndef LS(): return input().split()\ndef S(): return input()\n\ndef main():\n n,k=LI()\n l=LI()\n\n c=1\n n-=k\n\n while True:\n if n<=0:\n break\n\n n-=(k-1)\n c+=1\n\n return c\n\nprint(main())\n'] | ['Wrong Answer', 'Accepted'] | ['s940060006', 's006227057'] | [16300.0, 16296.0] | [97.0, 68.0] | [348, 414] |
p03317 | u957722693 | 2,000 | 1,048,576 | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N. On this sequence, Snuke can perform the following operation: * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements. Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable. | ['import numpy\nn,r=map(int,input().split())\nl=list(map(int,input().split()))\nkey=l.index(1)\nans=numpy.ceil((1+key)/r)+numpy.ceil((n-key+2)/r)\nprint(int(ans))', 'import numpy\nn,r=map(int,input().split())\nl=list(map(int,input().split()))\nans=numpy.ceil((n-1)/(r-1))\nprint(int(ans))'] | ['Wrong Answer', 'Accepted'] | ['s972982433', 's899381284'] | [25860.0, 26280.0] | [336.0, 352.0] | [155, 118] |
p03317 | u970899068 | 2,000 | 1,048,576 | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N. On this sequence, Snuke can perform the following operation: * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements. Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable. | ['import numpy as np\nn,k=map(int, input().split())\na=list(map(int, input().split()))\n\n\nprint(-(-(n-1))//(k-1))', 'n,k=map(int, input().split())\na=list(map(int, input().split()))\n \nprint(-(-(n-1)//(k-1)))\n'] | ['Wrong Answer', 'Accepted'] | ['s902419216', 's834946617'] | [23364.0, 13880.0] | [172.0, 39.0] | [108, 90] |
p03317 | u977193988 | 2,000 | 1,048,576 | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N. On this sequence, Snuke can perform the following operation: * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements. Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable. | ['import math\nn.k=map(int,input().split())\nA=[int(i) for i in input().split()]\nprint(math.ceil(n/k))\n', 'import math\nn,k=map(int,input().split())\nA=[int(i) for i in input().split()]\nprint(1+math.ceil((n-k)/(k-1)))\n'] | ['Runtime Error', 'Accepted'] | ['s677833020', 's212615310'] | [2940.0, 13812.0] | [17.0, 43.0] | [99, 109] |
p03317 | u978313283 | 2,000 | 1,048,576 | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N. On this sequence, Snuke can perform the following operation: * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements. Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable. | ['N,K=map(int,input().split())\nA=list(map(int,input().split())) \nprint((N-K)//(K-1)+1+0 if (N-K)%(K-1)==0 else 1)\n', 'N,K=map(int,input().split())\nA=list(map(int,input().split()))\nprint((N-K)%2+2)', 'N,K=map(int,input().split())\nA=list(map(int,input().split())) \nprint((N-K)//(K-1) + 1 if (N-K)%(K-1)==0 else (N-K)//(K-1) + 2 )\n'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s156992202', 's634886053', 's197973373'] | [13880.0, 13812.0, 14008.0] | [41.0, 41.0, 41.0] | [112, 78, 128] |
p03317 | u979823197 | 2,000 | 1,048,576 | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N. On this sequence, Snuke can perform the following operation: * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements. Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable. | ['n,k =int(x) for x in input().split()\ns = list(int(y) for y in input().split())\ndef min(a):\n min = 1000000\n for i in range(len(a)):\n if min > a[i]:\n min = a[i]\n index = i\n return index\nc = min(s)\nnum = (c-1)//k + (len(s)-c)//k +2\nprint(num)\n\n\n \n', 'nk=list(map(int, input().split()))\na=list(map(int, input().split()))\nn=nk[0]\nk=nk[1]\ndef min(A):\n min=1000000\n for x in range(len(A)):\n if A[x]<=min:\n min=A[x]\n return min\nm=0\nfor i in range(n):\n if a[i]==1:\n m=i\nl=[]\nif n<=k:\n l.append(1)\nelse:\n for j in range(k):\n if j<k-1:\n l.append(100000)\n elif j>=k-1 and j%(k-1)==0 and (n-j-1)%(k-1)==0:\n l.append(j//(k-1)+(n-j-1)//(k-1))\n elif j>=k-1 and j%(k-1)!=0 and (n-j-1)%(k-1)!=0:\n l.append(j//(k-1)+1+(n-j-1)//(k-1)+1)\n elif j>=k-1 and j%(k-1)!=0 and (n-j-1)%(k-1)==0:\n l.append(j//(k-1)+1+(n-j-1)//(k-1))\n elif j>=k-1 and j%(k-1)==0 and (n-j-1)%(k-1)!=0:\n l.append(j//(k-1)+(n-j-1)//(k-1)+1)\nprint(min(l))'] | ['Runtime Error', 'Accepted'] | ['s632458071', 's836950787'] | [2940.0, 14008.0] | [17.0, 60.0] | [265, 713] |
p03317 | u982591663 | 2,000 | 1,048,576 | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N. On this sequence, Snuke can perform the following operation: * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements. Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable. | ['N, K = map(int, input().split())\nA = list(map(int, input().split()))\nans = 0\n \nassert K > 3\n \nprint(114514)', 'N, K = map(int, input().split())\nA = list(map(int, input().split()))\nans = 0\n \nassert K > 50\n \nprint(114514)', 'N, K = map(int, input().split())\nA = list(map(int, input().split()))\nans = 0\n \nassert K > 10\n \nprint(114514)', 'N, K = map(int, input().split())\nA = list(map(int, input().split()))\nans = 0\n \nassert K == 3\n \nprint(114514)', 'N, K = map(int, input().split())\nA = list(map(int, input().split()))\nans = 0\n\nassert K > 100\n\nprint(114514)', 'N, K = map(int, input().split())\nA = list(map(int, input().split()))\nans = 0\n \nassert K > 5\n \nprint(114514)', 'import math\n\nN, K = map(int, input().split())\nA = list(map(int, input().split()))\nans = 0\n\nif N == K:\n print(1)\n quit()\nelse:\n one_index = A.index(1)\n l = one_index \n r = N - one_index - 1 \n\n assert l % 3 == 0\n \n print(114514)', 'N, K = map(int, input().split())\nA = list(map(int, input().split()))\nans = 0\n \nassert K > 2\n \nprint(114514)', 'import math\n \nN, K = map(int, input().split())\nA = list(map(int, input().split()))\nans = 0\n \nif N == K:\n print(1)\n quit()\nelse:\n one_index = A.index(1)\n l = one_index \n r = N - one_index - 1 \n \n assert N % 3 == 0', 'import math\n\nN, K = map(int, input().split())\nA = list(map(int, input().split()))\nans = 0\n\nif N == K:\n print(1)\n quit()\nelse:\n one_index = A.index(1)\n l = one_index \n r = N - one_index - 1 \n\n assert r % 3 == 0\n \n print(114514)\n', 'import math\n\nN, K = map(int, input().split())\nA = list(map(int, input().split()))\nans = 0\n\nif N == K:\n print(1)\n quit()\nelse:\n one_index = A.index(1)\n l = one_index \n r = N - one_index - 1 \n\n assert r % 3 == 1\n \n print(114514)\n', 'N, K = map(int, input().split())\nA = list(map(int, input().split()))\nans = 0\n \nassert K == 3\nassert N < 100\n \nprint(114514)', 'import math\n\nN, K = map(int, input().split())\nA = list(map(int, input().split()))\nans = 0\n\nif N == K:\n print(1)\n quit()\nelse:\n one_index = A.index(1)\n l = one_index \n r = N - one_index - 1 \n\n assert l < r\n\n print(114514)\n', 'import math\n\nN, K = map(int, input().split())\nA = list(map(int, input().split()))\nans = 0\n\nleast_g = (N-1) / (K-1)\n\nif least_g.is_integer():\n print(int(least_g))\nelse:\n print(int(least_g)+1)\n'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s108766785', 's142684268', 's191421264', 's304110009', 's393111895', 's557771900', 's591866059', 's621356754', 's627909190', 's628063926', 's800271102', 's814552338', 's997467242', 's952200623'] | [14008.0, 13880.0, 14008.0, 13880.0, 13880.0, 13880.0, 13812.0, 13812.0, 13812.0, 13812.0, 13812.0, 14008.0, 13812.0, 13812.0] | [40.0, 41.0, 41.0, 41.0, 39.0, 43.0, 41.0, 40.0, 41.0, 42.0, 41.0, 41.0, 41.0, 41.0] | [107, 108, 108, 108, 107, 107, 314, 107, 294, 315, 315, 123, 306, 197] |
p03317 | u983967747 | 2,000 | 1,048,576 | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N. On this sequence, Snuke can perform the following operation: * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements. Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable. | ["import sys\n\n\ndef solve(n, k, as):\n if (n-1)%(k-1)==0:\n return (n-1)/(k-1)\n else:\n return round((n-1)/(k-1))\n\n\ndef readQuestion():\n line = sys.stdin.readline().rstrip()\n [str_n, str_k] = line.split(' ')\n line = sys.stdin.readline().rstrip()\n as = line.split(' ')\n return (int(str_n), int(str_k), [int(a) for a in as])\n\ndef main():\n n, k, as = readQuestion()\n answer = solve(n, k, as)\n print(answer)\n \nif __name__ == '__main__':\n main()", "import sys\n\n\ndef solve(n, k, as1):\n if (n-1)%(k-1)==0:\n return (n-1)//(k-1)\n else:\n return (n-1)//(k-1)+1\n\n\ndef readQuestion():\n line = sys.stdin.readline().rstrip()\n [str_n, str_k] = line.split(' ')\n line = sys.stdin.readline().rstrip()\n as1 = line.split(' ')\n return (int(str_n), int(str_k), [int(a) for a in as1])\n\ndef main():\n n, k, as1 = readQuestion()\n answer = solve(n, k, as1)\n print(answer)\n \nif __name__ == '__main__':\n main()"] | ['Runtime Error', 'Accepted'] | ['s926559260', 's287862031'] | [2940.0, 14900.0] | [17.0, 43.0] | [645, 647] |
p03317 | u992519990 | 2,000 | 1,048,576 | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N. On this sequence, Snuke can perform the following operation: * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements. Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable. | ['import math\nN,K = map(int,input().split())\na = list(map(int,input().split()))\nprint(N,K)\nprint(math.ceil((N-1)/(K-1)))', 'import math\nN,K = map(int,input().split())\na = list(map(int,input().split()))\nprint(math.ceil((N-1)/(K-1)))'] | ['Wrong Answer', 'Accepted'] | ['s314410654', 's308789463'] | [13812.0, 13812.0] | [40.0, 40.0] | [118, 107] |
p03318 | u007550226 | 2,000 | 1,048,576 | Let S(n) denote the sum of the digits in the decimal notation of n. For example, S(123) = 1 + 2 + 3 = 6. We will call an integer n a **Snuke number** when, for all positive integers m such that m > n, \frac{n}{S(n)} \leq \frac{m}{S(m)} holds. Given an integer K, list the K smallest Snuke numbers. | ['import heapq\ndef sk(k):\n tempk = k\n ret = 0\n while tempk!=0:\n ret+=tempk%10\n tempk//=10\n return ret\nk= int(input())\nansl = []\nheapq.heapify(ansl)\nmmin = 99999999.0\nfor i in range(1,3*k+1):\n if i%10==0:pass\n else:\n temp = i/sk(i)\n heapq.heappush(ansl,(temp,i))\n mmin = min(mmin,temp)\nneedcalc=0\ni=1\nwhile len(ansl)!=0:\n tempa = heapq.heappop(ansl)\n print(i,tempa[1])\n if i==k:break\n i+=1', "def sk(k):\n tk = k\n ret = 0\n while tk!=0:\n ret+=tk%10\n tk//=10\n return ret\nan = []\nfor i in range(1,100):\n tp = i/sk(i)\n if len(an)==0:an.append((i,tp))\n else:\n ls=an[-1]\n if ls[1]>tp:an[-1]=(i,tp)\n else:an.append((i,tp))\nfor j in range(15):\n for i in range(100,1000):\n ns=str(i)+''.join(['9']*j)\n nm=int(ns)\n tp=nm/sk(nm)\n if an[-1][1] > tp:\n while an[-1][1]>tp:\n an.pop()\n an.append((nm,tp))\nfor i in range(int(input())):print(an[i][0])"] | ['Wrong Answer', 'Accepted'] | ['s641732994', 's505753054'] | [9388.0, 9056.0] | [28.0, 56.0] | [451, 558] |
p03318 | u121921603 | 2,000 | 1,048,576 | Let S(n) denote the sum of the digits in the decimal notation of n. For example, S(123) = 1 + 2 + 3 = 6. We will call an integer n a **Snuke number** when, for all positive integers m such that m > n, \frac{n}{S(n)} \leq \frac{m}{S(m)} holds. Given an integer K, list the K smallest Snuke numbers. | ['m=float("INF")\nsunukes=[]\nfor i in range(15,-1,-1):\n for j in range(100,10,-1):\n #print(i,j)\n sunuke=j*(10**i)-1\n s=str(sunuke)\n sn=0\n for k in range(len(s)):\n sn+=int(s[k])\n x=sunuke/sn\n #print(sn,x,i,j,j*10**i-1)\n if x<=m :\n m=x\n sunukes.append(sunuke)\nfor i in range(9,0,-1):\n sunukes.append(i)\nk=int(input())\n\nprint(sunukes[-k])\n', 'm=float("INF")\nsunukes=[]\nfor i in range(7,-1,-1):\n for j in range(1000,10,-1):\n #print(i,j)\n sunuke=j*(100**i)-1\n s=str(sunuke)\n sn=0\n for k in range(len(s)):\n sn+=int(s[k])\n x=sunuke/sn\n \n if x<=m :\n m=x\n sunukes.append(sunuke)\nfor i in range(9,0,-1):\n sunukes.append(i)\nsunukes=sunukes[::-1]\nk=int(input())\n\nfor i in range(k):\n print(sunukes[i])'] | ['Wrong Answer', 'Accepted'] | ['s361261858', 's069909017'] | [3060.0, 3188.0] | [23.0, 51.0] | [443, 477] |
p03318 | u160244242 | 2,000 | 1,048,576 | Let S(n) denote the sum of the digits in the decimal notation of n. For example, S(123) = 1 + 2 + 3 = 6. We will call an integer n a **Snuke number** when, for all positive integers m such that m > n, \frac{n}{S(n)} \leq \frac{m}{S(m)} holds. Given an integer K, list the K smallest Snuke numbers. | ["k = int(input())\n\ndef func(a):\n s = 0\n for i in str(a):\n s += int(i)\n return a/s\n\ncandidate_lst = []\nfor i in range(18):\n for j in range(1, 150):\n candidate_lst.append(int(str(j) + '9' * i))\ncandidate_lst = sorted(candidate_lst)\n\ncount = 0\nindex = -1\nsnuke = 1\nwhile count < k:\n min_snuke = 10**100\n for m, i in enumerate(candidate_lst[index+1:]):\n if i > 100*snuke:\n break\n po_snuke = func(i)\n if min_snuke > po_snuke:\n min_snuke = po_snuke\n next_snuke = i\n next_index = m\n print(next_snuke)\n snuke = next_snuke\n index = index + next_index + 2\n count += 1 ", "k = int(input())\n\ndef func(a):\n s = 0\n for i in str(a):\n s += int(i)\n return a/s\n\ncandidate_lst = []\nfor i in range(18):\n for j in range(1, 150):\n candidate_lst.append(int(str(j) + '9' * i))\ncandidate_lst = sorted(list(set(candidate_lst)))\n\ncount = 0\nindex = -1\nsnuke = 1\nwhile count < k:\n min_snuke = 10**100\n for m, i in enumerate(candidate_lst[index+1:]):\n if i > 100*snuke:\n break\n po_snuke = func(i)\n if min_snuke > po_snuke:\n min_snuke = po_snuke\n next_snuke = i\n next_index = m\n print(next_snuke)\n snuke = next_snuke\n index = index + next_index + 1\n count += 1 "] | ['Wrong Answer', 'Accepted'] | ['s775653137', 's501263967'] | [3188.0, 3312.0] | [688.0, 584.0] | [676, 687] |
p03318 | u163320134 | 2,000 | 1,048,576 | Let S(n) denote the sum of the digits in the decimal notation of n. For example, S(123) = 1 + 2 + 3 = 6. We will call an integer n a **Snuke number** when, for all positive integers m such that m > n, \frac{n}{S(n)} \leq \frac{m}{S(m)} holds. Given an integer K, list the K smallest Snuke numbers. | ["k=int(input())\nans=[]\nfor i in range(1,10): \n ans.append(str(i))\n \nfor i in range(1,10): \n ans.append(str(i)+'9')\n \nfor i in range(1,10): \n ans.append(str(i)+'99')\n \nfor i in range(10): \n ans.append('1'+str(i)+'99')\nfor i in range(2,10): \n ans.append(str(i)+'999')\n \nfor i in range(1,3): \n for j in range(10):\n ans.append(str(i)+str(j)+'999')\nfor i in range(3,10): \n ans.append(str(i)+'9999')\n \nfor i in range(1,4): \n for j in range(10):\n ans.append(str(i)+str(j)+'9999')\nfor i in range(4,10): \n ans.append(str(i)+'99999')\n \nfor i in range(1,5): \n for j in range(10):\n ans.append(str(i)+str(j)+'99999')\nfor i in range(5,10): \n ans.append(str(i)+'999999')\n\nfor i in range(1,6): \n for j in range(10):\n ans.append(str(i)+str(j)+'999999')\nfor i in range(6,10): \n ans.append(str(i)+'9999999')\n \nfor i in range(1,7): \n for j in range(10):\n ans.append(str(i)+str(j)+'9999999')\nfor i in range(7,10): \n ans.append(str(i)+'99999999')\n\nfor i in range(1,8): \n for j in range(10):\n ans.append(str(i)+str(j)+'99999999')\nfor i in range(8,10): \n ans.append(str(i)+'999999999')\n\nfor i in range(1,9): \n for j in range(10):\n ans.append(str(i)+str(j)+'999999999')\nfor i in range(9,10): \n ans.append(str(i)+'9999999999')\n \nfor i in range(1,10): \n for j in range(10):\n ans.append(str(i)+str(j)+'9999999999')\nfor i in range(10,10): \n ans.append(str(i)+'99999999999')\n\nfor i in range(1,10): \n for j in range(10):\n ans.append(str(i)+str(j)+'99999999999')\nfor i in range(10,10): \n ans.append(str(i)+'999999999999')\n \nfor i in range(1,10): \n for j in range(10):\n ans.append(str(i)+str(j)+'999999999999')\nfor i in range(10,10): \n ans.append(str(i)+'9999999999999')\n\nfor i in range(10): \n ans.append('10'+str(i)+'999999999999')\nfor i in range(1,10): \n ans.append('1'+str(i)+'9999999999999')\nfor i in range(2,10): \n for j in range(10):\n ans.append(str(i)+str(j)+'99999999999999')\n \nfor val in ans[300:k]:\n print(val)\n", "k=int(input())\nans=[]\nfor i in range(1,10): \n ans.append(str(i))\n \nfor i in range(1,10): \n ans.append(str(i)+'9')\n \nfor i in range(1,10): \n ans.append(str(i)+'99')\n \nfor i in range(10): \n ans.append('1'+str(i)+'99')\nfor i in range(2,10): \n ans.append(str(i)+'999')\n \nfor i in range(1,3): \n for j in range(10):\n ans.append(str(i)+str(j)+'999')\nfor i in range(3,10): \n ans.append(str(i)+'9999')\n \nfor i in range(1,4): \n for j in range(10):\n ans.append(str(i)+str(j)+'9999')\nfor i in range(4,10): \n ans.append(str(i)+'99999')\n \nfor i in range(1,5): \n for j in range(10):\n ans.append(str(i)+str(j)+'99999')\nfor i in range(5,10): \n ans.append(str(i)+'999999')\n\nfor i in range(1,6): \n for j in range(10):\n ans.append(str(i)+str(j)+'999999')\nfor i in range(6,10): \n ans.append(str(i)+'9999999')\n \nfor i in range(1,7): \n for j in range(10):\n ans.append(str(i)+str(j)+'9999999')\nfor i in range(7,10): \n ans.append(str(i)+'99999999')\n\nfor i in range(1,8): \n for j in range(10):\n ans.append(str(i)+str(j)+'99999999')\nfor i in range(8,10): \n ans.append(str(i)+'999999999')\n\nfor i in range(1,9): \n for j in range(10):\n ans.append(str(i)+str(j)+'999999999')\nfor i in range(9,10): \n ans.append(str(i)+'9999999999')\n \nfor i in range(1,10): \n for j in range(10):\n ans.append(str(i)+str(j)+'9999999999')\nfor i in range(10,10): \n ans.append(str(i)+'99999999999')\n\nfor i in range(1,10): \n for j in range(10):\n ans.append(str(i)+str(j)+'99999999999')\nfor i in range(10,10): \n ans.append(str(i)+'999999999999')\n \nfor i in range(1,10): \n for j in range(10):\n ans.append(str(i)+str(j)+'999999999999')\nfor i in range(10,10): \n ans.append(str(i)+'9999999999999')\n\nfor i in range(10): \n ans.append('10'+str(i)+'999999999999')\nfor i in range(1,10): \n for j in range(10):\n ans.append(str(i)+str(j)+'99999999999999')\n \nfor val in ans[300:k]:\n print(val)", "k=int(input())\nans=[]\nfor i in range(1,10): \n ans.append(str(i))\n \nfor i in range(1,10): \n ans.append(str(i)+'9')\n \nfor i in range(1,10): \n ans.append(str(i)+'99')\n \nfor i in range(10): \n ans.append('1'+str(i)+'99')\nfor i in range(2,10): \n ans.append(str(i)+'999')\n \nfor i in range(1,3): \n for j in range(10):\n ans.append(str(i)+str(j)+'999')\nfor i in range(3,10): \n ans.append(str(i)+'9999')\n \nfor i in range(1,4): \n for j in range(10):\n ans.append(str(i)+str(j)+'9999')\nfor i in range(4,10): \n ans.append(str(i)+'99999')\n \nfor i in range(1,5): \n for j in range(10):\n ans.append(str(i)+str(j)+'99999')\nfor i in range(5,10): \n ans.append(str(i)+'999999')\n\nfor i in range(1,6): \n for j in range(10):\n ans.append(str(i)+str(j)+'999999')\nfor i in range(6,10): \n ans.append(str(i)+'9999999')\n \nfor i in range(1,7): \n for j in range(10):\n ans.append(str(i)+str(j)+'9999999')\nfor i in range(7,10): \n ans.append(str(i)+'99999999')\n\nfor i in range(1,8): \n for j in range(10):\n ans.append(str(i)+str(j)+'99999999')\nfor i in range(8,10): \n ans.append(str(i)+'999999999')\n\nfor i in range(1,9): \n for j in range(10):\n ans.append(str(i)+str(j)+'999999999')\nfor i in range(9,10): \n ans.append(str(i)+'9999999999')\n \nfor i in range(1,10): \n for j in range(10):\n ans.append(str(i)+str(j)+'9999999999')\nfor i in range(10,10): \n ans.append(str(i)+'99999999999')\n\nfor i in range(1,10): \n for j in range(10):\n ans.append(str(i)+str(j)+'99999999999')\nfor i in range(10,10): \n ans.append(str(i)+'999999999999')\n \nfor i in range(1,10): \n for j in range(10):\n ans.append(str(i)+str(j)+'999999999999')\nfor i in range(10,10): \n ans.append(str(i)+'9999999999999')\n\nfor i in range(10): \n ans.append('10'+str(i)+'999999999999')\nfor i in range(1,10): \n ans.append('1'+str(i)+'9999999999999')\nfor i in range(2,10): \n for j in range(10):\n ans.append(str(i)+str(j)+'9999999999999')\n \nfor val in ans[:k]:\n print(val)"] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s355336521', 's895356746', 's468920362'] | [3316.0, 3316.0, 3316.0] | [18.0, 19.0, 20.0] | [2280, 2203, 2275] |
p03318 | u236127431 | 2,000 | 1,048,576 | Let S(n) denote the sum of the digits in the decimal notation of n. For example, S(123) = 1 + 2 + 3 = 6. We will call an integer n a **Snuke number** when, for all positive integers m such that m > n, \frac{n}{S(n)} \leq \frac{m}{S(m)} holds. Given an integer K, list the K smallest Snuke numbers. | ['import math\nK=int(input())\nk=0\nm=0\ndef D(x):\n s=str(x)\n array=list(map(int,list(s)))\n return sum(array)\nN=1\nS=1\na=0\nprint(N)\nwhile k<=K:\n N+=10**a\n S=D(N)\n if a<math.log10(N/S):\n a+=1\n N=(N//10**a+1)*10**a-1 \n S=D(N)\n print(N)\n k+=1\n \n \n', 'import math\nK=int(input())\nk=2\nm=0\ndef D(x):\n s=str(x)\n array=list(map(int,list(s)))\n return sum(array)\nN=1\nS=1\na=0\nprint(1)\nwhile k<=K:\n N+=10**a\n S=D(N)\n if a<math.log10(N/S):\n a+=1\n N=(N//10**a+1)*10**a-1\n S=D(N)\n print(N)\n k+=1\n \n \n'] | ['Wrong Answer', 'Accepted'] | ['s976926796', 's466173433'] | [3188.0, 3188.0] | [24.0, 24.0] | [258, 257] |
p03318 | u334712262 | 2,000 | 1,048,576 | Let S(n) denote the sum of the digits in the decimal notation of n. For example, S(123) = 1 + 2 + 3 = 6. We will call an integer n a **Snuke number** when, for all positive integers m such that m > n, \frac{n}{S(n)} \leq \frac{m}{S(m)} holds. Given an integer K, list the K smallest Snuke numbers. | ["# -*- coding: utf-8 -*-\nimport bisect\nimport heapq\nimport math\nimport random\nimport sys\nfrom collections import Counter, defaultdict\nfrom decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal\nfrom functools import lru_cache, reduce\nfrom itertools import combinations, combinations_with_replacement, product, permutations\n\nsys.setrecursionlimit(10000)\n\n\ndef read_int():\n return int(input())\n\n\ndef read_int_n():\n return list(map(int, input().split()))\n\n\ndef read_float():\n return float(input())\n\n\ndef read_float_n():\n return list(map(float, input().split()))\n\n\ndef read_str():\n return input()\n\n\ndef read_str_n():\n return list(map(str, input().split()))\n\n\ndef error_print(*args):\n print(*args, file=sys.stderr)\n\n\ndef mt(f):\n import time\n\n def wrap(*args, **kwargs):\n s = time.time()\n ret = f(*args, **kwargs)\n e = time.time()\n\n error_print(e - s, 'sec')\n return ret\n\n return wrap\n\n\ndef S(n):\n s = 0\n while n != 0:\n s += n % 10\n n //= 10\n return s\n\n# @mt\ndef slv(K):\n ans = [(-1, 0)]\n for i in range(16):\n if i < 5:\n a = 1\n else:\n a = 5\n for j in range(1, 10**a):\n b = (10**(i-a+1))*j + (10**(i-a+1)-1)\n s = S(b)\n \n while ans[-1][1] > b/s:\n ans.pop()\n ans.append((b, b/s))\n # print(ans[-1])\n ans.pop(0)\n\n \n return '\\n'.join(map(str, map(lambda x: x[0], ans[:K])))\n\n\ndef main():\n K = read_int()\n print(slv(K))\n\nif __name__ == '__main__':\n main()\n", "# -*- coding: utf-8 -*-\nimport bisect\nimport heapq\nimport math\nimport random\nimport sys\nfrom collections import Counter, defaultdict\nfrom decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal\nfrom functools import lru_cache, reduce\nfrom itertools import combinations, combinations_with_replacement, product, permutations\n\nsys.setrecursionlimit(10000)\n\n\ndef read_int():\n return int(input())\n\n\ndef read_int_n():\n return list(map(int, input().split()))\n\n\ndef read_float():\n return float(input())\n\n\ndef read_float_n():\n return list(map(float, input().split()))\n\n\ndef read_str():\n return input()\n\n\ndef read_str_n():\n return list(map(str, input().split()))\n\n\ndef error_print(*args):\n print(*args, file=sys.stderr)\n\n\ndef mt(f):\n import time\n\n def wrap(*args, **kwargs):\n s = time.time()\n ret = f(*args, **kwargs)\n e = time.time()\n\n error_print(e - s, 'sec')\n return ret\n\n return wrap\n\n\ndef S(n):\n s = 0\n while n != 0:\n s += n % 10\n n //= 10\n return s\n\n# @mt\ndef slv(K):\n ans = [(i, i/S(i)) for i in range(1, 10)]\n for i in range(16):\n a = i\n if a > 5:\n a = 5\n for j in range(1, 10**a):\n b = (10**(i-a+1))*j + (10**(i-a+1)-1)\n s = S(b)\n \n while ans[-1][1] > b/s or ans[-1][0] == b:\n ans.pop()\n ans.append((b, b/s))\n # print(ans[-1])\n \n # for r in ans:\n \n error_print(len(ans))\n \n return '\\n'.join(map(str, map(lambda x: x[0], ans[:K])))\n\n\ndef main():\n K = read_int()\n print(slv(K))\n\nif __name__ == '__main__':\n main()\n", "# -*- coding: utf-8 -*-\nimport bisect\nimport heapq\nimport math\nimport random\nimport sys\nfrom collections import Counter, defaultdict\nfrom decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal\nfrom functools import lru_cache, reduce\nfrom itertools import combinations, combinations_with_replacement, product, permutations\n\nsys.setrecursionlimit(10000)\n\n\ndef read_int():\n return int(input())\n\n\ndef read_int_n():\n return list(map(int, input().split()))\n\n\ndef read_float():\n return float(input())\n\n\ndef read_float_n():\n return list(map(float, input().split()))\n\n\ndef read_str():\n return input()\n\n\ndef read_str_n():\n return list(map(str, input().split()))\n\n\ndef error_print(*args):\n print(*args, file=sys.stderr)\n\n\ndef mt(f):\n import time\n\n def wrap(*args, **kwargs):\n s = time.time()\n ret = f(*args, **kwargs)\n e = time.time()\n\n error_print(e - s, 'sec')\n return ret\n\n return wrap\n\n\ndef S(n):\n s = 0\n while n != 0:\n s += n % 10\n n //= 10\n return s\n\n# @mt\ndef slv(K):\n ans = [(i, i/S(i)) for i in range(1, 10)]\n for i in range(16):\n a = i\n if a > 4:\n a = 4\n for j in range(1, 10**a):\n b = (10**(i-a+1))*j + (10**(i-a+1)-1)\n if b < 10**(i-1):\n continue\n s = S(b)\n \n while ans[-1][1] > b/s or ans[-1][0] == b:\n (ans.pop())\n ans.append((b, b/s))\n # print(ans[-1])\n \n # for r in ans:\n \n error_print(len(ans))\n \n return '\\n'.join(map(str, map(lambda x: x[0], ans[:K])))\n\n\ndef main():\n K = read_int()\n print(slv(K))\n\nif __name__ == '__main__':\n main()\n"] | ['Time Limit Exceeded', 'Time Limit Exceeded', 'Accepted'] | ['s343074536', 's672354438', 's290270431'] | [5456.0, 5452.0, 5452.0] | [2104.0, 2104.0, 413.0] | [1576, 1686, 1743] |
p03318 | u368780724 | 2,000 | 1,048,576 | Let S(n) denote the sum of the digits in the decimal notation of n. For example, S(123) = 1 + 2 + 3 = 6. We will call an integer n a **Snuke number** when, for all positive integers m such that m > n, \frac{n}{S(n)} \leq \frac{m}{S(m)} holds. Given an integer K, list the K smallest Snuke numbers. | ['N = int(input())\nM = N//10\nk = N%10\nd=0\nfor j in range (M):\n for i in range(2,11):\n print(i*10**d-1)\n d += 1 \nif k != 0:\n for i in range(2,2+k):\n print(i*10**d-1)', 'def R(x):\n return x / sum(map(int, str(x)))\nK = int(input())\nD = 0\nl = 0\nfor i in range(K):\n D += 10**l\n print(D)\n if 10**l < R(D+10**l):\n l += 1'] | ['Wrong Answer', 'Accepted'] | ['s207211113', 's671221431'] | [3060.0, 3060.0] | [17.0, 20.0] | [185, 164] |
p03318 | u381416158 | 2,000 | 1,048,576 | Let S(n) denote the sum of the digits in the decimal notation of n. For example, S(123) = 1 + 2 + 3 = 6. We will call an integer n a **Snuke number** when, for all positive integers m such that m > n, \frac{n}{S(n)} \leq \frac{m}{S(m)} holds. Given an integer K, list the K smallest Snuke numbers. | ['import math\n\ndef s(n):\n ret = 0\n\n while n > 0:\n ret += n % 10\n n = n // 10\n \n return ret\n\ndef snuke(n):\n candidate = []\n\n for d in range(int(math.log(n, 10)) + 2):\n x = n - (n % 10**d) + (10**d - 1)\n candidate.append(x)\n \n min_value = candidate[0] / s(candidate[0])\n ans = candidate[0]\n for c in candidate[1:]:\n tmp = c / s(c)\n if tmp < min_value:\n min_value = tmp\n ans = c\n \n return ans\n\nprint(snuke(10248))\n ', 'import math\n\ndef s(n):\n ret = 0\n\n while n > 0:\n ret += n % 10\n n = n // 10\n \n return ret\n\ndef snuke(n):\n candidate = []\n\n for d in range(int(math.log(n, 10)) + 2):\n x = n - (n % 10**d) + (10**d - 1)\n candidate.append(x)\n \n min_value = candidate[0] / s(candidate[0])\n ans = candidate[0]\n for c in candidate[1:]:\n tmp = c / s(c)\n if tmp < min_value:\n min_value = tmp\n ans = c\n \n return ans\n\nK = int(input())\n\nN = 0\nfor i in range(K):\n N = snuke(N + 1)\n print(N)\n '] | ['Wrong Answer', 'Accepted'] | ['s564969586', 's472814853'] | [8936.0, 9140.0] | [26.0, 45.0] | [529, 586] |
p03318 | u407160848 | 2,000 | 1,048,576 | Let S(n) denote the sum of the digits in the decimal notation of n. For example, S(123) = 1 + 2 + 3 = 6. We will call an integer n a **Snuke number** when, for all positive integers m such that m > n, \frac{n}{S(n)} \leq \frac{m}{S(m)} holds. Given an integer K, list the K smallest Snuke numbers. | ['def s(n):\n\tsum = 0\n\tfor c in str(n):\n\t\tsum += int(c)\n\treturn sum\n\ndef isSunuke(n):\n\tfor m in range(n+1, n * 100):\n\t\tif (n / s(n)) > (m / s(m)):\n\t\t\treturn False\n\treturn True\n\nk = int(input())\nfound=0\nn = 1\nwhile(found < k):\n\tsn = str(n)\n\tlength = len(sn)\n\tnines = 0\n\tfor c in sn:\n\t\tif c == "9":\n\t\t\tnines += 1\n\tif nines < length / 2:\n\t\tn += 1\n\t\tcontinue\n\tif isSunuke(n):\n\t\tprint(n)\n\t\tfound+=1\n\tn += 1', 'import math\n\n\ndef s(n):\n\tsum = 0\n\tfor c in str(n):\n\t\tsum += int(c)\n\treturn sum\n\nk = int(input())\nfound=0\n\ndef next_sunuke(n, s_n, s_n_div):\n\n\tglobal found\n\n\tif n == 1:\n\t\treturn\n\n\tlog_n = int(math.log(n,10))\n\tm = n - 10 ** int(log_n // 1.25)\n\n\twhile m >= 1:\n\t\ts_m = s(m)\n\t\ts_mplus1 = s(m + 1)\n\n\t\tif (s_m < s_mplus1 or (s_n - s_m != 1 and s_n - s_m != -8 and s_n - s_m != -17)) and m > 9:\n\t\t\tm -= 10 ** int(log_n // 1.25)\n\t\t\tcontinue\n\n\t\t# print("check: " + str(m))\n\n\t\ts_m_div = m / s(m)\n\n\t\tif s_m_div <= s_n_div:\n\t\t\tnext_sunuke(m, s_m, s_m_div)\n\t\t\tif found >= k:\n\t\t\t\treturn\n\n\t\t\tfound += 1\n\t\t\t# print("{0:d}".format(m), "{0:+d}".format(n-m), "{0:d}".format(s_m), s_m_div)\n\t\t\tprint(m)\n\t\t\tbreak\n\n\n\t\tm -= 10 ** int(log_n // 1.25)\n\n\n\ncurrent_sunuke = 999999999999999\ns_current_sunuke = s(current_sunuke)\ns_current_sunuke_div = current_sunuke / s_current_sunuke\n\n# start = datetime.datetime.now()\nnext_sunuke(current_sunuke, s_current_sunuke, s_current_sunuke_div)\nif found < k:\n\tprint(current_sunuke)\n# end = datetime.datetime.now()\n# print(str(end-start))\n'] | ['Wrong Answer', 'Accepted'] | ['s730572353', 's584532833'] | [3064.0, 3828.0] | [2104.0, 347.0] | [398, 1099] |
p03318 | u434208140 | 2,000 | 1,048,576 | Let S(n) denote the sum of the digits in the decimal notation of n. For example, S(123) = 1 + 2 + 3 = 6. We will call an integer n a **Snuke number** when, for all positive integers m such that m > n, \frac{n}{S(n)} \leq \frac{m}{S(m)} holds. Given an integer K, list the K smallest Snuke numbers. | ['from math import log10 as l\ns=lambda f:sum(map(int,list(str(f))))\np=lambda a,j:(a//10**(j+1)+1)*10**(j+1)-1\nn=int(input())\na=1\nfor i in range(n):\n print(a)\n if(a<10):\n a+=1\n continue\n a+=1\n k=[p(a,j) for j in range(int(l(a)))]\n o=[p(a,j)/s(p(a,j)) for j in range(int(l(a)))]\n a=k[o.index(min(o))]', 'from math import log10 as l\ns=lambda f:sum(map(int,list(str(f))))\np=lambda a,j:(a//10**(j+1)+1)*10**(j+1)-1\nn=int(input())\na=1\nfor i in range(n):\n print(a)\n if(a<9):\n a+=1\n continue\n a+=1\n k=[p(a,j) for j in range(int(l(a)))]\n o=[p(a,j)/s(p(a,j)) for j in range(int(l(a)))]\n a=k[o.index(min(o))]'] | ['Wrong Answer', 'Accepted'] | ['s709863728', 's678207470'] | [3316.0, 3572.0] | [63.0, 66.0] | [308, 307] |
p03318 | u473633103 | 2,000 | 1,048,576 | Let S(n) denote the sum of the digits in the decimal notation of n. For example, S(123) = 1 + 2 + 3 = 6. We will call an integer n a **Snuke number** when, for all positive integers m such that m > n, \frac{n}{S(n)} \leq \frac{m}{S(m)} holds. Given an integer K, list the K smallest Snuke numbers. | ['# coding: utf-8\n# Your code here!\nk = int(input())\nk = 100\ncount = 0\nans = []\nminN = 10**15\n\nfor i in reversed(range(5)):\n for j in reversed(range(1,10**4)):\n num = str(j)+"9"*i*3\n n = sum([int(k) for k in num])\n n = int(num)/n\n if(num == "379999"):\n print("tes")\n if(minN > n or n==1):\n minN = n\n ans.append(num)\n\nprint(len(ans[0]),len(ans))\n\nfor i in list(reversed(ans))[:k]:\n print(i)', '# coding: utf-8\n# Your code here!\nk = int(input())\n\ncount = 0\nans = []\nminN = 10**15\n\nfor i in reversed(range(12)):\n for j in reversed(range(1,10**4)):\n num = str(j)+"9"*i\n n = sum([int(k) for k in num])\n n = int(num)/n\n if(minN > n or n==1):\n minN = n\n ans.append(num)\n \n \nprint(len(ans[0]))\nfor i in list(reversed(ans))[:k]:\n print(i)', '# coding: utf-8\n# Your code here!\nk = int(input())\nk = 100\ncount = 0\nans = []\nminN = 10**15\n\nfor i in reversed(range(5)):\n for j in reversed(range(1,10**4)):\n num = str(j)+"9"*i*3\n n = sum([int(k) for k in num])\n n = int(num)/n\n if(minN > n or n==1):\n minN = n\n ans.append(num)\n\nfor i in list(reversed(ans))[:k]:\n print(i)', '# coding: utf-8\n# Your code here!\nk = int(input())\n\ncount = 0\nans = []\nminN = 10**15\n\nfor i in reversed(range(15)):\n for j in reversed(range(1,100)):\n num = str(j)+"9"*i\n n = sum([int(k) for k in num])\n n = int(num)/n\n if(minN > n):\n minN = n\n ans.append(num)\n \nfor i in list(reversed(ans))[:k]:\n print(i)', '# coding: utf-8\n# Your code here!\nk = int(input())\nans = 10**15\nli = []\nfor i in reversed(list(range(1,10**15))):\n snk = sum([int(j) for j in str(i)])\n if(ans >= i/snk):\n ans = i/snk\n li.append(i)\n \nfor i in list(reversed(li))[:k]:\n print(i)', '# coding: utf-8\n# Your code here!\nk = int(input())\n\ncount = 0\nans = []\nminN = 10**15\n\nfor i in reversed(range(10)):\n for j in reversed(range(1,10**5)):\n num = str(j)+"9"*i\n n = sum([int(k) for k in num])\n n = int(num)/n\n if(minN > n or n==1):\n minN = n\n ans.append(num)\n\nprint(len(ans[0]))\nfor i in list(reversed(ans))[:k]:\n print(i)', '# coding: utf-8\n# Your code here!\nk = int(input())\ncount = 0\nans = []\nminN = 10**15\n\nfor i in reversed(range(13)):\n minN = 10**15\n for j in reversed(range(1,10**3)):\n num = str(j)+"9"*i\n n = sum([int(k) for k in num])\n n = int(num)/n\n if(minN > n or n==1):\n minN = n\n ans.append(int(num))\n\nfor i in list(sorted(list(set(ans))))[:k]:\n print(i)'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Time Limit Exceeded', 'Accepted'] | ['s365938545', 's371376997', 's383636637', 's528204101', 's747744313', 's852914941', 's323716387'] | [3064.0, 3064.0, 3060.0, 3060.0, 3060.0, 3064.0, 3188.0] | [186.0, 407.0, 185.0, 22.0, 17.0, 2104.0, 59.0] | [461, 414, 378, 372, 271, 389, 401] |
p03318 | u496344397 | 2,000 | 1,048,576 | Let S(n) denote the sum of the digits in the decimal notation of n. For example, S(123) = 1 + 2 + 3 = 6. We will call an integer n a **Snuke number** when, for all positive integers m such that m > n, \frac{n}{S(n)} \leq \frac{m}{S(m)} holds. Given an integer K, list the K smallest Snuke numbers. | ['import sys \n\nK = int(input())\n\nif K <= 0:\n sys.exit(0)\n\nstep = 1 \nsnuke = 1 \n\nwhile K >= 0:\n if step < snuke/sum(map(int, str(snuke))):\n snuke += 9 * step\n step *= 10\n else:\n print(snuke)\n snuke += step\n K -= 1', 'import sys \n\nK = int(input())\n\nif K <= 0:\n sys.exit(0)\n\nstep = 1 \nsnuke = 1 \n\nwhile K > 0:\n if step < snuke/sum(map(int, str(snuke))):\n snuke += 9 * step\n step *= 10\n else:\n print(snuke)\n snuke += step\n K -= 1'] | ['Wrong Answer', 'Accepted'] | ['s515083874', 's316944658'] | [3188.0, 3060.0] | [19.0, 20.0] | [254, 253] |
p03318 | u497046426 | 2,000 | 1,048,576 | Let S(n) denote the sum of the digits in the decimal notation of n. For example, S(123) = 1 + 2 + 3 = 6. We will call an integer n a **Snuke number** when, for all positive integers m such that m > n, \frac{n}{S(n)} \leq \frac{m}{S(m)} holds. Given an integer K, list the K smallest Snuke numbers. | ["K = int(input())\n\nif K < 10:\n num_list = [i for i in range(1, K+1)]\n print(*num_list, sep='\\n')\nelse:\n num_list = [i for i in range(1, 10)]\n n = 19\n digits = 2\n while len(num_list) < K:\n num_list.append(n)\n if str(n+1)[0] > 3:\n digits += 1\n n += 10**(digits - 1)\n print(*num_list, sep='\\n')", "def digit_sum(number):\n ans = 0\n for n in str(number):\n ans += int(n)\n return ans\n\ndef obj_func(number):\n return number/digit_sum(number)\n\nK = int(input())\nnum_list = []\nd = 1\nn = 1\n\nfor i in range(K):\n num_list.append(n)\n if obj_func(n + 10**(d-1)) > obj_func(n + 10**d):\n d += 1\n n += 10**(d-1)\n\nprint(*num_list, sep='\\n')\n"] | ['Runtime Error', 'Accepted'] | ['s184045417', 's446300519'] | [3064.0, 3188.0] | [18.0, 25.0] | [343, 360] |
p03318 | u517152997 | 2,000 | 1,048,576 | Let S(n) denote the sum of the digits in the decimal notation of n. For example, S(123) = 1 + 2 + 3 = 6. We will call an integer n a **Snuke number** when, for all positive integers m such that m > n, \frac{n}{S(n)} \leq \frac{m}{S(m)} holds. Given an integer K, list the K smallest Snuke numbers. | ['# -*- coding: utf-8 -*-\n# \nimport math\nimport sys\nimport itertools\nimport numpy as np\nfrom operator import itemgetter\n\nk =int(input())\nnmax=0\ns = []\nfor i in range(1,200):\n for j in range(14):\n p = i\n for ii in range(j):\n p=p*10+9\n q = i // 100 + (i // 10) % 10 + i % 10 + 9*j\n r = p / q\n\n s.append((p,q,r))\n\ns= sorted( s, key=itemgetter(2) )\nprint(s)\nnum=0\nfor a in s :\n if a[0] > nmax:\n nmax = a[0]\n print(nmax)\n num += 1\n if num >= k :\n break \n \n', '# -*- coding: utf-8 -*-\n# \nimport math\nimport sys\nimport itertools\nimport numpy as np\nfrom operator import itemgetter\n\nk =int(input())\nnmax=0\ns = []\nfor i in range(1,200):\n for j in range(14):\n p = i\n for ii in range(j):\n p=p*10+9\n q = i // 100 + (i // 10) % 10 + i % 10 + 9*j\n r = p / q\n\n s.append((p,q,r))\n\ns= sorted( s, key=itemgetter(2) )\n#print(s)\nnum=0\nfor a in s :\n if a[0] > nmax:\n nmax = a[0]\n print(nmax)\n num += 1\n if num >= k :\n break \n \n'] | ['Wrong Answer', 'Accepted'] | ['s684630800', 's666693794'] | [22296.0, 21656.0] | [1621.0, 308.0] | [543, 544] |
p03318 | u533885955 | 2,000 | 1,048,576 | Let S(n) denote the sum of the digits in the decimal notation of n. For example, S(123) = 1 + 2 + 3 = 6. We will call an integer n a **Snuke number** when, for all positive integers m such that m > n, \frac{n}{S(n)} \leq \frac{m}{S(m)} holds. Given an integer K, list the K smallest Snuke numbers. | ['\nK = int(input())\nketa = 1\nnow = 1\ndef sunuke(n):\n a = 0\n for i in str(n):\n a+=int(i)\n return(n/a)\ncount=0\nwhile count < k:\n if sunuke(ima) <= sunuke(ima+keta):\n print(ima)\n ima += keta\n count += 1\n else:\n ima += 9*keta\n keta *= 10\n\n', '\nK = int(input())\nketa = 1\nnow = 1\ndef sunuke(n):\n a = 0\n for i in str(n):\n a+=int(i)\n return(n/a)\ncount=0\nwhile count < k:\n if sunuke(now) <= sunuke(now+keta):\n print(now)\n now+=keta\n count+=1\n else:\n now+=9*keta\n keta *= 10\n\n', '\nK=int(input())\nketa=1\nnow=1\ncount=0\n\ndef sunuke(n):\n a=0\n for i in str(n):\n a+=int(i)\n return(n/a)\n\nwhile count < K:\n if sunuke(now) <= sunuke(now+keta):\n print(now)\n now+=keta\n count+=1\n else:\n now+=9*keta\n keta*=10\n\n'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s103156694', 's189237679', 's075441070'] | [2940.0, 2940.0, 3188.0] | [17.0, 18.0, 22.0] | [298, 292, 284] |
p03318 | u547167033 | 2,000 | 1,048,576 | Let S(n) denote the sum of the digits in the decimal notation of n. For example, S(123) = 1 + 2 + 3 = 6. We will call an integer n a **Snuke number** when, for all positive integers m such that m > n, \frac{n}{S(n)} \leq \frac{m}{S(m)} holds. Given an integer K, list the K smallest Snuke numbers. | ['k=input()\na=0\nb=1\nfor i in range(k):\n a+=b\n print(a)\n if b<(a+b)/sum(map(int,str(a+b))):\n b*=10', 'k=int(input())\na=0\nb=1\nfor i in range(k):\n a+=b\n print(a)\n if b<(a+b)/sum(map(int,str(a+b))):\n b*=10'] | ['Runtime Error', 'Accepted'] | ['s486905655', 's993293613'] | [3060.0, 3188.0] | [17.0, 20.0] | [101, 106] |
p03318 | u594859393 | 2,000 | 1,048,576 | Let S(n) denote the sum of the digits in the decimal notation of n. For example, S(123) = 1 + 2 + 3 = 6. We will call an integer n a **Snuke number** when, for all positive integers m such that m > n, \frac{n}{S(n)} \leq \frac{m}{S(m)} holds. Given an integer K, list the K smallest Snuke numbers. | ["from itertools import chain, count, islice\n\ndef f():\n j = int(input())\n cs = '123456789'\n xs = ['123456789', (c+'9' for c in cs)] \n for x in chain(*xs):\n if j == 0: return\n yield x\n j -= 1\n\n for i in count(2):\n for n in range(i-1, i*10-1):\n if j == 0: return\n yield str(n)+('9'*i)\n j -= 1\n\nz = list(f())", 'from math import log, floor\nfrom itertools import accumulate, chain, islice, repeat\n \nk = int(input())\n \ndef f(n):\n ds = range(int(log(n+1, 10))+1)\n xs = [(10**(d+1))*floor(n/(10**(d+1)) + 1) - 1 for d in ds]\n return min(xs, key=lambda n:n / sum(map(int, str(n))))\n \nsnukes = chain(range(1, 9), accumulate(repeat(9), lambda x,_:f(x+1)))\n \nfor x in islice(snukes, k):\n print(x)'] | ['Wrong Answer', 'Accepted'] | ['s755571457', 's156735101'] | [3060.0, 3188.0] | [20.0, 47.0] | [379, 388] |
p03318 | u619458041 | 2,000 | 1,048,576 | Let S(n) denote the sum of the digits in the decimal notation of n. For example, S(123) = 1 + 2 + 3 = 6. We will call an integer n a **Snuke number** when, for all positive integers m such that m > n, \frac{n}{S(n)} \leq \frac{m}{S(m)} holds. Given an integer K, list the K smallest Snuke numbers. | ["import sys\n\ndef S(n):\n return n / sum(map(int, str(n)))\n\n\ndef f(n):\n d = 0\n C = [n]\n while S(n) > (10**(d-1) / (9*d)):\n c = 10**(d+1) * (n // 10**(n+1) + 1) - 1\n C.append(c)\n \n Smin = float('inf')\n res = 0\n for c in C:\n if S(c) < Smin:\n res = c \n return res\n \ndef main():\n input = sys.stdin.readline\n K = int(input())\n ans = 1\n while _ in range(K):\n print(ans)\n ans = f(ans+1)\n\n\nif __name__ == '__main__':\n main()", "import sys\n\ndef S(n):\n return n / sum(map(int, str(n)))\n\n\ndef f(n):\n d = 0\n C = [n]\n while S(n) > (10**d / 9*(d+1)):\n c = 10**(d+1) * (n // 10**(d+1) + 1) - 1\n C.append(c)\n d += 1\n Smin = float('inf')\n res = 0\n for c in C:\n if S(c) < Smin:\n Smin = S(c)\n res = c \n return res\n\n\ndef main():\n input = sys.stdin.readline\n K = int(input())\n ans = 1\n for _ in range(K):\n print(ans)\n ans = f(ans+1)\n\n\nif __name__ == '__main__':\n main()"] | ['Runtime Error', 'Accepted'] | ['s312991580', 's692347983'] | [3064.0, 3188.0] | [17.0, 82.0] | [449, 470] |
p03318 | u620480037 | 2,000 | 1,048,576 | Let S(n) denote the sum of the digits in the decimal notation of n. For example, S(123) = 1 + 2 + 3 = 6. We will call an integer n a **Snuke number** when, for all positive integers m such that m > n, \frac{n}{S(n)} \leq \frac{m}{S(m)} holds. Given an integer K, list the K smallest Snuke numbers. | ['K=int(input())\nfor i in range(1,K):\n if i<=9:\n print(i)\n elif i%10==0:\n pass\n elif i<=19:\n a=(i-10)*10+9\n print(a)\n elif i<=29:\n a=(i-20)*100+99\n print(a)\n elif i<=39:\n a=(i-30)*1000+999\n print(a)\n elif i<=49:\n a=(i-40)*10000+9999\n print(a)\n elif i<=59:\n a=(i-50)*100000+99999\n print(a)\n elif i<=69:\n a=(i-60)*1000000+999999\n print(a)\n elif i<=79:\n a=(i-70)*10000000+9999999\n print(a)\n elif i<=89:\n a=(i-80)*100000000+99999999\n print(a)\n elif i<=99:\n a=(i-90)*1000000000+999999999\n print(a)\n elif i<=109:\n a=(i-100)*10000000000+9999999999\n print(a)\n elif i<=119:\n a=(i-110)*100000000000+99999999999\n print(a)\n elif i<=129:\n a=(i-120)*1000000000000+999999999999\n print(a)\n elif i<=139:\n a=(i-130)*10000000000000+9999999999999\n print(a)\n elif i<=149:\n a=(i-140)*100000000000000+99999999999999\n print(a)\n elif i<=159:\n a=(i-150)*1000000000000000+999999999999999\n print(a)', 'K=int(input())\nD={}\nfor i in range(1,10**4):\n for j in range(12):\n Sunuke=str(i)+("9"*j)\n if len(Sunuke)<=15 and Sunuke not in D:\n S=0\n for k in range(len(Sunuke)):\n S+=int(Sunuke[k])\n D[int(Sunuke)]=S\nD=list(D.items())\nD.sort()\n#print(D[:10])\nimport bisect\n\nd=[10**16 for i in range(len(D))]\nd[0]=0\nans=[0 for i in range(len(D))]\nfor i in range(len(D)):\n ans[bisect.bisect_right(d,D[i][0]/D[i][1])]=D[i][0]\n d[bisect.bisect_right(d,D[i][0]/D[i][1])]=D[i][0]/D[i][1]\n \n#print(ans[:50])\nANS=[]\nMAX=0\nfor i in range(len(ans)):\n if ans[i]>MAX:\n ANS.append(ans[i])\n MAX=ans[i]\n#print(ANS[:100])\nfor i in range(K):\n print(ANS[i])\n#print(d[:10])'] | ['Wrong Answer', 'Accepted'] | ['s479745310', 's194911697'] | [3064.0, 20404.0] | [18.0, 916.0] | [1143, 733] |
p03318 | u631277801 | 2,000 | 1,048,576 | Let S(n) denote the sum of the digits in the decimal notation of n. For example, S(123) = 1 + 2 + 3 = 6. We will call an integer n a **Snuke number** when, for all positive integers m such that m > n, \frac{n}{S(n)} \leq \frac{m}{S(m)} holds. Given an integer K, list the K smallest Snuke numbers. | ['MAX = 10**15+1\n\ndef find_next_n(n):\n cand = []\n n_str = str(n)\n n_list = list(n_str)\n for i in range(1,len(str(n))+1):\n n_list[-i] = \'9\'\n cand.append(int("".join(n_list)))\n cand_result = [num/snuke(num) for num in cand]\n min_idx = cand_result.index(min(cand_result))\n\n return cand[min_idx]\n \n \ndef snuke(num):\n ans = 0\n while num//10 != 0:\n ans += num%10\n num = num//10\n return ans + num\n\ndef main():\n K = int(input())\n if K<10:\n for i in range(1,K+1):\n print(i)\n else:\n n = 10\n for i in range(K):\n print(i)\n for i in range(10,K+1):\n ans = find_next_n(n)\n print(ans)\n n = ans+i\n \n if n>MAX:\n break\n \n \nif __name__ == "__main__":\n main()', 'MAX = 10**15+1\n\ndef top(num):\n ans = 0\n while num//10 != 0:\n ans += num%10\n num = num//10\n return num\n\n\ndef tail(num):\n sho = num//10\n return num-10*sho\n\ndef get_snuke():\n for i in range(1,MAX):\n if i <= 10:\n yield i\n elif tail(i) == 9:\n if top(i) != top(i+10):\n yield i\n \n\ndef main():\n K = int(input())\n gen = get_snuke()\n\n \n for _ in range(K):\n snuke_num = gen.__next__()\n print(snuke_num)\n\nif __name__ == "__main__":\n main()', 'MAX = 10**15+1\n\ndef find_next_n(n):\n cand = []\n n_str = str(n)\n n_list = list(n_str)\n for i in range(1,len(str(n))+1):\n n_list[-i] = \'9\'\n cand.append(int("".join(n_list)))\n cand_result = [num/snuke(num) for num in cand]\n min_idx = cand_result.index(min(cand_result))\n\n return cand[min_idx]\n \n \ndef snuke(num):\n ans = 0\n while num//10 != 0:\n ans += num%10\n num = num//10\n return ans + num\n\ndef main():\n K = int(input())\n if K<10:\n for i in range(1,K+1):\n print(i)\n else:\n n = 10\n for i in range(1,K+1):\n print(i)\n for i in range(10,K+1):\n ans = find_next_n(n)\n print(ans)\n n = ans+i\n \n if n>MAX:\n break\n \n \nif __name__ == "__main__":\n main()', 'MAX = 10**15+1\n\ndef tail(num):\n sho = num//10\n return num-10*sho\n\ndef get_snuke():\n for i in range(1,MAX):\n if i <= 10:\n yield i\n elif tail(i) == 9:\n yield i\n \n\ndef main():\n K = 100\n gen = get_snuke()\n \n for _ in range(K):\n snuke_num = gen.__next__()\n print(snuke_num)\n\nif __name__ == "__main__":\n main()', 'MAX = 10**15+1\n\ndef tail(num):\n sho = num//10\n return num-10*sho\n\ndef get_snuke():\n for i in range(1,MAX):\n if i <= 10:\n yield i\n elif tail(i) == 9:\n yield i\n \n\ndef main():\n K = int(input())\n gen = get_snuke()\n \n for _ in range(K):\n snuke_num = gen.__next__()\n print(snuke_num)\n\nif __name__ == "__main__":\n main()', 'import sys\nstdin = sys.stdin\n\nsys.setrecursionlimit(10**5)\n\ndef li(): return map(int, stdin.readline().split())\ndef li_(): return map(lambda x: int(x)-1, stdin.readline().split())\ndef lf(): return map(float, stdin.readline().split())\ndef ls(): return stdin.readline().split()\ndef ns(): return stdin.readline().rstrip()\ndef lc(): return list(ns())\ndef ni(): return int(stdin.readline())\ndef nf(): return float(stdin.readline())\n\ndef ds(n:int):\n return sum([int(i) for i in str(n)])\n\ndef snuke(n:int):\n return n/ds(n)\n\ndef cands(n:int):\n ret = []\n nl = len(str(n))\n for i in range(nl):\n ret.append(str(n)[:nl-i-1] + "9"*(i+1))\n \n return ret\n\nk = ni()\n\n\nans = [i for i in range(1,10)]\n\n\ncur = 10\nwhile len(ans) < k:\n cand = cands(cur)\n temp = 10**18\n nex = -1\n for c in cand:\n if snuke(int(c)) <= temp:\n temp = snuke(int(c))\n nex = int(c)\n \n ans.append(nex)\n cur = nex+1\n \nfor ai in ans[:k]:\n print(ai)'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s362017330', 's567135572', 's634153067', 's780399822', 's977994504', 's668958884'] | [3316.0, 3064.0, 3316.0, 3060.0, 3060.0, 3188.0] | [45.0, 2104.0, 45.0, 17.0, 19.0, 76.0] | [838, 567, 842, 402, 411, 1025] |
p03318 | u684026548 | 2,000 | 1,048,576 | Let S(n) denote the sum of the digits in the decimal notation of n. For example, S(123) = 1 + 2 + 3 = 6. We will call an integer n a **Snuke number** when, for all positive integers m such that m > n, \frac{n}{S(n)} \leq \frac{m}{S(m)} holds. Given an integer K, list the K smallest Snuke numbers. | ['k = int(input())\n\ns = [1, 2, 3, 4, 5, 6, 7, 8]\n\nl = 1\n\nwhile len(s) <= k:\n for i in range(1, 11):\n s.append((10 ** l) * i - 1)\n if len(s) > k:\n break\n l += 1\n\n\nfor i in s:\n print(i)', 'k = int(input())\n\na = 1\nb = 1\n\ndef snk(n):\n s = 0\n for i in str(n):\n s += int(i)\n return n / s\n\nfor _ in range(k):\n print(a)\n if snk(a + 10 ** (b -1)) > snk(a + 10 ** b):\n b += 1\n a += 10 ** (b-1)\n'] | ['Wrong Answer', 'Accepted'] | ['s909811390', 's923214870'] | [3060.0, 3060.0] | [18.0, 22.0] | [215, 229] |
p03318 | u724892495 | 2,000 | 1,048,576 | Let S(n) denote the sum of the digits in the decimal notation of n. For example, S(123) = 1 + 2 + 3 = 6. We will call an integer n a **Snuke number** when, for all positive integers m such that m > n, \frac{n}{S(n)} \leq \frac{m}{S(m)} holds. Given an integer K, list the K smallest Snuke numbers. | ['k = int(input())\nif k < 10:\n print(k)\n exit()\n\nprint(9 + (k-9)*10)\n', 'k = int(input())\nif k < 10:\n print(k)\n exit()\n\nprint((k-8)*10-1)\n\n\n# return sum(list(map(int, str(n))))\n#\n# l = []\n\n# l.append([i, s(i), i/s(i)])\n#\n# l.sort(key=lambda x:x[2])\n\n# print(l[i])\n#\n# max = 0\n\n# if l[i][0] > max:\n# max = l[i][0]\n# print(l[i][0]+1, end=" ")\n# print()\n', 'k = int(input())\nif k < 10:\n print(k)\n exit()\n\ndef s(n):\n return sum(list(map(int, str(n))))\n\nseeds = [i for i in range(2, 9)]\nfor i in range(16):\n for j in range(1, 10):\n for k in range(10):\n seeds.append((k + j*10) * 10**i)\n\n# print(seeds)\n\nseeds = list(map(lambda x:x-1, seeds))\n\nl = []\nfor i in seeds:\n l.append([i, s(i), i/s(i)])\n#\nl.sort(key=lambda x:x[2])\n\n# print(l[i])\n\nmax = 0\nans = []\nfor i in range(len(l)):\n if l[i][0] > max:\n max = l[i][0]\n ans.append(l[i][0])\n # print(l[i][0], end=" ")\n\nprint(ans[k-1])\n\n# max = 0\n\n# if l[i][0] > max:\n# max = l[i][0]\n# print(l[i][0]+1, end=" ")\n# print()\n', 'k = int(input())\n\n# print(k)\n# exit()\n\ndef s(n):\n return sum(list(map(int, str(n))))\n\nseeds = [i for i in range(1, 10)]\nfor i in range(15):\n for j in range(10):\n for m in range(10):\n for y in range(10):\n seeds.append(int(str(m + j*10 + y*100) + str(9)*i))\n\n# print(seeds)\n\nseeds = [i for i in seeds if i!=0]\n\nl = []\nfor i in seeds:\n l.append([i, s(i), i/s(i)])\n\n\n# l.append([i, s(i), i/s(i)])\n\n\nl.sort(key=lambda x:x[2])\n\n# print(l[i])\n\nmax = 0\nans = []\nfor i in range(len(l)):\n if l[i][0] > max:\n max = l[i][0]\n ans.append(l[i][0])\n # print(l[i][0], end=" ")\n\nfor i in range(k):\n print(ans[i])\n\n# max = 0\n\n# if l[i][0] > max:\n# max = l[i][0]\n# print(l[i][0]+1, end=" ")\n# print()\n'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s060096659', 's126039458', 's646512561', 's442133601'] | [2940.0, 2940.0, 3188.0, 5712.0] | [70.0, 17.0, 26.0, 118.0] | [73, 403, 736, 875] |
p03318 | u734548018 | 2,000 | 1,048,576 | Let S(n) denote the sum of the digits in the decimal notation of n. For example, S(123) = 1 + 2 + 3 = 6. We will call an integer n a **Snuke number** when, for all positive integers m such that m > n, \frac{n}{S(n)} \leq \frac{m}{S(m)} holds. Given an integer K, list the K smallest Snuke numbers. | ['# /user/bin/python\n# -*- coding: utf-8 -*-\nimport sys\n\n\nk = int(input())\nstep = ret = 1\nfor _ in range(k):\n if step < ret / sum(map(int, list(str(ret)))):\n ret += 9*step\n step *= 10\n else:\n print(ret)\n ret += step\n', '# /user/bin/python\n# -*- coding: utf-8 -*-\n\nt = i = 1\nk = int(input()) \n\nfor _ in range(k):\n if t < i / sum(map(int, list(str(i)))):\n i += 9 * t\n t *= 10\n else:\n print(i)\n i += t\n', 't = i = 1\nk = int(input()) \nwhile k:\n if t < i / sum(map(int, list(str(i)))):\n i += 9 * t\n t *= 10\n else:\n print(i)\n i += t\n k -= 1\n'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s731736989', 's789150982', 's331607937'] | [3188.0, 3188.0, 3188.0] | [21.0, 21.0, 20.0] | [228, 193, 149] |
p03318 | u782098901 | 2,000 | 1,048,576 | Let S(n) denote the sum of the digits in the decimal notation of n. For example, S(123) = 1 + 2 + 3 = 6. We will call an integer n a **Snuke number** when, for all positive integers m such that m > n, \frac{n}{S(n)} \leq \frac{m}{S(m)} holds. Given an integer K, list the K smallest Snuke numbers. | ['def dsum(n):\n ret = 0\n while n > 0:\n ret += n % 10\n n //= 10\n return ret\n\n\ndef g(n):\n return n / dsum(n)\n\nK = int(input())\n\nres = []\nbase = 1\nfor i in range(15):\n for j in range(1, 150):\n res.append(base * (j + 1) - 1)\n base *= 10\n\nres.sort()\nres = list(set(res))\n\nans = []\nprint(res[:20])\nfor i, r in enumerate(res):\n flag = true\n for j in range(i + 1, len(res)):\n if g(r) > g(res[j]):\n flag = False\n break\n if flag:\n ans.append(r)\n\nfor k in range(K):\n print(ans[k])\n', 'K = int(input())\n\n\ndef dsum(n):\n return sum(list(map(int, str(n))))\n\n\ndef g(n):\n return n / dsum(n)\n\nj = 1\norder = 1\nfor i in range(K):\n print(j)\n if g(j + 10 ** (order - 1)) > g(j + 10 ** order):\n order += 1\n j += 10 ** (order - 1)\n'] | ['Runtime Error', 'Accepted'] | ['s068271922', 's248307849'] | [3188.0, 3188.0] | [19.0, 24.0] | [555, 255] |
p03318 | u832039789 | 2,000 | 1,048,576 | Let S(n) denote the sum of the digits in the decimal notation of n. For example, S(123) = 1 + 2 + 3 = 6. We will call an integer n a **Snuke number** when, for all positive integers m such that m > n, \frac{n}{S(n)} \leq \frac{m}{S(m)} holds. Given an integer K, list the K smallest Snuke numbers. | ['res = []\nfor digit in range(1,16):\n if digit<=3:\n for i in range(2,11):\n res.append(10**(digit-1)*i-1)\n elif 4<=digit<=12:\n for i in range(11,(digit-2)*10):\n res.append(i*10**(digit-2)-1)\n for i in range(digit-2,11):\n res.append(i*10**(digit-1)-1)\n elif digit==15:\n for i in range(101,110):\n res.append(i*10**(digit-3)-1)\n for i in range(11,101):\n res.append(i*10**(digit-2)-1)\n else:\n for i in range(11,101):\n res.append(i*10**(digit-2)-1)\nprint(res)\n', 'res = []\nfor digit in range(1,16):\n if digit<=3:\n for i in range(2,11):\n res.append(10**(digit-1)*i-1)\n elif 4<=digit<=12:\n for i in range(11,(digit-2)*10):\n res.append(i*10**(digit-2)-1)\n for i in range(digit-2,11):\n res.append(i*10**(digit-1)-1)\n elif digit==15:\n for i in range(101,110):\n res.append(i*10**(digit-3)-1)\n for i in range(11,101):\n res.append(i*10**(digit-2)-1)\n else:\n for i in range(11,101):\n res.append(i*10**(digit-2)-1)\nfor i in range(int(input())):\n print(res[i])\n'] | ['Wrong Answer', 'Accepted'] | ['s082526760', 's566338860'] | [3064.0, 3188.0] | [17.0, 18.0] | [572, 609] |
p03319 | u001024152 | 2,000 | 1,048,576 | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N. On this sequence, Snuke can perform the following operation: * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements. Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable. | ['import sys\n\nN, K = map(int, input().split())\nA = list(map(int, input().split()))\n\nif N == K:\n print(1)\n sys.exit()\n\nprint((N-K)//(K-1)+1)\n', 'import sys\nfrom math import ceil\n\nN, K = map(int, input().split())\nA = list(map(int, input().split()))\n\nif N == K:\n print(1)\n sys.exit()\n\nprint(ceil((N-K)/(K-1))+1)\n'] | ['Wrong Answer', 'Accepted'] | ['s383238044', 's371310348'] | [14008.0, 13812.0] | [40.0, 41.0] | [144, 171] |
p03319 | u010090035 | 2,000 | 1,048,576 | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N. On this sequence, Snuke can perform the following operation: * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements. Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable. | ['n,k=map(int,input().split())\nh=[]\nfor i in range(n):\n h.append(int(input()))\nh.sort()\n\nans=9999999999999\nfor i in range(n-k+1):\n ans=min(ans,h[i+k-1]-h[i])\nprint(ans)', 'n,k=map(int,input().split())\na=list(map(int,input().split()))\nprint(-(-(n-1)//(k-1)))\n'] | ['Runtime Error', 'Accepted'] | ['s784053475', 's142369117'] | [4724.0, 13880.0] | [25.0, 41.0] | [172, 86] |
p03319 | u028973125 | 2,000 | 1,048,576 | There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N. On this sequence, Snuke can perform the following operation: * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements. Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable. | ['import sys\n\ninput = sys.stdin.readline\nN, K = map(int, input().split())\nA = list(map(int, input().split()))\n\npos = A.index(1)\nprint(pos)\nans = 0\nleft = pos\nwhile 0 < left:\n left -= K - 1\n ans += 1\nright = pos\nwhile right < N - 1:\n right += K - 1\n ans += 1\n\nprint(ans)', 'import sys\n\ninput = sys.stdin.readline\nN, K = map(int, input().split())\nA = list(map(int, input().split()))\n\nprint((N-2) // (K-1) + 1)'] | ['Wrong Answer', 'Accepted'] | ['s895504744', 's089189890'] | [20568.0, 20796.0] | [56.0, 50.0] | [279, 134] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.