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
p02597
u665452497
2,000
1,048,576
An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n...
["def main():\n N=int(input())\n c=list(input())[::-1]\n \n #x...WR\n #o...RR, RW, WW\n \n \n \n res=0\n cR=c.count('R')\n cW=c.count('W')\n \n l,r=0,N-1\n while True:\n if c[l]=='W':\n if c[r]=='R':\n c[l],c[r]='R','W'\n res+=1\n...
['Runtime Error', 'Accepted']
['s640232631', 's065299848']
[11972.0, 10748.0]
[84.0, 63.0]
[506, 500]
p02597
u667687319
2,000
1,048,576
An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n...
["n = int(input())\nc = input()\n\nwi = c.find('W')\nri = c.rfind('R')\n\nif wi == -1 or ri == -1:\n print(0)\nelse:\n ans = 0\n while wi < ri:\n wi += 1\n wi = c[wi:].find('W')\n ri = c[:ri].rfind('R')\n ans += 1\n\n print(ans, c)", "n = int(input())\nc = input()\n\nwi = c.find(...
['Wrong Answer', 'Accepted']
['s160290566', 's775653902']
[9352.0, 9312.0]
[1548.0, 1107.0]
[253, 255]
p02597
u682271925
2,000
1,048,576
An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n...
['def main():\n n = int(input())\n li = list(input())\n i = 0\n j = n-1\n ans = 0\n while(i < j):\n while(li[i] == "R" and i < j):\n i += 1\n while(li[j] == "W" and i < j):\n j -= 1\n li[i] = "R"\n li[j] = "W"\n ans += 1\n print(ans)\n\n\nif __name__ == \'__main__\':\n main()', 'def mai...
['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s171098598', 's449299088', 's557167612', 's912925898']
[10780.0, 141220.0, 9040.0, 10500.0]
[66.0, 3659.0, 29.0, 67.0]
[287, 345, 332, 334]
p02597
u690184681
2,000
1,048,576
An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n...
["N = int(input())\nc = input()\n\nleft = 0\nright = len(c)-1\n\ncount=0\nif (right+1)%2==0:\n while (left-1)!=right:\n print(right,left)\n if c[left]=='R':\n left+=1 \n elif c[right]=='W':\n right-=1\n elif c[left]=='W' and c[right]=='R':\n left+=1\n ...
['Wrong Answer', 'Accepted']
['s876719059', 's292501293']
[9524.0, 9476.0]
[169.0, 72.0]
[594, 560]
p02597
u744920373
2,000
1,048,576
An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n...
['import sys\nsys.setrecursionlimit(10**8)\ndef ii(): return int(sys.stdin.readline())\ndef mi(): return map(int, sys.stdin.readline().split())\ndef li(): return list(map(int, sys.stdin.readline().split()))\ndef li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]\ndef dp2(ini, i, j): return ...
['Runtime Error', 'Accepted']
['s323412105', 's637952644']
[9228.0, 9504.0]
[23.0, 61.0]
[1267, 705]
p02597
u756782069
2,000
1,048,576
An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n...
["N = int(input())\nc = input()\nW = c.count('W')\nprint(c[:R].count('W'))", "N = int(input())\nc = input()\nW = c.count('W')\nR = c.count('R')\nprint(c[:R].count('W'))"]
['Runtime Error', 'Accepted']
['s104848919', 's976671977']
[9448.0, 9452.0]
[25.0, 29.0]
[69, 86]
p02597
u770308589
2,000
1,048,576
An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n...
['N = int(input())\nA = list(input())\nprint(C[:C.count(\'R\')].count("W"))\n', 'n = int(input())\nC = input()\nprint(C[:C.count(\'R\')].count("W"))']
['Runtime Error', 'Accepted']
['s761702834', 's877961022']
[10748.0, 9392.0]
[29.0, 30.0]
[70, 63]
p02597
u788068140
2,000
1,048,576
An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n...
['# N = 8\n# S = "WRWWRWRR"\n#\n# N = 2\n# S = "RR"\n#\n# N = 4\n# S = "WWRR"\n\nN = int(input())\nS = input()\n\n# N = 2\n# S = "WW"\n\ndef calculate(n, s):\n arr = list(s)\n\n RNum = arr.count("R")\n\n leftW = 0\n rightR = RNum\n\n result = []\n for i in range(n):\n if arr[i] == "R":\n ...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s117670339', 's896675080', 's383159268']
[18548.0, 8976.0, 18848.0]
[98.0, 25.0, 93.0]
[532, 323, 463]
p02597
u794066762
2,000
1,048,576
An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n...
["n=int(input())\ns=input()\nif s.count('R')==0 or s.count('W')==0:\n print(0)\nelse:\n a= s.count('W')\n w=s.index('W')\n b= s[w:].count('R')\n if b==0:\n print(0)\n else:\n c = s[(w+1):].count('W')\n t=min(b,c)\n print(min(t,a))\n\n", "n=int(input())\ns=input()\nif s.coun...
['Wrong Answer', 'Accepted']
['s727712877', 's065152865']
[9428.0, 9468.0]
[34.0, 34.0]
[263, 160]
p02597
u802234211
2,000
1,048,576
An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n...
['N = int(input())\nstone = list(map(str,input()))\nind = [""]*2\nind[0] = list()\nind[1] = list()\nR = 0\nW = 0\nfor i in range(N):\n if(stone[i]=="W"):\n ind[0].append(i)\n W += 1\n else:\n ind[1].append(i)\n R += 1\nind[1].reverse()\nans = 0\n\nif(W != R):\n print(min(W,R))\nelse...
['Runtime Error', 'Accepted']
['s898184182', 's633571859']
[18640.0, 20324.0]
[99.0, 125.0]
[405, 617]
p02597
u805011545
2,000
1,048,576
An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n...
["import sys\nN = int(input())\nc = [str(x) for x in list(input())]\nR = sum([1 for i, x in enumerate(c) if(x=='R')])\nW = 0\nif(R==N)or(R==0):\n print(0)\n sys.exit()\nans = R\ni = 0\nwhile True:\n if(c[i] == 'W'):\n W += 1\n else:\n R -= 1\n n_ans = max(W,R)\n if(n_ans>ans):\n print(ans)\n sys.exit(...
['Runtime Error', 'Accepted']
['s022643164', 's946875427']
[12356.0, 12348.0]
[133.0, 138.0]
[325, 366]
p02597
u811143577
2,000
1,048,576
An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n...
["N = int(input())\nS = list(input().strip())\n\nr = S.count('R')\nw = S.count('W')\n\nans = min(r, w)\n\nri = S.index('R')\nr2 = S[ri:].count('W')\n\nans = min(ans, r2)\nprint(ans)\n\n", "N = int(input())\nS = list(input().strip())\n\nr = S.count('R')\nw = S.count('W')\n\nans = min(r, w)\n\nri = S.index('R')\nr2 = S[:...
['Runtime Error', 'Runtime Error', 'Accepted']
['s243451351', 's876933040', 's179335702']
[12072.0, 12092.0, 10768.0]
[44.0, 38.0, 100.0]
[169, 195, 270]
p02597
u813993459
2,000
1,048,576
An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n...
['import collections\n\nc=input()\n\ntmp=collections.Counter(c)\n\ncount_r=0\ncount_w=0\nans=0\ndis_r=0\n\nfor i in c:\n if dis_r == tmp["R"]:\n break\n \n elif i == "W":\n if count_r<=tmp["R"]-count_r:\n ans+=1\n dis_r+=1\n else:\n count_r+=1\n dis_r+=1...
['Wrong Answer', 'Accepted']
['s148928739', 's624265322']
[9384.0, 9592.0]
[26.0, 93.0]
[308, 343]
p02597
u823885866
2,000
1,048,576
An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n...
["import sys\nimport math\nimport itertools\nimport collections\nimport heapq\nimport re\nimport numpy as np\nfrom functools import reduce\n\nrr = lambda: sys.stdin.readline().rstrip()\nrs = lambda: sys.stdin.readline().split()\nri = lambda: int(sys.stdin.readline())\nrm = lambda: map(int, sys.stdin.readline().split())...
['Wrong Answer', 'Accepted']
['s801886983', 's043912815']
[27260.0, 27292.0]
[114.0, 167.0]
[444, 697]
p02597
u844789719
2,000
1,048,576
An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n...
["import itertools\nN = int(input())\nS = input()\ncnt = 0\nwhile True:\n while i < N and S[i] == 'R':\n i += 1\n while 0 <= j and S[j] == 'W':\n j -= 1\n if j < i:\n break\n cnt += 1\n i += 1\n j -= 1\nprint(cnt)\n", "import itertools\nN = int(input())\nS = input()\ncnt = i = 0\n...
['Runtime Error', 'Accepted']
['s312600496', 's461973706']
[9436.0, 9416.0]
[27.0, 89.0]
[237, 251]
p02597
u854294899
2,000
1,048,576
An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n...
["import sys\ninput = sys.stdin.readline\nn = int(input())\ns = list(input())\nans = 0\nfor i in range(n - 1):\n idx = n - 1 - i\n if s[idx] == 'W' and s[idx + 1] == 'R':\n ans += 1\n s[idx] = 'R'\nprint(ans)", "import sys\ninput = sys.stdin.readline\nn = int(input())\ns = input()\nans = 0\nfor i in range(n - 1...
['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s376158883', 's784612471', 's907730111', 's228500145']
[10768.0, 9328.0, 9336.0, 24816.0]
[91.0, 71.0, 61.0, 231.0]
[204, 199, 162, 402]
p02597
u865343871
2,000
1,048,576
An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n...
["N = int(input())\nC = list(input())\nW = 0\nR = 0\nfor i in range(int(N/2)+1):\n if C[i] == 'W':\n W += 1\nfor i in range(int(N/2+1),N):\n if C[i] == 'R':\n R += 1\nif W>R:\n print(R)\nelse:\n print(W)\n\n", "N = int(input())\nC = list(input())\nW = 0\nR = 0\nfor i in range(0,int(N/2+1)):\n ...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s024144384', 's181334267', 's492627909', 's542794107', 's925034577']
[10748.0, 10660.0, 10668.0, 10692.0, 18624.0]
[59.0, 58.0, 103.0, 2206.0, 94.0]
[216, 222, 269, 334, 302]
p02597
u874644572
2,000
1,048,576
An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n...
["n = int(input())\ns = input()\nl = 0\nr = n - 1\nans = 0\nwhile l < r:\n while l < r && s[l] == 'R':\n l += 1\n while l < r && s[r] == 'W':\n r -= 1\n ans += 1\n l += 1\n r -= 1\n\nprint(ans)", "n = int(input())\ns = input()\nl = 0\nr = n - 1\nans = 0\n\nwhile l < r:\n while l < r and ...
['Runtime Error', 'Accepted']
['s554171609', 's196392707']
[8976.0, 9332.0]
[23.0, 66.0]
[206, 238]
p02597
u888092736
2,000
1,048,576
An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n...
['from collections import Counter\n\n\nN = int(input())\nC = input()\nC_cntr = Counter(C)\n\nans = 0\nfor i in range(C_cntr["R"]):\n\u3000if C[i] == "W":\n ans += 1\n\nprint(ans)\n', 'from collections import Counter\n\n\nN = int(input())\nc = input()\ncntr = Counter(c)\n\nans = 0\nfor c, r in zip(c, "R" * cntr["...
['Runtime Error', 'Accepted']
['s539962175', 's255685042']
[8844.0, 9712.0]
[20.0, 53.0]
[169, 170]
p02597
u891202624
2,000
1,048,576
An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n...
['N=int(input())\nc=list(input())\nprint(c)\ni=0\ncount1=0\ncount2=0\nfor i in c:\n if i=="R":\n count1+=1\nfor j in range(count1):\n if c[j]=="R":\n count2+=1\nprint(count1-count2)', 'N=int(input())\nc=list(input())\ni=0\ncount1=0\ncount2=0\nfor i in c:\n if i=="R":\n count1+=1\nfor j in ...
['Wrong Answer', 'Accepted']
['s787624228', 's234179441']
[12304.0, 10740.0]
[89.0, 80.0]
[187, 178]
p02597
u909359131
2,000
1,048,576
An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n...
['n=int(input())\na=input()\nprint(a)\na=list(a)\nprint(a)\nt=0\ns=0\nfor i in range(0,n):\n if a[i]=="R":\n t=t+1\n\nfor i in range(0,t):\n if a[i]!="R":\n s=s+1\nprint(s)', 'n=int(input())\na=input()\nprint(a)\na=list(a)\nprint(a)\nt=0\ns=0\nfor i in range(0,n):\n if a[i]=="R":\n t=t+1\n...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s386281582', 's434138611', 's886167073']
[12556.0, 12612.0, 10684.0]
[83.0, 84.0, 74.0]
[176, 175, 160]
p02597
u909514237
2,000
1,048,576
An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n...
["N = int(input())\nc = input()\nW = 0\nR = c.count('R')\nif R == 0 or W == 0:\n print(0)\n exit()\n\nans = N\nt = 0\nfor i in range(N):\n if c[i] == 'W':\n W += 1\n else:\n R -= 1\n t = max(R,W)\n ans = min(ans, t)\nprint(ans)", 'N = int(input())\nc = input()\n\nR_r = c.count("R")\nW_l = 0\nans = N\nfor i ...
['Wrong Answer', 'Accepted']
['s204432210', 's190312750']
[9288.0, 9400.0]
[28.0, 129.0]
[220, 213]
p02597
u911619829
2,000
1,048,576
An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n...
["N = int(input())\nC=list(input())\nL=0\nR=0\nRR=0\nX=0\n for i in range(N):\n L=i\n R=RR\n if L>=N-1-R:\n break\n if C[i]=='W':\n for ii in range(N-L-R):\n if C[N-1-R-ii]=='R':\n C[L]='R'\n C[N-1-R-ii]='W'\n X+=1\n b...
['Runtime Error', 'Accepted']
['s194747961', 's741073785']
[8964.0, 18212.0]
[25.0, 128.0]
[377, 202]
p02597
u914214809
2,000
1,048,576
An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n...
['widx = []\nridx = []\ns = input()\nfor i, char in enumerate(s):\n if char == "W":\n widx.append(i)\n else:\n ridx.append(i)\ncount = 0\ni = 0\nj = len(ridx) - 1\nwhile i < len(widx) and j >= 0 and widx[i] < ridx[j]:\n i += 1\n j -= 1\n count += 1\nprint(count)\n ', 'widx = []\nridx = []\nn = int(input())\...
['Wrong Answer', 'Accepted']
['s779174097', 's351959830']
[9048.0, 17292.0]
[28.0, 104.0]
[259, 273]
p02597
u919730120
2,000
1,048,576
An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n...
["n=int(input())\nc=list(input())\nl,r=0,n-1\nans=0\nwhile l<r:\n while c[l]!='W':\n l+=1\n if l>n-1:\n break\n while c[r]!='R' or r>=0:\n r-=1\n if r<0:\n break\n if l<r:\n ans+=1\n l+=1\n r-=1\nprint(ans)", "n=int(input())\nc=list(input()...
['Wrong Answer', 'Accepted']
['s330153294', 's511735907']
[10784.0, 10772.0]
[91.0, 69.0]
[267, 259]
p02597
u922769680
2,000
1,048,576
An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n...
['n=int(input())\nC=list(input())\nif C.count("W")==0:\n print(0)\nelif C.count("W")==1:\n if C[-1]=="W":\n print(0)\n else:\n print(1)\nelse:\n if n%2==0:\n tmpw=C.count("W")\n print(tmpw,C)\n C=C[tmpw:]\n print(tmpw,C)\n print(C.count("R"))\n else:\n ...
['Wrong Answer', 'Accepted']
['s457047375', 's085823997']
[12464.0, 11868.0]
[63.0, 43.0]
[429, 414]
p02597
u928784113
2,000
1,048,576
An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n...
['import itertools\nfrom collections import deque,defaultdict,Counter\nfrom itertools import accumulate\nimport bisect\nfrom heapq import heappop,heappush,heapify\nimport math\nfrom copy import deepcopy\nimport queue\nimport numpy as np\n\nMod = 1000000007\nfact = [1, 1]\nfactinv = [1, 1]\ninv = [0, 1] \nfor i in range...
['Wrong Answer', 'Accepted']
['s234902171', 's807233314']
[39252.0, 38708.0]
[244.0, 219.0]
[2164, 2158]
p02597
u941644149
2,000
1,048,576
An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n...
['n = int(input())\nC = input()\nc_R = 0\nc_W = 0\nfor c in C:\n if c == "R": c_R += 1\n else: c_W += 1\nans = min(c_R, c_W)\n\n\nif C[0] + C[1] == "WR":\n C[2:].find("WR") != -1:\n C = list(C)\n C[0] = "R"\n C[C[2:].find("WR") + 1] = "W"\n C = "".join(C)\n \nind1 = C.find("RWR")\nif ind1 != -1:...
['Runtime Error', 'Accepted']
['s102021982', 's561313406']
[9036.0, 9336.0]
[27.0, 137.0]
[705, 209]
p02597
u942356554
2,000
1,048,576
An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n...
['n = int(input())\nc = list(input())\nc = c[::-1]\ncou = 0\nfor i in range(len(c)/2):\n if c[i] == "R":\n cou += 1\nprint(cou)', 'n = int(input())\nc = list(input())\nc2 = c[::-1]\ncou = 0\nfor i in range(len(c)//2):\n if c2[i] == "R":\n cou += 1\nfor i in range(len(c)//2):\n if c[i] == "W":\n ...
['Runtime Error', 'Wrong Answer', 'Accepted']
['s134025814', 's641451652', 's553376670']
[12056.0, 11944.0, 11844.0]
[29.0, 63.0, 40.0]
[128, 225, 69]
p02597
u953379577
2,000
1,048,576
An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n...
['import collections as c\nn = int(input())\ns = list(input())\ncnt = 0\n\nwhile c.Counter(s[:cnt+1])["W"]<c.Counter(s[cnt:])["R"]:\n cnt += 1\n \nprint(cnt)', 'n = int(input())\ns = list(input())\ncnt = 0\nfor i in s:\n if i == "R":\n cnt += 1\n else:\n break\n\na = s.count("R")-cnt\nb = 0\n\...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s498647946', 's742036698', 's746724854']
[12504.0, 12180.0, 9452.0]
[2206.0, 2206.0, 31.0]
[153, 214, 77]
p02597
u958869885
2,000
1,048,576
An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n...
["n = int(input())\nc = list(map(int, input().split()))\nleft = 0\ncnt = 0\nright = len(c) - 1\nwhile left < n and right >=0 and left < right:\n\twhile left < n and c[left] != 'W':\n\t\tleft += 1\n\twhile right >= 0 and c[right] != 'R':\n\t\tright -= 1\n\tif left< n and right >= 0 and left<right:\n\t\tc[left], c[right]...
['Runtime Error', 'Accepted']
['s872118252', 's900780982']
[9340.0, 10756.0]
[28.0, 92.0]
[367, 394]
p02597
u975997984
2,000
1,048,576
An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n...
["C = list(input())\nC_ = sorted(C)\n\nwr = rw = 0\nfor i in range(len(C_)):\n if C[i] != C_[i]:\n if C[i] == 'R' and C_[i] == 'W':\n rw += 1\n else:\n wr += 1\n\nprint(max(wr, rw))\n", "N = int(input())\nC = list(input())\nC_ = sorted(C)\n\nwr = rw = 0\nfor i in range(len(C_)):\n...
['Wrong Answer', 'Accepted']
['s694333776', 's736178555']
[8992.0, 12700.0]
[30.0, 78.0]
[208, 225]
p02597
u981418135
2,000
1,048,576
An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n...
['n = int(input())\nc = input()\nna = len(c)\nred = 0\nwhi = 0\n\ncou_start = 0\ncou = 0\nfor i in reversed(range(0,na)):\n if c[i] == "W":\n whi += 1\n if cou_start == 1:\n cou += 1\n else:\n red += 1\n \n #print(red,whi,cou)\n \n if red >= 2 and whi >= 1:\n ...
['Wrong Answer', 'Accepted']
['s503738034', 's498284694']
[9496.0, 10604.0]
[84.0, 48.0]
[387, 141]
p02597
u998741086
2,000
1,048,576
An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not n...
["#!/usr/bin/env python3\nimport time\n\nk = int(input())\ns = ''\n\nrs = []\n\nstart = time.time()\ncnt = 0 \nwhile True:\n cnt += 1\n s += '7' \n n = int(s)\n r = n%k \n if r==0:\n print(cnt)\n exit()\n\n if r in rs: \n print(-1)\n end = time.time()\n exit()\n\n ...
['Wrong Answer', 'Accepted']
['s417161395', 's172900511']
[9456.0, 12024.0]
[1829.0, 42.0]
[400, 209]
p02598
u017415492
2,000
1,048,576
We have N logs of lengths A_1,A_2,\cdots A_N. We can cut these logs at most K times in total. When a log of length L is cut at a point whose distance from an end of the log is t (0<t<L), it becomes two logs of lengths t and L-t. Find the shortest possible length of the longest log after at most K cuts, and print it a...
['import math\nn,k=map(int,input().split())\na=list(map(int,input().split()))\n\nx0, x1 = 0, 10**9\nwhile x0 + 1 < x1:\n x = (x0+x1)//2\n suma=0\n for i in a:\n suma += (a//x)\n \n if suma > k:\n x0 = x\n else:\n x1 = x\nprint(x1)', 'import math\nn,k=map(int,input().split())\na=list(map(int,input().sp...
['Runtime Error', 'Accepted']
['s405945997', 's847226089']
[30916.0, 31232.0]
[71.0, 1036.0]
[231, 280]
p02598
u019685451
2,000
1,048,576
We have N logs of lengths A_1,A_2,\cdots A_N. We can cut these logs at most K times in total. When a log of length L is cut at a point whose distance from an end of the log is t (0<t<L), it becomes two logs of lengths t and L-t. Find the shortest possible length of the longest log after at most K cuts, and print it a...
['from math import ceil\n\nN, K = map(int, input().split())\nA = list(map(int, input().split()))\n\n\ndef check(l):\n cnt = sum(ceil(a / l) - 1 for a in A)\n return cnt <= K\n\nlb, ub = 0, max(A)\nfor _ in range(100):\n mid = (lb + ub) / 2\n if check(mid):\n ub = mid\n else:\n lb = mid\npri...
['Wrong Answer', 'Accepted']
['s839839858', 's558215275']
[31104.0, 31156.0]
[2206.0, 1429.0]
[314, 312]
p02598
u022979415
2,000
1,048,576
We have N logs of lengths A_1,A_2,\cdots A_N. We can cut these logs at most K times in total. When a log of length L is cut at a point whose distance from an end of the log is t (0<t<L), it becomes two logs of lengths t and L-t. Find the shortest possible length of the longest log after at most K cuts, and print it a...
["from math import ceil, floor\n\n\ndef main():\n n, k = map(int, input().split())\n a = list(map(int, input().split()))\n a.sort()\n lower = 1\n upper = 10 ** 9 + 7\n while upper - lower >= 1:\n target = (lower + upper) / 2\n now = 0\n for i in range(n):\n now += ceil(...
['Wrong Answer', 'Accepted']
['s160489860', 's648959122']
[31032.0, 31056.0]
[1168.0, 756.0]
[497, 442]
p02598
u065079240
2,000
1,048,576
We have N logs of lengths A_1,A_2,\cdots A_N. We can cut these logs at most K times in total. When a log of length L is cut at a point whose distance from an end of the log is t (0<t<L), it becomes two logs of lengths t and L-t. Find the shortest possible length of the longest log after at most K cuts, and print it a...
['import math \nN,K=map(int,input().split())\nA=[int(x) for x in input().split()]\nA=sorted(A)\nleft=0\nright=max(A)\nmid=max((left+right)//2,1)\n\nwhile(right-left>=1):\n numofcut=0\n mid=(left+right)//2\n for i in range(N):\n if A[i]%mid==0:\n numofcut+=A[i]//mid -1\n else:\n ...
['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted']
['s052693275', 's292746929', 's594315722', 's969660161', 's680090824']
[30928.0, 31152.0, 31044.0, 31044.0, 30988.0]
[1980.0, 1603.0, 1853.0, 1641.0, 1631.0]
[452, 398, 427, 425, 400]
p02598
u067937922
2,000
1,048,576
We have N logs of lengths A_1,A_2,\cdots A_N. We can cut these logs at most K times in total. When a log of length L is cut at a point whose distance from an end of the log is t (0<t<L), it becomes two logs of lengths t and L-t. Find the shortest possible length of the longest log after at most K cuts, and print it a...
['\nimport sys\n\n\ndef main():\n """Main program."""\n log_count, cut_count = (int(i) for i in sys.stdin.readline().split())\n logs = [int(i) for i in sys.stdin.readline().split()]\n high = max(logs)\n low = 1\n soln = high\n # Binary search for the answer.\n while low < high:\n mid = (l...
['Wrong Answer', 'Accepted']
['s309953319', 's864074048']
[30944.0, 31000.0]
[376.0, 1143.0]
[710, 705]
p02598
u072717685
2,000
1,048,576
We have N logs of lengths A_1,A_2,\cdots A_N. We can cut these logs at most K times in total. When a log of length L is cut at a point whose distance from an end of the log is t (0<t<L), it becomes two logs of lengths t and L-t. Find the shortest possible length of the longest log after at most K cuts, and print it a...
["import sys\nread = sys.stdin.read\nreadlines = sys.stdin.readlines\nfrom math import ceil\nfrom heapq import heapify,heappop,heappush\ndef main():\n n, k, *a = map(int, read().split())\n minusa = [-ae for ae in a]\n\n heapify(minusa)\n while k > 0:\n maxa = heappop(minusa)\n heappush(minusa,...
['Runtime Error', 'Accepted']
['s841577138', 's462113572']
[158220.0, 31108.0]
[2370.0, 837.0]
[456, 700]
p02598
u078982327
2,000
1,048,576
We have N logs of lengths A_1,A_2,\cdots A_N. We can cut these logs at most K times in total. When a log of length L is cut at a point whose distance from an end of the log is t (0<t<L), it becomes two logs of lengths t and L-t. Find the shortest possible length of the longest log after at most K cuts, and print it a...
['n, k = map(int, input().split())\nA = list(map(int, input().strip().split()))\n\nb = 0\ne = max(A)\nL = e // 2\nwhile e - b >= 1:\n m = sum(list(map(lambda x: x // L, A)))\n if m <= k:\n e = L\n L = (e + b) // 2\n else:\n b = L\n L = (e + b) // 2\nprint(e)\n', 'n, k = map(int, inp...
['Runtime Error', 'Accepted']
['s780031985', 's859642820']
[30548.0, 30800.0]
[2206.0, 674.0]
[280, 256]
p02598
u085717502
2,000
1,048,576
We have N logs of lengths A_1,A_2,\cdots A_N. We can cut these logs at most K times in total. When a log of length L is cut at a point whose distance from an end of the log is t (0<t<L), it becomes two logs of lengths t and L-t. Find the shortest possible length of the longest log after at most K cuts, and print it a...
['#!/usr/bin/env python\n# coding: utf-8\n\n# In[16]:\n\n\nN,K = map(int, input().split())\nA = list(map(int, input().split()))\n\n\n# In[23]:\n\n\nmax(A)\ncnt\n\n\n# In[41]:\n\n\ncnt = 0\nlow = 0\nhigh = max(A)\nans = max(A)\nold = int(high)\nmycount = 0\nwhile low < high:\n mid = (high+low)/2\n cnt = sum([(x-0....
['Runtime Error', 'Accepted']
['s449742254', 's016105768']
[30992.0, 30888.0]
[73.0, 616.0]
[544, 414]
p02598
u094102716
2,000
1,048,576
We have N logs of lengths A_1,A_2,\cdots A_N. We can cut these logs at most K times in total. When a log of length L is cut at a point whose distance from an end of the log is t (0<t<L), it becomes two logs of lengths t and L-t. Find the shortest possible length of the longest log after at most K cuts, and print it a...
['n,k=map(int,input().split())\nA = list(map(int, input().split()))\nr = max(A)\nl = 0\nwhile l+1<r:\n mid=(l+r)//2\n if sum([a-1]//mid for a in A)>k:\n l=mid\n else:\n r = mid\nprint(r)\n', 'n,k=map(int,input().split())\nA = list(map(int, input().split()))\nr = max(A)\nl = 0\nwhile l+1<r:\n mid=(l+r)//2\n i...
['Runtime Error', 'Accepted']
['s509530157', 's699626203']
[30644.0, 30708.0]
[71.0, 563.0]
[184, 185]
p02598
u123579949
2,000
1,048,576
We have N logs of lengths A_1,A_2,\cdots A_N. We can cut these logs at most K times in total. When a log of length L is cut at a point whose distance from an end of the log is t (0<t<L), it becomes two logs of lengths t and L-t. Find the shortest possible length of the longest log after at most K cuts, and print it a...
['import numpy as np\nN,K = map(int, input().split()) \nLogs = np.array([int(x) for x in input().split()])\ncut = [1]*N\nchip = Logs.copy()\nfor i in range(K):\n x = np.argmax(chip)\n cut[x]+=1\n chip[x]= Logs[x]/cut[x]\n\nprint(int(max(chip)))', 'import numpy as np\nN,K = map(int, input().split()) \nLogs = np.array...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s701619578', 's747274719', 's108921571']
[48700.0, 49372.0, 49464.0]
[2206.0, 2206.0, 698.0]
[235, 229, 264]
p02598
u131881594
2,000
1,048,576
We have N logs of lengths A_1,A_2,\cdots A_N. We can cut these logs at most K times in total. When a log of length L is cut at a point whose distance from an end of the log is t (0<t<L), it becomes two logs of lengths t and L-t. Find the shortest possible length of the longest log after at most K cuts, and print it a...
['\nn,k=map(int,input().split())\na=list(map(int,input().split()))\nif k==0:\n print(max(a))\n exit()\na.sort()\nleft,right=0,a[n-1]\nmid=right\nwhile abs(right-left)>1:\n mid=(left+right)//2\n temp=0\n for i in range(n-1,-1,-1):\n if a[i]<=mid: break\n temp+=a[i]//mid\n if temp>k: left=...
['Wrong Answer', 'Accepted']
['s476967514', 's922648088']
[30776.0, 30852.0]
[1370.0, 1926.0]
[337, 558]
p02598
u133936772
2,000
1,048,576
We have N logs of lengths A_1,A_2,\cdots A_N. We can cut these logs at most K times in total. When a log of length L is cut at a point whose distance from an end of the log is t (0<t<L), it becomes two logs of lengths t and L-t. Find the shortest possible length of the longest log after at most K cuts, and print it a...
['f=lambda:[*map(int,input().split())]\nn,k=f()\na=f()\na=[i*100 for i in a]\n# Binary Search\ndef ok(x):\n c=0\n for i in a:\n c+=0--i//x\n return c<=n+k\nl,r=0,10**11+1\nwhile r-l>1:\n m=l+r>>1\n if ok(m): r=m\n else: l=m\nprint(l,r)\nt=0--r//100\nprint(t-ok(t-1) if t>1 else t)', 'n,k,*a=map(int,open...
['Wrong Answer', 'Accepted']
['s808357055', 's174169537']
[30844.0, 31752.0]
[1365.0, 642.0]
[278, 133]
p02598
u135389999
2,000
1,048,576
We have N logs of lengths A_1,A_2,\cdots A_N. We can cut these logs at most K times in total. When a log of length L is cut at a point whose distance from an end of the log is t (0<t<L), it becomes two logs of lengths t and L-t. Find the shortest possible length of the longest log after at most K cuts, and print it a...
['n, k = map(int, input().split())\na = list(map(int, input().split()))\n \nfloor = 1\nceil = max(a)\nL = (ceil + floor)//2\n \n \ndef cut(long, logs):\n cnt = 0\n for i in logs:\n cnt += (i / long) - 1\n if i % long != 0:\n cnt += 1\n return cnt\n \n \nwhile ceil - floor > 1:\n L =...
['Wrong Answer', 'Accepted']
['s403381368', 's169300657']
[30892.0, 31020.0]
[819.0, 946.0]
[413, 361]
p02598
u137061893
2,000
1,048,576
We have N logs of lengths A_1,A_2,\cdots A_N. We can cut these logs at most K times in total. When a log of length L is cut at a point whose distance from an end of the log is t (0<t<L), it becomes two logs of lengths t and L-t. Find the shortest possible length of the longest log after at most K cuts, and print it a...
['n, k = map(int, input().split())\na = list(map(int, input().split()))\n\nlow = 0\nhigh = max(a)\n\nwhile low + 1 < high:\n print(low, high)\n mid = (low + high) // 2\n m = 0\n for x in a:\n m += (x - 1) // mid\n \n if m <= k:\n high = mid\n else:\n low = mid\n\nprint(high)', ...
['Wrong Answer', 'Accepted']
['s351369602', 's700086182']
[30796.0, 30872.0]
[813.0, 936.0]
[297, 276]
p02598
u151785909
2,000
1,048,576
We have N logs of lengths A_1,A_2,\cdots A_N. We can cut these logs at most K times in total. When a log of length L is cut at a point whose distance from an end of the log is t (0<t<L), it becomes two logs of lengths t and L-t. Find the shortest possible length of the longest log after at most K cuts, and print it a...
['import math\n\nn , k = map(int, input().split())\na = list(map(int,input().split()))\na.sort()\n\nleft=a[0]\nright=a[n-1]\nmid = (left+right)/2\nwhile right - left > 1:\n times = 0\n for i in range(n):\n times+=math.ceil(a[i]/mid)-1\n if times<=k:\n right=mid\n mid=(left+right)/2\n el...
['Wrong Answer', 'Accepted']
['s467687404', 's167093546']
[31072.0, 31080.0]
[1933.0, 1613.0]
[376, 366]
p02598
u180172332
2,000
1,048,576
We have N logs of lengths A_1,A_2,\cdots A_N. We can cut these logs at most K times in total. When a log of length L is cut at a point whose distance from an end of the log is t (0<t<L), it becomes two logs of lengths t and L-t. Find the shortest possible length of the longest log after at most K cuts, and print it a...
['import math\nn,k = map(int,input().split())\na_list = list(map(int,input().split()))\n\nmin_num = 1\nmax_num = 10**9+1\nwhile True:\n print(min_num)\n x = int((min_num+max_num)/2)\n if sum([math.ceil(a/x)-1 for a in a_list])>k:\n min_num = x\n else:\n max_num = x\n if max_num-min_num<=1:\...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s863848174', 's940555103', 's228855918']
[31088.0, 31104.0, 30940.0]
[1047.0, 1107.0, 1117.0]
[430, 440, 431]
p02598
u202560873
2,000
1,048,576
We have N logs of lengths A_1,A_2,\cdots A_N. We can cut these logs at most K times in total. When a log of length L is cut at a point whose distance from an end of the log is t (0<t<L), it becomes two logs of lengths t and L-t. Find the shortest possible length of the longest log after at most K cuts, and print it a...
["import numpy as np\n\nN, K = [int(x) for x in input().split()]\nA = np.array([int(x) for x in input().split()])\n\nL = np.max(A)\n\nans = L\nlow = 1\nhigh = L\nwhile 1:\n print(str(low) + ' ' + str(high))\n if low == high:\n ans = low\n break\n mid = (low + high) // 2\n if np.sum(A // mid) <...
['Wrong Answer', 'Accepted']
['s533176594', 's938538625']
[49432.0, 49300.0]
[225.0, 241.0]
[369, 364]
p02598
u211706121
2,000
1,048,576
We have N logs of lengths A_1,A_2,\cdots A_N. We can cut these logs at most K times in total. When a log of length L is cut at a point whose distance from an end of the log is t (0<t<L), it becomes two logs of lengths t and L-t. Find the shortest possible length of the longest log after at most K cuts, and print it a...
['from math import ceil\n\nm=1\nM=10**9\n\nN,K=map(int,input().split())\nA=list(map(int,input().split()))\n\ndef OK(k):\n if sum([ceil(a/k) for a in A])<=K:\n return True\n else:\n return False\n\nwhile M-m>1:\n p=(m+M)//2\n if OK(p):\n m=p\n else:\n M=p\nprint(m)', 'from math...
['Wrong Answer', 'Accepted']
['s309735963', 's062225120']
[31044.0, 31108.0]
[735.0, 527.0]
[285, 287]
p02598
u226849101
2,000
1,048,576
We have N logs of lengths A_1,A_2,\cdots A_N. We can cut these logs at most K times in total. When a log of length L is cut at a point whose distance from an end of the log is t (0<t<L), it becomes two logs of lengths t and L-t. Find the shortest possible length of the longest log after at most K cuts, and print it a...
['import math\n\nN,K = map(int,input().split())\n\na = list(map(int, input().split()))\nl = 0\nr = max(a)\n\nx = (l+r)//2\nans = r+1\nwhile(r>1+l):\n print(str(l)+":"+str(r))\n x = (l+r)//2\n count = 0\n for i in range(N):\n count += math.ceil(a[i] /x)-1\n if (count <=K):\n if (ans > x):\n ...
['Runtime Error', 'Accepted']
['s785368736', 's650128473']
[31028.0, 31152.0]
[1531.0, 1520.0]
[493, 594]
p02598
u231095456
2,000
1,048,576
We have N logs of lengths A_1,A_2,\cdots A_N. We can cut these logs at most K times in total. When a log of length L is cut at a point whose distance from an end of the log is t (0<t<L), it becomes two logs of lengths t and L-t. Find the shortest possible length of the longest log after at most K cuts, and print it a...
['from math import ceil\nN, K = map(int,input().split())\nA = list(map(int,input().split()))\ndef chk(L):\n cnt = 0\n for i in range(N):\n cnt += ceil(A[i]/L)-1\n return cnt <= K\nl, r = 1, max(A)\nwhile l <= r:\n m = (l+r)//2\n if chk(m):\n r = m-1\n else:\n l = m+1\nprint(max([x...
['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted']
['s002187724', 's670891138', 's968034104', 's963013453']
[30952.0, 32016.0, 31160.0, 31000.0]
[1209.0, 1262.0, 1088.0, 1075.0]
[347, 361, 337, 347]
p02598
u231570044
2,000
1,048,576
We have N logs of lengths A_1,A_2,\cdots A_N. We can cut these logs at most K times in total. When a log of length L is cut at a point whose distance from an end of the log is t (0<t<L), it becomes two logs of lengths t and L-t. Find the shortest possible length of the longest log after at most K cuts, and print it a...
["import numpy as np\nfrom numba import jit\nverbose = False\n\nN, K = list(map(int, input().split()))\nA = np.array(list(map(int, input().split())), dtype=np.int64)\n\nul = np.ceil(np.sum(A)/(K))\nll= np.floor(np.max(A)/(K+1))\n\nEPS = 1 / 10**6\n\n@jit(nopython=True)\ndef cut(A, c, N):\n return (np.sum(np.ceil(A/c...
['Runtime Error', 'Accepted']
['s764363298', 's606548338']
[9044.0, 115384.0]
[29.0, 740.0]
[814, 981]
p02598
u259543319
2,000
1,048,576
We have N logs of lengths A_1,A_2,\cdots A_N. We can cut these logs at most K times in total. When a log of length L is cut at a point whose distance from an end of the log is t (0<t<L), it becomes two logs of lengths t and L-t. Find the shortest possible length of the longest log after at most K cuts, and print it a...
['N, M = input().strip().split()\nn, k = [int(N), int(M)]\na = list(map(int, input().strip().split()))\nle = 0\nri = 10000000000\nwhile ri - le > 1:\n mid = (le + ri) \n num = 0\n for i in a:\n num += (i-1) \n if num <= k:\n ri = mid\n else:\n le = mid\nprint(ri)\n', 'N, M = input()....
['Wrong Answer', 'Accepted']
['s696006999', 's335004382']
[30872.0, 30772.0]
[2205.0, 916.0]
[284, 292]
p02598
u266014018
2,000
1,048,576
We have N logs of lengths A_1,A_2,\cdots A_N. We can cut these logs at most K times in total. When a log of length L is cut at a point whose distance from an end of the log is t (0<t<L), it becomes two logs of lengths t and L-t. Find the shortest possible length of the longest log after at most K cuts, and print it a...
["def main():\n import sys\n def input(): return sys.stdin.readline().rstrip()\n n , k = map(int, input().split())\n a = list(map(int, input().split()))\n l = 0\n r = max(a)\n while l < r:\n m = (l+r)//2\n cnt = 0\n for x in a:\n cnt += (x-1)//m\n if cnt > k: ...
['Runtime Error', 'Wrong Answer', 'Accepted']
['s316244853', 's583412006', 's586023013']
[30944.0, 147624.0, 30832.0]
[2206.0, 2212.0, 492.0]
[392, 466, 445]
p02598
u284120954
2,000
1,048,576
We have N logs of lengths A_1,A_2,\cdots A_N. We can cut these logs at most K times in total. When a log of length L is cut at a point whose distance from an end of the log is t (0<t<L), it becomes two logs of lengths t and L-t. Find the shortest possible length of the longest log after at most K cuts, and print it a...
["import math\n\ndef main():\n N, K = map(int, input().split())\n A = list(map(int, input().split()))\n A = sorted(A, reverse=True)\n tA = []\n for a in A:\n tA.append((a, 1))\n\n for k in range(K):\n print('rope:' + str(k))\n a, diva = tA[1]\n b, divb = tA[0]\n prin...
['Runtime Error', 'Accepted']
['s832727675', 's317301007']
[127340.0, 30908.0]
[2340.0, 819.0]
[736, 443]
p02598
u288430479
2,000
1,048,576
We have N logs of lengths A_1,A_2,\cdots A_N. We can cut these logs at most K times in total. When a log of length L is cut at a point whose distance from an end of the log is t (0<t<L), it becomes two logs of lengths t and L-t. Find the shortest possible length of the longest log after at most K cuts, and print it a...
['n,k = map(int,input().split())\nA = list(map(int,input().split()))\nng = 0\nok = max(A)\n\ndef queri(n):\n count = 0\n for i in A:\n count += -(-i//n)\n if k>= count:\n return True\n else:\n return False\n\nwhile ok - ng > 1:\n mid = (ok+ng)//2\n if queri(mid) :\n ok = mi...
['Wrong Answer', 'Accepted']
['s695226200', 's646143758']
[30824.0, 30792.0]
[566.0, 665.0]
[339, 341]
p02598
u312514694
2,000
1,048,576
We have N logs of lengths A_1,A_2,\cdots A_N. We can cut these logs at most K times in total. When a log of length L is cut at a point whose distance from an end of the log is t (0<t<L), it becomes two logs of lengths t and L-t. Find the shortest possible length of the longest log after at most K cuts, and print it a...
['mport math\ndef check(lis,k,mid):\n\tfor i in lis:\n\t\tk-=(i//mid)\n\treturn k>=0\nn,k=map(int,input().split())\nlis=list(map(int,input().split()))\na,b=1,max(lis)\nans=b\nwhile(a<=b):\n\tmid=(a+b)/2\n\tif(check(lis,k,mid)):\n\t\tans=mid\n\t\tb=mid-0.000001\n\telse:\n\t\ta=mid+0.000001\nprint(int(math.ceil(ans)))', ...
['Runtime Error', 'Wrong Answer', 'Accepted']
['s308542179', 's429559838', 's265799568']
[8836.0, 30812.0, 30828.0]
[25.0, 387.0, 630.0]
[286, 255, 271]
p02598
u317423698
2,000
1,048,576
We have N logs of lengths A_1,A_2,\cdots A_N. We can cut these logs at most K times in total. When a log of length L is cut at a point whose distance from an end of the log is t (0<t<L), it becomes two logs of lengths t and L-t. Find the shortest possible length of the longest log after at most K cuts, and print it a...
["import sys\n\n\ndef resolve(in_):\n n = int(next(in_))\n c = next(in_).strip()\n\n ans = 0\n left = 0\n right = len(c) - 1\n while left < right:\n if c[left] == 'R':\n left += 1\n continue\n if c[right] == 'W':\n right -= 1\n continue\n ...
['Runtime Error', 'Accepted']
['s377204198', 's058226205']
[9192.0, 29368.0]
[20.0, 795.0]
[469, 697]
p02598
u319589470
2,000
1,048,576
We have N logs of lengths A_1,A_2,\cdots A_N. We can cut these logs at most K times in total. When a log of length L is cut at a point whose distance from an end of the log is t (0<t<L), it becomes two logs of lengths t and L-t. Find the shortest possible length of the longest log after at most K cuts, and print it a...
['\ndef I(): return int(input())\ndef LI(): return list(map(int,input().split()))\ndef MI(): return map(int,input().split())\ndef LLI(n): return [list(map(int, input().split())) for _ in range(n)]\n\n\n\n\n\n\n\n\nn,k = MI()\na = LI()\n\ndef cutting_isOK(x,li,k):\n ans = 0\n for i in range(n):\n ans += mat...
['Runtime Error', 'Accepted']
['s932228357', 's412247194']
[30768.0, 31020.0]
[72.0, 1147.0]
[1085, 1098]
p02598
u342651068
2,000
1,048,576
We have N logs of lengths A_1,A_2,\cdots A_N. We can cut these logs at most K times in total. When a log of length L is cut at a point whose distance from an end of the log is t (0<t<L), it becomes two logs of lengths t and L-t. Find the shortest possible length of the longest log after at most K cuts, and print it a...
['import math\n\ndef is_ok(A, x, K):\n cut_count = 0\n for number in A:\n cut_count += (math.ceil(number / x)) - 1\n return cut_count <= K\n\nA = []\n# N = int(input())\n# K = int(input())\nans = 0\n\nl = 0\nr = 10 ** 9\n\n# for _ in range(N):\n# A.append(int(input()))\n\nN = 10\nK = 10\nA = [158260...
['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted']
['s217317611', 's353621681', 's671085718', 's604893227']
[9072.0, 9144.0, 9156.0, 24956.0]
[32.0, 25.0, 29.0, 1016.0]
[560, 362, 352, 379]
p02598
u347640436
2,000
1,048,576
We have N logs of lengths A_1,A_2,\cdots A_N. We can cut these logs at most K times in total. When a log of length L is cut at a point whose distance from an end of the log is t (0<t<L), it becomes two logs of lengths t and L-t. Find the shortest possible length of the longest log after at most K cuts, and print it a...
['from math import ceil\nfrom heapq import heapify, heappop, heappush\n\nN, K, *A = map(int, open(0).read().split())\n\nt = sum(A) / K\na = [None] * len(A)\nfor i in A:\n k = max(ceil(i / t), 1)\n a.append((-i / k, i, k))\n\nheapify(a)\nfor _ in range(K):\n i, j, k = heappop(a)\n k += 1\n i = -(j / k)\n ...
['Runtime Error', 'Accepted']
['s856589706', 's434869218']
[48644.0, 31436.0]
[204.0, 1155.0]
[360, 351]
p02598
u371409687
2,000
1,048,576
We have N logs of lengths A_1,A_2,\cdots A_N. We can cut these logs at most K times in total. When a log of length L is cut at a point whose distance from an end of the log is t (0<t<L), it becomes two logs of lengths t and L-t. Find the shortest possible length of the longest log after at most K cuts, and print it a...
['n,k=map(int,input().split())\na=list(map(int,input().split()))\nif k==0:\n print(max(a))\nelse:\n ans=0\n d=round(max(a)*k/sum(a))\n print(-(-max(a)//(d+1)))', 'n,k=map(int,input().split())\na=list(map(int,input().split()))\nif k==0:\n print(max(a))\nelse:\n ans=0\n for i in a:\n d=-(-k*i/...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s047398292', 's243177414', 's078661922']
[30836.0, 30756.0, 30980.0]
[83.0, 2206.0, 666.0]
[162, 256, 286]
p02598
u408375121
2,000
1,048,576
We have N logs of lengths A_1,A_2,\cdots A_N. We can cut these logs at most K times in total. When a log of length L is cut at a point whose distance from an end of the log is t (0<t<L), it becomes two logs of lengths t and L-t. Find the shortest possible length of the longest log after at most K cuts, and print it a...
['n, k = map(int, input().split())\na = list(map(int, input().split()))\nlow = 0\ntop = max(a) + 1\n\nwhile top - low > 1:\n mid = (top + low) // 2\n cnt = 0\n for i in range(n):\n if a[i] % mid == 0:\n cnt += a[i] // mid\n else:\n cnt += (a[i] // mid) + 1\n if cnt <= k:\n top = mid\n else:\n ...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s052203032', 's648692922', 's733236887', 's427457761']
[30976.0, 30856.0, 30736.0, 30836.0]
[1571.0, 1022.0, 1476.0, 1322.0]
[324, 263, 324, 324]
p02598
u414050834
2,000
1,048,576
We have N logs of lengths A_1,A_2,\cdots A_N. We can cut these logs at most K times in total. When a log of length L is cut at a point whose distance from an end of the log is t (0<t<L), it becomes two logs of lengths t and L-t. Find the shortest possible length of the longest log after at most K cuts, and print it a...
['import math\nn,k=map(int,input().split())\na=list(map(int,input().split()))\na.sort(revese=True)\nfor i in range(k):\n t=max(a)\n a.insert(0,t/2)\n a.remove(t)\nprint(math.ceil(max(a)))', 'n,k=map(int,input().split())\na=list(map(int,input().split()))\nl,r=0,max(a)\ndef test(x):\n num=0\n for i in a:\n num+=i...
['Runtime Error', 'Accepted']
['s450593099', 's912144028']
[31108.0, 30932.0]
[73.0, 619.0]
[180, 260]
p02598
u417365712
2,000
1,048,576
We have N logs of lengths A_1,A_2,\cdots A_N. We can cut these logs at most K times in total. When a log of length L is cut at a point whose distance from an end of the log is t (0<t<L), it becomes two logs of lengths t and L-t. Find the shortest possible length of the longest log after at most K cuts, and print it a...
['n, k, *A = map(int, open(0).read().split())\nt = sum(A) / (n+k)\nA = [a for a in A if int(a/t) >= 1]\nX = []\nfor a in A:\n X.append(ceil(a / ceil(a/t)))\n X.append(ceil(a / int(a/t)))\nX.sort()\nprint(X[k])', 'from math import modf\nn, k, *A = map(int, open(0).read().split())\nt = sum(A) / (n+k)\nA = [a for a ...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s280337959', 's326709552', 's377084950', 's408172590', 's437027693', 's722926477', 's926555309']
[31608.0, 31504.0, 31564.0, 45056.0, 31592.0, 34600.0, 34680.0]
[107.0, 131.0, 68.0, 491.0, 108.0, 286.0, 325.0]
[205, 265, 575, 358, 230, 252, 257]
p02598
u423389475
2,000
1,048,576
We have N logs of lengths A_1,A_2,\cdots A_N. We can cut these logs at most K times in total. When a log of length L is cut at a point whose distance from an end of the log is t (0<t<L), it becomes two logs of lengths t and L-t. Find the shortest possible length of the longest log after at most K cuts, and print it a...
['n,k = map(int,input().split())\na = list(map(int,input().split()))\ndef check(t):\n ans = 0\n for aa in a:\n if aa > t:\n ans += aa//t\nmax = 10**9\nmin = 0\nwhile max-min>1:\n mid = (max+min)/2\n if check(mid):\n max = mid\n else:\n min = mid\nprint(max)', 'import sys\nimport math\nn,k = map(int,i...
['Wrong Answer', 'Accepted']
['s163695073', 's578316144']
[30832.0, 31088.0]
[808.0, 481.0]
[259, 381]
p02598
u423624748
2,000
1,048,576
We have N logs of lengths A_1,A_2,\cdots A_N. We can cut these logs at most K times in total. When a log of length L is cut at a point whose distance from an end of the log is t (0<t<L), it becomes two logs of lengths t and L-t. Find the shortest possible length of the longest log after at most K cuts, and print it a...
['n,k = map(int,input().split())\na = list(map(int,input().split()))\n\nleq,high = 0,1e10\nwhile high-leq > 1:\n l = int((leq+high)/2)\n cnt = 0\n for ai in a:\n cnt += int((ai-1)/l)\n print(l,cnt)\n if cnt>k:\n leq = l\n else:\n high = l\n\nprint(high)', 'n,k = map(int,input().split())\na = list(map(int...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s342685384', 's719022528', 's867106448']
[30780.0, 30824.0, 30624.0]
[1467.0, 1434.0, 1493.0]
[251, 251, 236]
p02598
u462976050
2,000
1,048,576
We have N logs of lengths A_1,A_2,\cdots A_N. We can cut these logs at most K times in total. When a log of length L is cut at a point whose distance from an end of the log is t (0<t<L), it becomes two logs of lengths t and L-t. Find the shortest possible length of the longest log after at most K cuts, and print it a...
['import math\nN, K = map(int, input().split())\nA=list(map(int,input().split()))\nmaxA = max(A)\nnum = 0\nright = maxA\nleft = 0\nwhile(right-left>1):\n num = left+math.floor((right-left)*0.5)\n count = 0\n for i in range(len(A)):\n count += math.ceil(A[i]/num)-1\n if count > K:\n left = num\...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s410237953', 's430101121', 's517259604', 's832533235', 's847312022', 's446886738']
[31028.0, 30768.0, 31192.0, 30956.0, 30980.0, 30884.0]
[2206.0, 1052.0, 868.0, 1247.0, 1066.0, 1044.0]
[546, 368, 308, 293, 346, 434]
p02598
u474202990
2,000
1,048,576
We have N logs of lengths A_1,A_2,\cdots A_N. We can cut these logs at most K times in total. When a log of length L is cut at a point whose distance from an end of the log is t (0<t<L), it becomes two logs of lengths t and L-t. Find the shortest possible length of the longest log after at most K cuts, and print it a...
['n,k = map(int,input().split())\nA = list(map(int,input().split()))\n\nl = min(A)//(k+1) \nr = max(A)\nm = (l+r)//2+1\n\nwhile 1:\n \n m = (l+r)//2\n \n \n \n # A_long = A[A>m]\n n= sum( [A[i]//m - A[i]%m==0 for i in range(len(A)) ] )\n \n # print(l,m,r,n)\n \n if n<=k:\n if r=...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s132507129', 's640976758', 's970582941', 's991740108', 's246854171']
[30788.0, 30628.0, 30832.0, 30888.0, 30544.0]
[2206.0, 1783.0, 1131.0, 1919.0, 1807.0]
[482, 477, 475, 514, 519]
p02598
u476386869
2,000
1,048,576
We have N logs of lengths A_1,A_2,\cdots A_N. We can cut these logs at most K times in total. When a log of length L is cut at a point whose distance from an end of the log is t (0<t<L), it becomes two logs of lengths t and L-t. Find the shortest possible length of the longest log after at most K cuts, and print it a...
['input = open("input.in").readline\n\ndef main():\n N,K = map(int, input().split())\n A = list(map(int, input().split()))\n \n l,r = 0, max(A)\n while l < r-1:\n mid = l + (r-l)//2\n cnt = 0\n for a in A:\n cnt+= a//mid\n \n if cnt <= K:\n r =...
['Runtime Error', 'Accepted']
['s191405018', 's198589869']
[9044.0, 31088.0]
[30.0, 572.0]
[367, 447]
p02598
u503228842
2,000
1,048,576
We have N logs of lengths A_1,A_2,\cdots A_N. We can cut these logs at most K times in total. When a log of length L is cut at a point whose distance from an end of the log is t (0<t<L), it becomes two logs of lengths t and L-t. Find the shortest possible length of the longest log after at most K cuts, and print it a...
['from bisect import bisect_left\nn, k = map(int, input().split())\na = list(map(int, input().split()))\na.sort(reverse=True)\nok = 0\nng = 10**10\n\n\ndef judge(l):\n cnt = 0\n for aa in a:\n if aa <= l:\n break\n while aa > l:\n aa /= 2\n cnt += 1\n return cnt <...
['Wrong Answer', 'Accepted']
['s021678436', 's260526748']
[30956.0, 31064.0]
[110.0, 941.0]
[430, 412]
p02598
u514334797
2,000
1,048,576
We have N logs of lengths A_1,A_2,\cdots A_N. We can cut these logs at most K times in total. When a log of length L is cut at a point whose distance from an end of the log is t (0<t<L), it becomes two logs of lengths t and L-t. Find the shortest possible length of the longest log after at most K cuts, and print it a...
['def count(N,K,mid,a):\n cnt = 0\n for i in range(N):\n cnt = a[i]//mid\n if cnt > K:\n return False\n else:\n return True\n\ndef main():\n N, K = map(int, input().split())\n a = list(map(int, input().split()))\n\n low = 1\n high = 10**9\n mid = (low+high)//2\n\n whil...
['Wrong Answer', 'Accepted']
['s857383683', 's633246288']
[30828.0, 31112.0]
[390.0, 1160.0]
[519, 547]
p02598
u525796732
2,000
1,048,576
We have N logs of lengths A_1,A_2,\cdots A_N. We can cut these logs at most K times in total. When a log of length L is cut at a point whose distance from an end of the log is t (0<t<L), it becomes two logs of lengths t and L-t. Find the shortest possible length of the longest log after at most K cuts, and print it a...
['import sys\nimport math\nimport fractions\nfrom collections import defaultdict\nimport heapq\nfrom bisect import bisect_left,bisect\n\nstdin = sys.stdin\n \nns = lambda: stdin.readline().rstrip()\nni = lambda: int(stdin.readline().rstrip())\nnm = lambda: map(int, stdin.readline().split())\nnl = lambda: list(map(...
['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s329174152', 's415274916', 's481413151', 's487389417', 's648064906', 's918528571']
[9028.0, 32284.0, 8940.0, 32104.0, 9036.0, 32196.0]
[27.0, 1509.0, 27.0, 1740.0, 29.0, 1417.0]
[727, 761, 653, 730, 724, 654]
p02598
u539367121
2,000
1,048,576
We have N logs of lengths A_1,A_2,\cdots A_N. We can cut these logs at most K times in total. When a log of length L is cut at a point whose distance from an end of the log is t (0<t<L), it becomes two logs of lengths t and L-t. Find the shortest possible length of the longest log after at most K cuts, and print it a...
["def main():\n l,r=0,10**9\n while r-l>1:\n m=(l+r)//2\n if sum([(i-1)//x for i in a])<=k: r=m;\n else: l=m;\n print(r)\n\nif __name__=='__main__':\n n,k=map(int,input().split())\n a=list(map(int,input().split()))\n main()", "def main():\n l,r=0,10**9\n while r-l>1:\n m=(l+r)//2\n if sum([(i-1)/...
['Runtime Error', 'Accepted']
['s739786056', 's281249110']
[30900.0, 30832.0]
[72.0, 521.0]
[225, 225]
p02598
u543016260
2,000
1,048,576
We have N logs of lengths A_1,A_2,\cdots A_N. We can cut these logs at most K times in total. When a log of length L is cut at a point whose distance from an end of the log is t (0<t<L), it becomes two logs of lengths t and L-t. Find the shortest possible length of the longest log after at most K cuts, and print it a...
['N, K=map(int,input().split())\nA=list(map(int,input().split()))\n\ndef judge(ans,K,A):\n cut=0\n for i in range(len(A)):\n cut+=(A[i]-1)//ans\n if cut>K:\n return False\n else:\n return True\n\n\nansp=max(A)\nansm=min(A)\nans=(ansp+ansm)//2\nd=1\nwhile ansp-ansm>d:\n \n if judge...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s081327880', 's123546092', 's984250403', 's240722163']
[30888.0, 31064.0, 30800.0, 30972.0]
[638.0, 505.0, 2206.0, 623.0]
[406, 414, 635, 413]
p02598
u570155187
2,000
1,048,576
We have N logs of lengths A_1,A_2,\cdots A_N. We can cut these logs at most K times in total. When a log of length L is cut at a point whose distance from an end of the log is t (0<t<L), it becomes two logs of lengths t and L-t. Find the shortest possible length of the longest log after at most K cuts, and print it a...
['from math import ceil\nn,k = map(int,input().split())\na = list(map(int,input().split()))\n\nprint(n,k,a)\n\ndef cut(x):\n t = 0\n for i in a:\n if i <= x:\n continue\n t += ceil(i / x) - 1\n return t <= k\n\nl,r=0,10**9\nwhile l+1 < r:\n x = l + (r-l)//2\n if cut(x):\n r = x\n else:\n l = x\np...
['Wrong Answer', 'Accepted']
['s334774375', 's895273108']
[31204.0, 31172.0]
[920.0, 986.0]
[304, 290]
p02598
u595353654
2,000
1,048,576
We have N logs of lengths A_1,A_2,\cdots A_N. We can cut these logs at most K times in total. When a log of length L is cut at a point whose distance from an end of the log is t (0<t<L), it becomes two logs of lengths t and L-t. Find the shortest possible length of the longest log after at most K cuts, and print it a...
['##a = int(stdin.readline().rstrip())\n##b, c = [int(x) for x in stdin.readline().rstrip().split()]\n##s = stdin.readline().rstrip()\n\n##a = list(map(int,[int(x) for x in stdin.readline().rstrip().split()])) a[0, 1, 2, ...]\n##a = [[0] * 2 for _ in range(n)] a[0,0]\n\n\n\n\n\n\n# -*- coding: utf-8 -*-\nfrom sys impo...
['Wrong Answer', 'Accepted']
['s551650910', 's700490202']
[49360.0, 49444.0]
[2206.0, 1208.0]
[2506, 2508]
p02598
u599969606
2,000
1,048,576
We have N logs of lengths A_1,A_2,\cdots A_N. We can cut these logs at most K times in total. When a log of length L is cut at a point whose distance from an end of the log is t (0<t<L), it becomes two logs of lengths t and L-t. Find the shortest possible length of the longest log after at most K cuts, and print it a...
["import math\n\ndef main():\n _, k = map(int, input().split())\n arr = list(map(int, input().split()))\n print(arr)\n l, r = 1, 1000000000\n while l < r:\n m = (l + r) // 2\n cnt = 0\n for val in arr:\n cnt += math.ceil(val / m) - 1\n if cnt > k:\n l = m...
['Wrong Answer', 'Accepted']
['s959230984', 's175535809']
[31100.0, 31032.0]
[1015.0, 987.0]
[395, 380]
p02598
u614181788
2,000
1,048,576
We have N logs of lengths A_1,A_2,\cdots A_N. We can cut these logs at most K times in total. When a log of length L is cut at a point whose distance from an end of the log is t (0<t<L), it becomes two logs of lengths t and L-t. Find the shortest possible length of the longest log after at most K cuts, and print it a...
['n,k = map(int,input().split())\na = list(map(int,input().split()))\na = sorted(a,reverse=True)\ns = sum(a)\nx = [0]*n\ny = 0\nfor i in range(n):\n y = int(a[i]/s*k)\n x[i] = [i, (a[i]/s*k)%1, y]\n\nx.sort(key= lambda val : val[1],reverse=True)\nfor i in range(k-y):\n x[i][2] += 1\nans = 0\nz = 0\nfor i in ra...
['Runtime Error', 'Accepted']
['s354933663', 's855034215']
[59444.0, 31164.0]
[471.0, 649.0]
[395, 427]
p02598
u615520489
2,000
1,048,576
We have N logs of lengths A_1,A_2,\cdots A_N. We can cut these logs at most K times in total. When a log of length L is cut at a point whose distance from an end of the log is t (0<t<L), it becomes two logs of lengths t and L-t. Find the shortest possible length of the longest log after at most K cuts, and print it a...
["#import numpy as np\n#import collections\n#import math\n\nf = open('./input_E.txt')\n\nN,K = map(int, f.readline().split())\nA = list(map(int, f.readline().split()))\n\n#N,K = map(int, input().split())\n#A = list(map(int, input().split()))\n\nA.sort(reverse=True)\n\ndef nibu(small,big):\n mid = (small+big)//2\n# ...
['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s140276899', 's191684384', 's390694108', 's247637285']
[9076.0, 30788.0, 412184.0, 30804.0]
[27.0, 878.0, 2221.0, 788.0]
[917, 704, 864, 704]
p02598
u629350026
2,000
1,048,576
We have N logs of lengths A_1,A_2,\cdots A_N. We can cut these logs at most K times in total. When a log of length L is cut at a point whose distance from an end of the log is t (0<t<L), it becomes two logs of lengths t and L-t. Find the shortest possible length of the longest log after at most K cuts, and print it a...
['n,k=map(int,input().split())\na=list(map(int,input().split()))\ntmax=max(a)\ntmin=0\nt=(tmax+tmin)//2\nimport math\nans=tmax\nif k==0:\n print(tmax)\nelse:\n while True:\n s=0\n for i in range(n):\n s=s+math.ceil(a[i]/t)-1\n if k>=s:\n ans=min(math.ceil(t),math.ceil(ans))\n tmax=t\n t=(...
['Runtime Error', 'Accepted']
['s482166450', 's861536207']
[30916.0, 30820.0]
[2206.0, 1462.0]
[402, 358]
p02598
u633355062
2,000
1,048,576
We have N logs of lengths A_1,A_2,\cdots A_N. We can cut these logs at most K times in total. When a log of length L is cut at a point whose distance from an end of the log is t (0<t<L), it becomes two logs of lengths t and L-t. Find the shortest possible length of the longest log after at most K cuts, and print it a...
['import numpy as np\nimport math\nN, K = map(int, input().split())\nA = list(map(int, input().split()))\n\n\ndef is_ok(i):\n su = 0\n for a in A:\n su += math.ceil(n / i) - 1\n if su <= K:\n return True\n else:\n return False\n\ndef meguru_bisect(ng, ok):\n \n while (abs(ok - ng)...
['Runtime Error', 'Accepted']
['s599947574', 's881226695']
[49600.0, 49320.0]
[177.0, 1076.0]
[753, 753]
p02598
u648868410
2,000
1,048,576
We have N logs of lengths A_1,A_2,\cdots A_N. We can cut these logs at most K times in total. When a log of length L is cut at a point whose distance from an end of the log is t (0<t<L), it becomes two logs of lengths t and L-t. Find the shortest possible length of the longest log after at most K cuts, and print it a...
['import numpy as np\nimport math\n\nN,K=map(int,input().split())\nA=list(map(int,input().split()))\n\ndef isOK(minVal):\n\ttmpK=0\n\tfor a in A:\n\t\t\n\t\ttmpK+=((-(-a//minVal))-1)\n\n\tif tmpK <= K:\n\t\treturn True\n\telse:\n\t\treturn False\n\nok = max(A)\nng = 0\n\nwhile (math.ceil(ok) != math.ceil(ng)):\n\tmid =...
['Wrong Answer', 'Accepted']
['s973057715', 's173369114']
[49564.0, 49208.0]
[1463.0, 1455.0]
[400, 401]
p02598
u688587139
2,000
1,048,576
We have N logs of lengths A_1,A_2,\cdots A_N. We can cut these logs at most K times in total. When a log of length L is cut at a point whose distance from an end of the log is t (0<t<L), it becomes two logs of lengths t and L-t. Find the shortest possible length of the longest log after at most K cuts, and print it a...
['import math\n\nN, K = map(int, input().split())\nlogs = list(map(int, input().split()))\n\nng_len = 1\nok_len = 1000000000\n\n\ndef possible_len(length: int, log: list, k: int):\n count = 0\n for i in range(N):\n count += math.ceil(log[i] / length) - 1\n if count <= k:\n return True\n else:\...
['Wrong Answer', 'Accepted']
['s588268753', 's944777038']
[31120.0, 31232.0]
[1118.0, 1183.0]
[557, 488]
p02598
u699522269
2,000
1,048,576
We have N logs of lengths A_1,A_2,\cdots A_N. We can cut these logs at most K times in total. When a log of length L is cut at a point whose distance from an end of the log is t (0<t<L), it becomes two logs of lengths t and L-t. Find the shortest possible length of the longest log after at most K cuts, and print it a...
['import math\nN,K = map(int,input().split())\ncs = list(map(int, input().split()))\nma = max(cs)\nmi = 0\nrgl = math.ceil(math.log2(ma))\nrt = ma+1\ndef counter(ch,mo):\n rt =math.ceil(ch/mo)\n return rt-1 if rt > 0 else 0\n\nfor _ in range(rgl):\n cnt = 0\n for c in cs:\n cnt+=counter(c,ma)\n if cnt <= K and ...
['Wrong Answer', 'Accepted']
['s519526578', 's593489376']
[31096.0, 31236.0]
[1698.0, 1349.0]
[429, 325]
p02598
u700805562
2,000
1,048,576
We have N logs of lengths A_1,A_2,\cdots A_N. We can cut these logs at most K times in total. When a log of length L is cut at a point whose distance from an end of the log is t (0<t<L), it becomes two logs of lengths t and L-t. Find the shortest possible length of the longest log after at most K cuts, and print it a...
['N, K = map(int, input().split())\na = list(map(int, input().split()))\nmax_a = 10**9\nmin_a = 0\n\nwhile max_a-min_a>1:\n count = K\n mean_a = (max_a+min_a)//2\n \n for i in range(N):\n if a[i]==mean_a: continue\n count -= -a[i]//mean_a\n if count >= 0:\n max_a = mean_a\n else:\...
['Wrong Answer', 'Accepted']
['s478099015', 's710406316']
[30828.0, 30976.0]
[1365.0, 1178.0]
[340, 302]
p02598
u703528810
2,000
1,048,576
We have N logs of lengths A_1,A_2,\cdots A_N. We can cut these logs at most K times in total. When a log of length L is cut at a point whose distance from an end of the log is t (0<t<L), it becomes two logs of lengths t and L-t. Find the shortest possible length of the longest log after at most K cuts, and print it a...
['from math import ceil\n\ndef check(A,N,i,K):\n cnt=0\n for j in range(N):\n cnt+=ceil(A[j]/i)-1\n if cnt<=K:\n return 1\n else:\n return -1\n\nN,K=map(int,input().split())\nA=list(map(int,input().split()))\nA.sort()\nM=A[-1]\nres=[0 for _ in range(M+1)]\ni=M//2\nd=M//2\nif K==0:\n ...
['Runtime Error', 'Accepted']
['s468190762', 's573151495']
[656328.0, 31112.0]
[2227.0, 810.0]
[629, 336]
p02598
u711677620
2,000
1,048,576
We have N logs of lengths A_1,A_2,\cdots A_N. We can cut these logs at most K times in total. When a log of length L is cut at a point whose distance from an end of the log is t (0<t<L), it becomes two logs of lengths t and L-t. Find the shortest possible length of the longest log after at most K cuts, and print it a...
['N, K = map(int, input().split())\nA = list(map(int, input().split()))\n\ndef check(1):\n count = 0\n for L in A:\n count = count + L // 1\n if L % 1 != 0:\n count = count + 1\n count = count - 1\n return count <= K\n\nbottom, top = 0, max(A)\n\nwhile top - bottom > 1:\n mid = (top + bottom) // 2\n ...
['Runtime Error', 'Accepted']
['s271159618', 's824476112']
[9004.0, 30628.0]
[27.0, 984.0]
[367, 385]
p02598
u726823037
2,000
1,048,576
We have N logs of lengths A_1,A_2,\cdots A_N. We can cut these logs at most K times in total. When a log of length L is cut at a point whose distance from an end of the log is t (0<t<L), it becomes two logs of lengths t and L-t. Find the shortest possible length of the longest log after at most K cuts, and print it a...
['import sys\nimport math\ndef Ii():return int(sys.stdin.readline())\ndef Mi():return map(int,sys.stdin.readline().split())\ndef Li():return list(map(int,sys.stdin.readline().split()))\nn,k = Mi()\na = Li()\nsa = sum(a)\nlist.sort(a, reverse=True)\nma = sa//(n+k)+1\ndiv = [0]*n\nfor i in range(n):\n div[i] = math.ceil...
['Wrong Answer', 'Accepted']
['s490356519', 's358199116']
[31084.0, 52644.0]
[310.0, 193.0]
[475, 441]
p02598
u733866054
2,000
1,048,576
We have N logs of lengths A_1,A_2,\cdots A_N. We can cut these logs at most K times in total. When a log of length L is cut at a point whose distance from an end of the log is t (0<t<L), it becomes two logs of lengths t and L-t. Find the shortest possible length of the longest log after at most K cuts, and print it a...
['n,k=int(input())\nA=list(map(int,input().split()))\n\nright=10**9\nleft=1\n\nwhile right-left>1 :\n mid=(left+right)//2\n count=0\n for a in A :\n count+=a//mid\n if a%mid==0 :\n count-=1\n if count<=k :\n right=mid\n else :\n left=mid\n\nprint(right)', 'n,k=map(i...
['Runtime Error', 'Accepted']
['s938953086', 's986024792']
[9116.0, 30600.0]
[29.0, 1030.0]
[287, 299]
p02598
u736729525
2,000
1,048,576
We have N logs of lengths A_1,A_2,\cdots A_N. We can cut these logs at most K times in total. When a log of length L is cut at a point whose distance from an end of the log is t (0<t<L), it becomes two logs of lengths t and L-t. Find the shortest possible length of the longest log after at most K cuts, and print it a...
['import math\n\nN, K = map(int, input().split())\nA = sorted(list(map(int, input().split())))\n\ndef check(L):\n return sum(math.ceil(a / L)-1 for a in A) <= K\n\nanswer=max(A)\nlo = 1\nhi = answer+1\nwhile lo < hi:\n m = (lo + hi)//2\n ok = check(m)\n if ok: \n answer=min(m, answer)\n hi=m\n...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s056774235', 's499082321', 's622269336', 's791783718']
[9044.0, 8952.0, 9020.0, 31004.0]
[23.0, 24.0, 28.0, 1247.0]
[582, 563, 582, 342]
p02598
u744920373
2,000
1,048,576
We have N logs of lengths A_1,A_2,\cdots A_N. We can cut these logs at most K times in total. When a log of length L is cut at a point whose distance from an end of the log is t (0<t<L), it becomes two logs of lengths t and L-t. Find the shortest possible length of the longest log after at most K cuts, and print it a...
['def mi(): return map(int, sys.stdin.readline().split())\ndef li(): return list(map(int, sys.stdin.readline().split()))\ndef li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]\ndef dp2(ini, i, j): return [[ini]*i for i2 in range(j)]\n\n#from collections import defaultdict #d = defaultdict(...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s254691566', 's411233961', 's582067128', 's849914793', 's920873614', 's939967339', 's589347636']
[9160.0, 31020.0, 30968.0, 31008.0, 31080.0, 30792.0, 30928.0]
[27.0, 2206.0, 1033.0, 1176.0, 2206.0, 2206.0, 1164.0]
[1369, 1330, 1352, 1334, 1267, 1494, 1611]
p02598
u756195685
2,000
1,048,576
We have N logs of lengths A_1,A_2,\cdots A_N. We can cut these logs at most K times in total. When a log of length L is cut at a point whose distance from an end of the log is t (0<t<L), it becomes two logs of lengths t and L-t. Find the shortest possible length of the longest log after at most K cuts, and print it a...
['import math\nN,K = map(int,input().split())\na = list(map(int,input().split()))\ndef is_ok(arg):\n i = 0\n for item in a:\n i += a //arg -1\n return i <=K\n\ndef meguru_bisect(ng, ok):\n \n while (abs(ok - ng) > 1):\n mid = (ok + ng) // 2\n if is_ok(mid):\n ok = mid\n ...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s417228343', 's840297742', 's035062874']
[31112.0, 31252.0, 31096.0]
[74.0, 75.0, 985.0]
[616, 306, 655]
p02598
u756388720
2,000
1,048,576
We have N logs of lengths A_1,A_2,\cdots A_N. We can cut these logs at most K times in total. When a log of length L is cut at a point whose distance from an end of the log is t (0<t<L), it becomes two logs of lengths t and L-t. Find the shortest possible length of the longest log after at most K cuts, and print it a...
['N, K = map(int, input().split())\nA = list(map(int, input().split()))\n\ndef isOK(x):\n cnt = 0\n for a in A:\n cnt += (a + x - 1) // x - 1\n return cnt <= K\n\nleft, right = 1, 10 ** 18\nwhile right - left > 1:\n mid = (left + right) // 2\n if isOK(mid):\n left = mid\n else:\n ...
['Wrong Answer', 'Accepted']
['s404900999', 's940586256']
[30876.0, 30696.0]
[2126.0, 931.0]
[327, 328]
p02598
u761062383
2,000
1,048,576
We have N logs of lengths A_1,A_2,\cdots A_N. We can cut these logs at most K times in total. When a log of length L is cut at a point whose distance from an end of the log is t (0<t<L), it becomes two logs of lengths t and L-t. Find the shortest possible length of the longest log after at most K cuts, and print it a...
['def check(x, A, K):\n import math\n sumA = 0\n for a in A:\n if a > x:\n sumA += math.ceil(a / x) - 1\n if sumA <= K:\n return True\n else:\n return False\n\n\ndef resolve():\n import bisect\n N, K = [int(i) for i in input().split()]\n A = [int(i) for i in input...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s539843302', 's910526493', 's233860734']
[9116.0, 9140.0, 30792.0]
[27.0, 28.0, 990.0]
[547, 547, 554]
p02598
u774539708
2,000
1,048,576
We have N logs of lengths A_1,A_2,\cdots A_N. We can cut these logs at most K times in total. When a log of length L is cut at a point whose distance from an end of the log is t (0<t<L), it becomes two logs of lengths t and L-t. Find the shortest possible length of the longest log after at most K cuts, and print it a...
['n,k=map(int,input().split())\nA=list(map(int,input().split()))\nhigh=max(A)\nlow=0\nwhile high-low>1:\n cnt=0\n now=(low+high)//2\n for a in A:\n cnt+=max((a-1)//now,0)\n if cnt>k:\n break\n if cnt>k:\n low=now\n else:\n high=now\n print(cnt,low,high)\nprint(hi...
['Wrong Answer', 'Accepted']
['s710264186', 's513395513']
[30740.0, 30828.0]
[1945.0, 1881.0]
[305, 306]
p02598
u796102246
2,000
1,048,576
We have N logs of lengths A_1,A_2,\cdots A_N. We can cut these logs at most K times in total. When a log of length L is cut at a point whose distance from an end of the log is t (0<t<L), it becomes two logs of lengths t and L-t. Find the shortest possible length of the longest log after at most K cuts, and print it a...
['n,k = map(int,input().split())\na = list(map(int,input().split()))\nl = 0\nr = 10 ** 9\n\nwhile r-l > 1 :\n m = (l+r)//2 \n b = list(map(lambda x: -(-x//m) - 1 ,a))\n ans = sum(b)\n if ans <= k :\n r = m\n else :\n l = m\n print(l,r)\n\nprint(r)\n\n \n\n', 'n,k = map(int,input(...
['Wrong Answer', 'Accepted']
['s298183177', 's400475488']
[33468.0, 31752.0]
[848.0, 895.0]
[275, 260]