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
p03497
u848647227
2,000
262,144
Takahashi has N balls. Initially, an integer A_i is written on the i-th ball. He would like to rewrite the integer on some balls so that there are at most K different integers written on the N balls. Find the minimum number of balls that Takahashi needs to rewrite the integers on them.
['import collections\na,b = map(int,input().split(" "))\nar = list(map(int,input().split(" ")))\nbr = set(ar)\ncr = collections.Counter(ar)\nn = len(br) - b\ndr = []\nfor k in cr.keys():\n cr.append(k)\ncr.sort()\ncount = 0\nfor i in range(n):\n count += cr[i]', 'import collections\na,b = map(int,input().split(" ...
['Runtime Error', 'Accepted']
['s664498964', 's039011979']
[45364.0, 45356.0]
[119.0, 170.0]
[252, 267]
p03497
u859897687
2,000
262,144
Takahashi has N balls. Initially, an integer A_i is written on the i-th ball. He would like to rewrite the integer on some balls so that there are at most K different integers written on the N balls. Find the minimum number of balls that Takahashi needs to rewrite the integers on them.
['n,k=map(int,input().split())\nd=dict()\nfor i in map(int,input().split()):\n if i not in d:\n d[i]=1\n else:\n d[i]+=1\nm=list(d.keys())\nm.sort()\nn-=k\nans=0\nfor i in m:\n if n<=0:\n break\n n-=d[i]\n ans+=1\nprint(ans)', 'n,k=map(int,input().split())\nd=dict()\nfor i in map(int,input().split()):\n ...
['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted']
['s087542541', 's282604768', 's653241972', 's127116348']
[41116.0, 41120.0, 41120.0, 41120.0]
[188.0, 118.0, 124.0, 152.0]
[220, 208, 214, 226]
p03497
u860002137
2,000
262,144
Takahashi has N balls. Initially, an integer A_i is written on the i-th ball. He would like to rewrite the integer on some balls so that there are at most K different integers written on the N balls. Find the minimum number of balls that Takahashi needs to rewrite the integers on them.
['from collections import Counter\n\nN, K = map(int, input().split())\nA = list(map(int, input().split()))\n\nli = Counter(A)\nli = list(li.values())\nli.sort()\n\nsum(li[:max(len(li) - K, 0)])', 'from collections import Counter\n\nN, K = map(int, input().split())\nA = list(map(int, input().split()))\n\nli = Counter(A)...
['Wrong Answer', 'Accepted']
['s538419454', 's585041698']
[32564.0, 32540.0]
[96.0, 97.0]
[182, 189]
p03497
u864453204
2,000
262,144
Takahashi has N balls. Initially, an integer A_i is written on the i-th ball. He would like to rewrite the integer on some balls so that there are at most K different integers written on the N balls. Find the minimum number of balls that Takahashi needs to rewrite the integers on them.
['n, k = map(int, input().split())\nA = list(map(int, input().split()))\na = set(A)\nt = len(set(A))\ndic = {"{}".format(i):A.count(i) for i in a}\ndic = dict(sorted(dic.items(), key=lambda x:x[1]))\ncnt = 0\nans = 0\nif t > k:\n for i, v in dic.items():\n if cnt == (t - k + 1):\n break\n cn...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s475253265', 's636321362', 's925729647', 's042005643']
[36380.0, 37780.0, 35512.0, 37784.0]
[2104.0, 298.0, 2108.0, 204.0]
[341, 247, 341, 238]
p03497
u865741247
2,000
262,144
Takahashi has N balls. Initially, an integer A_i is written on the i-th ball. He would like to rewrite the integer on some balls so that there are at most K different integers written on the N balls. Find the minimum number of balls that Takahashi needs to rewrite the integers on them.
['from collections import OrderedDict\n\ntemp=input()\nn,k=list(map(int,temp.split(" ")))\nco=OrderedDict()\nans=[]\ntemp=input()\nnums=list(map(int,temp.split(" ")))\nfor i in nums:\n if i in co:\n\t co[i]+=1\n else:\n\t co[i]=1\nfor i in co:\n ans.append(co[i])\nkinds=len(ans)\ndif=kinds-k\nif dif<=0:\n print...
['Wrong Answer', 'Accepted']
['s586984765', 's897426384']
[71708.0, 71700.0]
[660.0, 640.0]
[350, 348]
p03497
u923270446
2,000
262,144
Takahashi has N balls. Initially, an integer A_i is written on the i-th ball. He would like to rewrite the integer on some balls so that there are at most K different integers written on the N balls. Find the minimum number of balls that Takahashi needs to rewrite the integers on them.
['n = int(input())\na = list(map(int, input().split()))\nprint(n * 2 - 1)\nma, mi = max(a), min(a)\nima, imi = a.index(ma), a.index(mi)\nif abs(ma) > abs(mi):\n for i in range(1, n + 1):\n print(ima + 1, i)\n for i in range(1, n):\n print(i, i + 1)\nelse:\n for i in range(1, n + 1):\n prin...
['Runtime Error', 'Accepted']
['s140448096', 's451081605']
[3064.0, 41364.0]
[17.0, 229.0]
[370, 232]
p03497
u951980350
2,000
262,144
Takahashi has N balls. Initially, an integer A_i is written on the i-th ball. He would like to rewrite the integer on some balls so that there are at most K different integers written on the N balls. Find the minimum number of balls that Takahashi needs to rewrite the integers on them.
['from collections import Counter\n\nN,K = list(map(int,input().split(" ")))\nA = list(map(int,input().split(" ")))\nA2 = dict(Counter(A))\n\nif len(A2) > K:\n r = sorted(A2.items(),key=lambda x:x[1])\n print(sum([i[1] for i in r[:K]]))\nelse:\n print("0")', 'from collections import Counter\n\nN,K = list(map(i...
['Wrong Answer', 'Accepted']
['s171071671', 's713645426']
[39344.0, 39316.0]
[157.0, 178.0]
[253, 216]
p03497
u969190727
2,000
262,144
Takahashi has N balls. Initially, an integer A_i is written on the i-th ball. He would like to rewrite the integer on some balls so that there are at most K different integers written on the N balls. Find the minimum number of balls that Takahashi needs to rewrite the integers on them.
['import collections\nn,k=map(int,input().split())\nA=list(map(int,input().split()))\nc=collections.Counter(A)\ntot=0\nfor i in range(len(set(A))):\n tot+=c.most_common()[i][1]\nprint(n-tot)', 'import collections\nn,k=map(int,input().split())\nA=list(map(int,input().split()))\nc=collections.Counter(A)\ntot=0\nfor i in...
['Wrong Answer', 'Accepted']
['s078393535', 's345361138']
[43052.0, 39856.0]
[2105.0, 149.0]
[182, 180]
p03497
u978494963
2,000
262,144
Takahashi has N balls. Initially, an integer A_i is written on the i-th ball. He would like to rewrite the integer on some balls so that there are at most K different integers written on the N balls. Find the minimum number of balls that Takahashi needs to rewrite the integers on them.
['from collections import defaultdict\nn,k = map(int,input().split())\nnums = input().split()\ncount_per_num = defaultdict(int)\nfor n in nums:\n count_per_num[n] += 1\ncount_per_nums = sorted(count_per_nums, key=lambda x:x[1])\nans = 0\nfor i in range(len(count_per_nums)-k):\n ans += count_per_nums[i]\nprint(ans)', ...
['Runtime Error', 'Accepted']
['s031306405', 's432781146']
[35996.0, 44048.0]
[115.0, 245.0]
[305, 319]
p03497
u999503965
2,000
262,144
Takahashi has N balls. Initially, an integer A_i is written on the i-th ball. He would like to rewrite the integer on some balls so that there are at most K different integers written on the N balls. Find the minimum number of balls that Takahashi needs to rewrite the integers on them.
['from collections import Counter\n\n#n,k=map(int,input().split())\n#l=list(map(int,input().split()))\nn,k=10, 3\nl=[5, 1, 3, 2, 4, 1, 1, 2, 3, 4]\n\nl=Counter(l)\nnum=len(l)\ncnt=0\n\nprint(l)\n ', 'from collections import Counter\n\n#n,k=map(int,input().split())\n#l=list(map(int,input().split()))\nn,k=10, 3\nl=[5,...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s127381586', 's249577055', 's195034899']
[9260.0, 9372.0, 35136.0]
[30.0, 33.0, 102.0]
[185, 254, 218]
p03551
u026155812
2,000
262,144
Takahashi is now competing in a programming contest, but he received TLE in a problem where the answer is `YES` or `NO`. When he checked the detailed status of the submission, there were N test cases in the problem, and the code received TLE in M of those cases. Then, he rewrote the code to correctly solve each of th...
['N, M = map(int, input().split())\np = (1/2)**M\nq = 1 - p\n\nprint((N-M)*100/p + 1900*M/(1-q))', 'N, M = map(int, input().split())\np = (1/2)**M\nq = 1 - p\n\nprint(int((N-M)*100/p + 1900*M/(1-q)))']
['Wrong Answer', 'Accepted']
['s608896397', 's088823515']
[2940.0, 2940.0]
[17.0, 17.0]
[90, 95]
p03551
u039623862
2,000
262,144
Takahashi is now competing in a programming contest, but he received TLE in a problem where the answer is `YES` or `NO`. When he checked the detailed status of the submission, there were N test cases in the problem, and the code received TLE in M of those cases. Then, he rewrote the code to correctly solve each of th...
['n, x, y = map(int, input().split())\na = list(map(int, input().split()))\n\nif n == 1:\n print(abs(a[-1] - y))\nelse:\n print(max(abs(a[-1] - y), abs(a[-1] - a[-2])))\n', 'n, m = map(int, input().split())\nprint(2**m * (1800 * m + 100 * n))\n']
['Runtime Error', 'Accepted']
['s252223576', 's595112184']
[2940.0, 2940.0]
[17.0, 17.0]
[167, 68]
p03551
u133038626
2,000
262,144
Takahashi is now competing in a programming contest, but he received TLE in a problem where the answer is `YES` or `NO`. When he checked the detailed status of the submission, there were N test cases in the problem, and the code received TLE in M of those cases. Then, he rewrote the code to correctly solve each of th...
['N, M = map(int, input().split())\nt = 100 * N + 1800 * M\ntotal = 0\ni = 1\np = 1 / 2**M\nwhile True:\n d = i * (1-p)**(i-1) * p * t\n total += d\n if d < 0.001:\n break\nprint(total)', 'N, M = map(int, input().split())\nt = 100 * N + 1800 * M\ntotal = 0\ni = 1\np = 1 / 2**M\nwhile True:\n d = i * ...
['Time Limit Exceeded', 'Accepted']
['s116666648', 's225850705']
[2940.0, 3188.0]
[2104.0, 21.0]
[189, 207]
p03551
u143509139
2,000
262,144
Takahashi is now competing in a programming contest, but he received TLE in a problem where the answer is `YES` or `NO`. When he checked the detailed status of the submission, there were N test cases in the problem, and the code received TLE in M of those cases. Then, he rewrote the code to correctly solve each of th...
['n,m=map(int,input().split());print(n*100+m*1800*2**m)', 'n,m=map(int,input().split());print((n*100+m*1800)*2**m)']
['Wrong Answer', 'Accepted']
['s638345823', 's755969049']
[2940.0, 2940.0]
[17.0, 17.0]
[53, 55]
p03551
u226155577
2,000
262,144
Takahashi is now competing in a programming contest, but he received TLE in a problem where the answer is `YES` or `NO`. When he checked the detailed status of the submission, there were N test cases in the problem, and the code received TLE in M of those cases. Then, he rewrote the code to correctly solve each of th...
['N, M = map(int, input().split())\nT = 100*(N-M) + 1900*M\nS = 0.5**M\n\nprint(T//S)', 'N, M = map(int, input().split())\nT = 100*(N-M) + 1900*M\nS = 2**M\n\nprint(T*S)']
['Wrong Answer', 'Accepted']
['s270598052', 's638768697']
[2940.0, 2940.0]
[17.0, 17.0]
[79, 76]
p03551
u278832126
2,000
262,144
Takahashi is now competing in a programming contest, but he received TLE in a problem where the answer is `YES` or `NO`. When he checked the detailed status of the submission, there were N test cases in the problem, and the code received TLE in M of those cases. Then, he rewrote the code to correctly solve each of th...
['def main(M, N):\n n = 1\n for _ in range(N):\n n *= 2\n\n return n * ((M - N) * 100 + N * 1900)', 'n = 1\nfor _ in range(N):\n n *= 2\n\nreturn n * ((M - N) * 100 + N * 1900)', 'def main(N, M):\n n = 1\n for _ in range(M):\n n *= 2\n\n print(n * ((N - M) * 100 + M * 1900))', 'def ma...
['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s036235048', 's245831851', 's719586030', 's756979497', 's854500386', 's928266336', 's965736798', 's597666312']
[2940.0, 2940.0, 2940.0, 2940.0, 3060.0, 2940.0, 2940.0, 2940.0]
[17.0, 17.0, 17.0, 17.0, 17.0, 17.0, 17.0, 17.0]
[106, 74, 106, 106, 200, 106, 105, 108]
p03551
u327466606
2,000
262,144
Takahashi is now competing in a programming contest, but he received TLE in a problem where the answer is `YES` or `NO`. When he checked the detailed status of the submission, there were N test cases in the problem, and the code received TLE in M of those cases. Then, he rewrote the code to correctly solve each of th...
['if __debug__:\n i = 0\n while True:\n i *= 2\n\nN,M = map(int,input().split())\n\nprint(2**M*(1900*M+100*(N-M)))', '\nN,M = map(int,input().split())\n\nprint(2**M*(1900*M+100*(N-M)))']
['Time Limit Exceeded', 'Accepted']
['s417048195', 's574026984']
[2940.0, 2940.0]
[2104.0, 17.0]
[110, 63]
p03551
u340781749
2,000
262,144
Takahashi is now competing in a programming contest, but he received TLE in a problem where the answer is `YES` or `NO`. When he checked the detailed status of the submission, there were N test cases in the problem, and the code received TLE in M of those cases. Then, he rewrote the code to correctly solve each of th...
['n,z,w=map(int,input().split())\naa=input().split()\nan=int(aa[-1])\nif len(aa) > 1:\n am=int(aa[-2])\n print(max(abs(an-w),abs(an-am)))\nelse:\n print(abs(an-w))', 'n,m=map(int,input().split())\nq=(n-m)*100+m*1900\nprint(q*(1<<m))']
['Runtime Error', 'Accepted']
['s103283858', 's133339665']
[3060.0, 2940.0]
[17.0, 17.0]
[163, 63]
p03551
u389910364
2,000
262,144
Takahashi is now competing in a programming contest, but he received TLE in a problem where the answer is `YES` or `NO`. When he checked the detailed status of the submission, there were N test cases in the problem, and the code received TLE in M of those cases. Then, he rewrote the code to correctly solve each of th...
['import os\nimport sys\n\nif os.getenv("LOCAL"):\n sys.stdin = open("_in.txt", "r")\n\nsys.setrecursionlimit(2147483647)\nINF = float("inf")\n\nN, M = list(map(int, sys.stdin.readline().split()))\n\nN, M = list(map(int, sys.stdin.readline().split()))\n\ntime = M * 1900 + (N - M) * 100\n\np_ac = 1 / 2 ** M\n\nprint(...
['Runtime Error', 'Accepted']
['s831485535', 's610489357']
[3060.0, 3060.0]
[17.0, 17.0]
[382, 330]
p03551
u417014669
2,000
262,144
Takahashi is now competing in a programming contest, but he received TLE in a problem where the answer is `YES` or `NO`. When he checked the detailed status of the submission, there were N test cases in the problem, and the code received TLE in M of those cases. Then, he rewrote the code to correctly solve each of th...
['m,n=map(int,input().split())\n# m=10\n# n=2\nsum_time=1900*n+100*(m-n)\naccuracy_count=2\nprint(sum_time*2**accuracy_count)\n', 'm,n=map(int,input().split())\n# m=10\n# n=2\nsum_time=1900*n+100*(m-n)\naccuracy_count=n\nprint(sum_time*2**accuracy_count)\n']
['Wrong Answer', 'Accepted']
['s224571981', 's707377761']
[2940.0, 2940.0]
[17.0, 17.0]
[119, 119]
p03551
u510295687
2,000
262,144
Takahashi is now competing in a programming contest, but he received TLE in a problem where the answer is `YES` or `NO`. When he checked the detailed status of the submission, there were N test cases in the problem, and the code received TLE in M of those cases. Then, he rewrote the code to correctly solve each of th...
['# coding: utf-8\n\nN, rand = map(int, input().split())\n\nprint (2**rand)*1900 + (N-rand)*100', '# coding: utf-8\n\nN, rand = map(int, input().split())\n\nprint ((2**rand)*(1900*rand + 100*(N-rand)))']
['Runtime Error', 'Accepted']
['s556376795', 's639080772']
[3316.0, 2940.0]
[23.0, 17.0]
[89, 98]
p03551
u520158330
2,000
262,144
Takahashi is now competing in a programming contest, but he received TLE in a problem where the answer is `YES` or `NO`. When he checked the detailed status of the submission, there were N test cases in the problem, and the code received TLE in M of those cases. Then, he rewrote the code to correctly solve each of th...
['N,M = map(int,input().split())\n\nT = (1900*M)+(100*(N-M))\nC = [pow(2,M),pow(2,M)-1]\n\nif M==4: M_set[1]=3\n\nprint(T*C[0]//C[1] if ans%C[1]==0 else T*C[0])', 'N,M = map(int,input().split())\n\nT = (1900*M)+(100*(N-M))\nC = [pow(2,M),pow(2,M)-1]\n\nif M==4: M_set[1]=3\n\nans = T*C[0]//C[1] if ans%C[1]==0 else T*C[0...
['Runtime Error', 'Runtime Error', 'Accepted']
['s300930135', 's983185339', 's169998365']
[3060.0, 3060.0, 2940.0]
[17.0, 17.0, 17.0]
[151, 166, 97]
p03551
u667084803
2,000
262,144
Takahashi is now competing in a programming contest, but he received TLE in a problem where the answer is `YES` or `NO`. When he checked the detailed status of the submission, there were N test cases in the problem, and the code received TLE in M of those cases. Then, he rewrote the code to correctly solve each of th...
['N,Z,W=map(int,input().split())\nA=list(map(int,input().split()))\nans1=abs(A[N-1]-W)\nans2=abs(A[N-1]-A[N-2])\nprint(A[N-1],W,A[N-2])', 'N,M=map(int,input().split())\nt=100*N+1800*M\na=(2**M-1)/(2**M)\nans=t/((2**M)*((1-a)**2))\nprint(int(ans))']
['Runtime Error', 'Accepted']
['s368061592', 's311461608']
[3060.0, 2940.0]
[18.0, 17.0]
[129, 103]
p03551
u722641375
2,000
262,144
Takahashi is now competing in a programming contest, but he received TLE in a problem where the answer is `YES` or `NO`. When he checked the detailed status of the submission, there were N test cases in the problem, and the code received TLE in M of those cases. Then, he rewrote the code to correctly solve each of th...
["\ndef main():\n N,M = int(input().split())\n\n print((1900*M+100*(N-M))*2**M)\n\nif __name__ == '__main__':\n main()", "\ndef main():\n N,M = map(int(input().split()))\n\n print((1900*M+100*(N-M))*2**M)\n\nif __name__ == '__main__':\n main()", "\ndef main():\n N,M = map(int,input().split())\n\n ...
['Runtime Error', 'Runtime Error', 'Accepted']
['s694921779', 's750591451', 's412488497']
[2940.0, 2940.0, 2940.0]
[17.0, 17.0, 19.0]
[118, 123, 122]
p03551
u761320129
2,000
262,144
Takahashi is now competing in a programming contest, but he received TLE in a problem where the answer is `YES` or `NO`. When he checked the detailed status of the submission, there were N test cases in the problem, and the code received TLE in M of those cases. Then, he rewrote the code to correctly solve each of th...
['import math\nN,M = map(int,input().split())\nt = M * 1900 + (N-M) * 100\nac_rate = 1 / (2**M)\nrate = 1.0\nans = 0.0\nfor n in range(1,1000000):\n ans += rate * ac_rate * t * n\n rate *= (1 - ac_rate)\nprint(math.ceil(ans))\n', 'import math\nN,M = map(int,input().split())\nt = M * 1900 + (N-M) * 100\nac_rate = ...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s077946391', 's272256130', 's981722359', 's878039554']
[3060.0, 3060.0, 3060.0, 2940.0]
[648.0, 75.0, 1884.0, 17.0]
[221, 220, 221, 82]
p03551
u854685751
2,000
262,144
Takahashi is now competing in a programming contest, but he received TLE in a problem where the answer is `YES` or `NO`. When he checked the detailed status of the submission, there were N test cases in the problem, and the code received TLE in M of those cases. Then, he rewrote the code to correctly solve each of th...
['n, m = input().split(" ")\n# n, m = 100, 5\n\ngacha = 1900 * m\nstate = 100 * (n-m)\n\nres = (gacha + state) * 2**m\n\nprint(res)\n', 'n, m = map(int, input().split(" "))\n# n, m = 100, 5\n\ngacha = 1900 * m\nstate = 100 * (n-m)\n\nres = (gacha + state) * 2**m\n\nprint(res)\n']
['Runtime Error', 'Accepted']
['s325801317', 's354755668']
[2940.0, 2940.0]
[17.0, 17.0]
[122, 132]
p03551
u886743443
2,000
262,144
Takahashi is now competing in a programming contest, but he received TLE in a problem where the answer is `YES` or `NO`. When he checked the detailed status of the submission, there were N test cases in the problem, and the code received TLE in M of those cases. Then, he rewrote the code to correctly solve each of th...
['n,m = map(int,input().split())\nsol = 0\na = 1900 * m + 100 * (n - m)\npot = 2 ** m \nfor i in range(1,1000):\n sol += i * ( (pot - 1) ** (i- 1) / (pot) ** i)\nprint(int(sol * a))\n', 'from math import *\nn,m = map(int,input().split())\nsol = 0\na = 1900 * m + 100 * (n - m)\npot = 2 ** m \nfor i in range(1,1000):\...
['Wrong Answer', 'Accepted']
['s734318152', 's718406128']
[2940.0, 3188.0]
[25.0, 26.0]
[177, 197]
p03551
u959236700
2,000
262,144
Takahashi is now competing in a programming contest, but he received TLE in a problem where the answer is `YES` or `NO`. When he checked the detailed status of the submission, there were N test cases in the problem, and the code received TLE in M of those cases. Then, he rewrote the code to correctly solve each of th...
["n,m=[int(i) for i in input().split(' ')]\nprint((100*(n-m)+1900*m)*(2**5))", "n,m=[int(i) for i in input().split(' ')]\nprint((100*(n-m)+1900*m)*(m**2))", "n,m=[int(i) for i in input().split(' ')]\nprint((100*(n-m)+1900*m)*(2**m))"]
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s637668363', 's828499089', 's820909782']
[3064.0, 2940.0, 2940.0]
[17.0, 19.0, 18.0]
[73, 73, 73]
p03552
u015768390
2,000
262,144
We have a deck consisting of N cards. Each card has an integer written on it. The integer on the i-th card from the top is a_i. Two people X and Y will play a game using this deck. Initially, X has a card with Z written on it in his hand, and Y has a card with W written on it in his hand. Then, starting from X, they w...
['n,z,w=map(int,input().split())\nA=[int(x) for x in input().split()]\nprint(max(abs(A[n-2]-A[n-1]),abs(A[n-1],w))) if n!=1 else print(abs(a[0]-w))', 'n,z,w=map(int,input().split())\nA=[int(x) for x in input().split()]\nprint(max(abs(A[n-2]-A[n-1]),abs(A[n-1]-w))) if n!=1 else print(abs(A[0]-w))\n']
['Runtime Error', 'Accepted']
['s679785818', 's210664460']
[3188.0, 3188.0]
[18.0, 18.0]
[143, 144]
p03552
u026788530
2,000
262,144
We have a deck consisting of N cards. Each card has an integer written on it. The integer on the i-th card from the top is a_i. Two people X and Y will play a game using this deck. Initially, X has a card with Z written on it in his hand, and Y has a card with W written on it in his hand. Then, starting from X, they w...
['n,z,w=[int(x) for x in input().split()]\n\na=[int(x) for x in input().split()]\n\nif(n==1):\n print(abs(a[0]-w))\nelse:\n print(min(abs(a[-1]-w),abs(a[-1]-a[-2])))', 'n,z,w=[int(x) for x in input().split()]\n \na=[int(x) for x in input().split()]\n \nif(n==1):\n print(abs(a[0]-w))\nelse:\n print(max(abs(a[-1]-w),...
['Wrong Answer', 'Accepted']
['s857780142', 's818575265']
[3188.0, 3188.0]
[18.0, 18.0]
[158, 160]
p03552
u162612857
2,000
262,144
We have a deck consisting of N cards. Each card has an integer written on it. The integer on the i-th card from the top is a_i. Two people X and Y will play a game using this deck. Initially, X has a card with Z written on it in his hand, and Y has a card with W written on it in his hand. Then, starting from X, they w...
['n, x0, y0 = list(map(int, input().split()))\n\ncards = [y0] + list(map(int, input().split()))\n\n\nxs = [[-1] * (n+1) for i in range(n+1)]\nys = [[-1] * (n+1) for i in range(n+1)] \n\n\n\nfor i in range(n+1):\n\txs[i][-1] = abs(cards[-1] - cards[i])\n\tys[i][-1] = abs(cards[-1] - cards[i])\n\nfor j in range(n-1, -1, ...
['Wrong Answer', 'Accepted']
['s634856080', 's628421519']
[68212.0, 68084.0]
[2107.0, 793.0]
[868, 840]
p03552
u257974487
2,000
262,144
We have a deck consisting of N cards. Each card has an integer written on it. The integer on the i-th card from the top is a_i. Two people X and Y will play a game using this deck. Initially, X has a card with Z written on it in his hand, and Y has a card with W written on it in his hand. Then, starting from X, they w...
[' N, Z, W = map(int,input().split())\n p = list(map(int,input().split()))\n a = abs(p[N-2] - p[N-1])\n b = abs(p[N-1] - W)\n print(max(a, b))', 'N, Z, W = map(int,input().split())\np = list(map(int,input().split()))\na = abs(p[N-2] - p[N-1])\nb = abs(p[N-1] - W)\nprint(max(a, b))']
['Runtime Error', 'Accepted']
['s795333186', 's203562050']
[2940.0, 3188.0]
[17.0, 18.0]
[151, 131]
p03552
u410717334
2,000
262,144
We have a deck consisting of N cards. Each card has an integer written on it. The integer on the i-th card from the top is a_i. Two people X and Y will play a game using this deck. Initially, X has a card with Z written on it in his hand, and Y has a card with W written on it in his hand. Then, starting from X, they w...
['import math\nN,Z,W=list(map(int,input().split()))\ni=0\na=list(map(int,input().split()))\nb=math.fabs(a[N-1]-W)\nc=math.fabs(a[N-2]-a[N-1])\nprint(max(b,c))', 'import math\nN,Z,W=list(map(int,input().split()))\na=list(map(int,input().split()))\nb=math.fabs(a[N-1]-W)\nc=math.fabs(a[N-2]-a[N-1])\nprint(int(max(b,c)))']
['Wrong Answer', 'Accepted']
['s211232687', 's776929858']
[3188.0, 3188.0]
[18.0, 18.0]
[150, 151]
p03552
u422104747
2,000
262,144
We have a deck consisting of N cards. Each card has an integer written on it. The integer on the i-th card from the top is a_i. Two people X and Y will play a game using this deck. Initially, X has a card with Z written on it in his hand, and Y has a card with W written on it in his hand. Then, starting from X, they w...
['l=input().split()\nn=int(l[0])\nw=int(l[2])\nl=input().split()\na=[]\nfor i in range(n):\n a.append(int(l[n-1-i]))\ns=[]\nm=[]\nif n>=3:\n s.append(abs(a[1]-a[0]))\n s.append(max(abs(a[2]-a[0]),abs(a[1]-a[0])))\n m=[s[0],min(s[0],s[1])]\n x=min(abs(a[2]-a[0]),m[0])\n for i in range(2,n-2):\n if(max(abs(a[i]-...
['Wrong Answer', 'Accepted']
['s012256297', 's572831028']
[3316.0, 3316.0]
[60.0, 61.0]
[715, 722]
p03552
u572142121
2,000
262,144
We have a deck consisting of N cards. Each card has an integer written on it. The integer on the i-th card from the top is a_i. Two people X and Y will play a game using this deck. Initially, X has a card with Z written on it in his hand, and Y has a card with W written on it in his hand. Then, starting from X, they w...
['A=list(map(int, input().split()))\nif N==1:\n print(abs(A[-1]-W))\nelse:\n a=abs(A[-1]-W)\n b=abs(A[-2]-A[-1])\n print(max(a,b))', 'N,Z,W=map(int,input().split())\nA=list(map(int, input().split()))\nif N==1:\n print(abs(A[-1]-W))\nelif N==2:\n print(abs(A[-1]-W),abs(A[0]-A[-1]))\nelse:\n a=abs(A[-1]-W)\n b=ab...
['Runtime Error', 'Runtime Error', 'Accepted']
['s278657600', 's874911475', 's493409544']
[3060.0, 3064.0, 3188.0]
[17.0, 18.0, 18.0]
[126, 212, 157]
p03552
u596276291
2,000
262,144
We have a deck consisting of N cards. Each card has an integer written on it. The integer on the i-th card from the top is a_i. Two people X and Y will play a game using this deck. Initially, X has a card with Z written on it in his hand, and Y has a card with W written on it in his hand. Then, starting from X, they w...
['import sys\nfrom collections import defaultdict, Counter\nfrom itertools import product, groupby, count, permutations, combinations\nfrom math import pi, sqrt, ceil, floor\nfrom collections import deque\nfrom bisect import bisect, bisect_left, bisect_right\nfrom string import ascii_lowercase\nINF = float("inf")\nsys....
['Wrong Answer', 'Accepted']
['s942786373', 's174930892']
[5872.0, 3960.0]
[2104.0, 26.0]
[1421, 770]
p03552
u722641375
2,000
262,144
We have a deck consisting of N cards. Each card has an integer written on it. The integer on the i-th card from the top is a_i. Two people X and Y will play a game using this deck. Initially, X has a card with Z written on it in his hand, and Y has a card with W written on it in his hand. Then, starting from X, they w...
["\ndef main():\n N,Z,W = map(int,input().split())\n a = list(map(int,input().split()))\n\n print(max(abs(a[N-1]-W,abs(a[N-1]-a[N-2]))))\n\nif __name__ == '__main__':\n main()", "\ndef main():\n N,Z,W = map(int,input().split())\n a = list(map(int,input().split()))\n\n print(max(abs(a[N-1]-W),abs(a[...
['Runtime Error', 'Accepted']
['s622370166', 's919603847']
[3188.0, 3188.0]
[18.0, 18.0]
[177, 177]
p03553
u062147869
2,000
262,144
We have N gemstones labeled 1 through N. You can perform the following operation any number of times (possibly zero). * Select a positive integer x, and smash all the gems labeled with multiples of x. Then, for each i, if the gem labeled i remains without getting smashed, you will receive a_i yen (the currency of ...
['from collections import deque\nclass Dinic:\n def __init__(self,number):\n self.table = [[0]*(number) for i in range(number)]\n self.n=number\n \n def add(self,x,y,f):\n self.table[x][y]=f\n \n def bfs(self,x):\n self.visit[x]=0\n h=deque()\n h.append(x)\n ...
['Wrong Answer', 'Accepted']
['s313793631', 's954031688']
[3436.0, 3188.0]
[32.0, 36.0]
[1561, 1122]
p03553
u297574184
2,000
262,144
We have N gemstones labeled 1 through N. You can perform the following operation any number of times (possibly zero). * Select a positive integer x, and smash all the gems labeled with multiples of x. Then, for each i, if the gem labeled i remains without getting smashed, you will receive a_i yen (the currency of ...
['N = int(input())\nAs = list(map(int, input().split()))\n\ndef func(Bs):\n for x in range(N):\n if Bs[x] >= 0: continue\n if max(Bs[x::x + 1]) <= 0:\n Bs[x] = 0\n\nfunc(As)\n\nfor x in range(34, 51):\n if As[x - 1] + As[x * 2 - 1] < 0:\n As[x - 1] = 0\n As[x * 2 - 1] = 0\n\...
['Runtime Error', 'Accepted']
['s146323018', 's510251017']
[3188.0, 3444.0]
[20.0, 23.0]
[1130, 2891]
p03553
u340781749
2,000
262,144
We have N gemstones labeled 1 through N. You can perform the following operation any number of times (possibly zero). * Select a positive integer x, and smash all the gems labeled with multiples of x. Then, for each i, if the gem labeled i remains without getting smashed, you will receive a_i yen (the currency of ...
['def check(iter, broken):\n iter_ans=0\n for j in iter:\n tmp_sum=0\n tmp_broken=set()\n for t in range(j, n, j+1):\n if t not in broken:\n tmp_sum+=aa[t]\n tmp_broken.add(t)\n \n if tmp_sum < 0:\n iter_ans -= tmp_sum\n ...
['Runtime Error', 'Accepted']
['s530042662', 's823531215']
[5224.0, 3444.0]
[48.0, 24.0]
[681, 1979]
p03553
u637175065
2,000
262,144
We have N gemstones labeled 1 through N. You can perform the following operation any number of times (possibly zero). * Select a positive integer x, and smash all the gems labeled with multiples of x. Then, for each i, if the gem labeled i remains without getting smashed, you will receive a_i yen (the currency of ...
['import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools\n\nsys.setrecursionlimit(10**7)\ninf = 10**20\neps = 1.0 / 10**15\nmod = 10**9+7\n\ndef LI(): return [int(x) for x in sys.stdin.readline().split()]\ndef LI_(): return [int(x)-1 for x in sys.stdin.readline().split()...
['Wrong Answer', 'Accepted']
['s658841784', 's833575440']
[5464.0, 10956.0]
[85.0, 46.0]
[2277, 2164]
p03553
u785205215
2,000
262,144
We have N gemstones labeled 1 through N. You can perform the following operation any number of times (possibly zero). * Select a positive integer x, and smash all the gems labeled with multiples of x. Then, for each i, if the gem labeled i remains without getting smashed, you will receive a_i yen (the currency of ...
['class Ford_Fulkerson:\n\n\tdef __init__(self, v, inf=float("inf")):\n\t\tself.V = v\n\t\tself.inf = inf\n\t\tself.G = [[] for _ in range(v)]\n\t\tself.used = [False for _ in range(v)]\n\n\tdef addEdge(self, fm, to, cap):\n\t\tself.G[fm].append({\'to\':to, \'cap\':cap, \'rev\':len(self.G[to])})\n\t\tself.G[to].append(...
['Wrong Answer', 'Accepted']
['s658958126', 's172789501']
[3316.0, 3444.0]
[19.0, 24.0]
[1475, 1357]
p03553
u952467214
2,000
262,144
We have N gemstones labeled 1 through N. You can perform the following operation any number of times (possibly zero). * Select a positive integer x, and smash all the gems labeled with multiples of x. Then, for each i, if the gem labeled i remains without getting smashed, you will receive a_i yen (the currency of ...
["from collections import deque\nclass Dinic:\n def __init__(self, N):\n elf.N = N\n self.G = [[] for i in range(N)]\n\n def add_edge(self, fr, to, cap):\n forward = [to, cap, None]\n forward[2] = backward = [fr, 0, forward]\n self.G[fr].append(forward)\n self.G[to].appen...
['Runtime Error', 'Accepted']
['s332409715', 's019255055']
[9488.0, 9576.0]
[29.0, 35.0]
[2019, 2020]
p03559
u024340351
2,000
262,144
The season for Snuke Festival has come again this year. First of all, Ringo will perform a ritual to summon Snuke. For the ritual, he needs an altar, which consists of three parts, one in each of the three categories: upper, middle and lower. He has N parts for each of the three categories. The size of the i-th upper ...
['N = int(input())\nA = list(map(int, input().split()))\nB = list(map(int, input().split()))\nC = list(map(int, input().split()))\n\nA = sorted(A)\nB = sorted(B)\nC = sorted(C)', 'N = int(input())\nA = list(map(int, input().split()))\nB = list(map(int, input().split()))\nC = list(map(int, input().split()))\n\nA = sorte...
['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s555133523', 's835971709', 's900745536', 's483727121']
[29540.0, 29524.0, 29288.0, 30988.0]
[136.0, 227.0, 136.0, 297.0]
[167, 350, 289, 529]
p03559
u076917070
2,000
262,144
The season for Snuke Festival has come again this year. First of all, Ringo will perform a ritual to summon Snuke. For the ritual, he needs an altar, which consists of three parts, one in each of the three categories: upper, middle and lower. He has N parts for each of the three categories. The size of the i-th upper ...
['import sys\nimport fractions\ninput=sys.stdin.readline\n\nn = int(input())\na = list(map(int, input().split()))\nb = list(map(int, input().split()))\nc = list(map(int, input().split()))\n\na.sort()\nb.sort()\nc.sort()\n\nprint(a)\nprint(b)\nprint(c)\n\nans = 0\nk = 0\nfor i in a:\n for j in b:\n if j <= i:\...
['Wrong Answer', 'Accepted']
['s370875143', 's929508193']
[26132.0, 24620.0]
[2105.0, 343.0]
[439, 351]
p03559
u089142196
2,000
262,144
The season for Snuke Festival has come again this year. First of all, Ringo will perform a ritual to summon Snuke. For the ritual, he needs an altar, which consists of three parts, one in each of the three categories: upper, middle and lower. He has N parts for each of the three categories. The size of the i-th upper ...
['import bisect\n\nN=int(input())\nA=list(map(int,input().split()))\nB=list(map(int,input().split()))\nC=list(map(int,input().split()))\n\nA.sort()\nB.sort()\nC.sort()\nans=0\n\nfor b in B: #O(N)\n s = bisect.bisect_left(A,b) #O(logN)\n t = bisect.bisect_right(C,b) #O(logN)\n print(s,N-t,s*(N-t))\n ans += s...
['Wrong Answer', 'Accepted']
['s350893867', 's987710640']
[23328.0, 22516.0]
[523.0, 320.0]
[324, 325]
p03559
u189023301
2,000
262,144
The season for Snuke Festival has come again this year. First of all, Ringo will perform a ritual to summon Snuke. For the ritual, he needs an altar, which consists of three parts, one in each of the three categories: upper, middle and lower. He has N parts for each of the three categories. The size of the i-th upper ...
["import bisect\nimport sys\nreadline = sys.stdin.buffer.readline\n\n\ndef main():\n n = int(readline())\n a = list(map(int,readline().rsplit()))\n b = list(map(int,readline().rsplit()))\n c = list(map(int,readline().rsplit()))\n as = sorted(a)\n cs = sorted(C)\n ans = 0\n for i in b:\n d...
['Runtime Error', 'Wrong Answer', 'Accepted']
['s125298191', 's276242242', 's993930262']
[2940.0, 21088.0, 21088.0]
[19.0, 474.0, 346.0]
[451, 460, 455]
p03559
u238510421
2,000
262,144
The season for Snuke Festival has come again this year. First of all, Ringo will perform a ritual to summon Snuke. For the ritual, he needs an altar, which consists of three parts, one in each of the three categories: upper, middle and lower. He has N parts for each of the three categories. The size of the i-th upper ...
['import bisect\n\nn = int(input())\na = [int(x) for x in input().split()]\nb = [int(x) for x in input().split()]\nc = [int(x) for x in input().split()]\n\na = sorted(a)\nb = sorted(b)\nc = sorted(c)\n\nans = 0\n\nfor x in b:\n print(x)\n aa = bisect.bisect_left(a,x)\n cc = len(c) - bisect.bisect_right(c,x)\n ...
['Wrong Answer', 'Accepted']
['s327933032', 's328605907']
[23232.0, 23232.0]
[700.0, 350.0]
[391, 319]
p03559
u241159583
2,000
262,144
The season for Snuke Festival has come again this year. First of all, Ringo will perform a ritual to summon Snuke. For the ritual, he needs an altar, which consists of three parts, one in each of the three categories: upper, middle and lower. He has N parts for each of the three categories. The size of the i-th upper ...
['import bisect\nN = int(input())\nA = []\nfor _ in range(3):\n a = list(map(int, input().split()))\n a.sort()\n A.append(a)\nprint(A)\nans = 0\nfor b in A[1]:\n a = bisect.bisect_left(A[0], b)\n c = bisect.bisect_right(A[2], b)\n ans += a * (N-c)\nprint(ans) ', 'import bisect\nN = int(input())\nA = []\nfor _ in...
['Wrong Answer', 'Accepted']
['s195629276', 's068078430']
[27636.0, 22720.0]
[355.0, 324.0]
[252, 246]
p03559
u280269055
2,000
262,144
The season for Snuke Festival has come again this year. First of all, Ringo will perform a ritual to summon Snuke. For the ritual, he needs an altar, which consists of three parts, one in each of the three categories: upper, middle and lower. He has N parts for each of the three categories. The size of the i-th upper ...
['n = int(input())\na = list(map(int, input().split()))\nb = list(map(int, input().split()))\nc = list(map(int, input().split()))\n\n\ni = 0\nj = 0\nk = 0\np = []\nwhile i < n and j < n:\n if a[i] < b[j]:\n i += 1\n else:\n p.append(i + k)\n k = p[-1]\n j += 1\nelse:\n while j < n:\...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s314482749', 's523749041', 's887865610']
[23328.0, 24052.0, 24768.0]
[215.0, 347.0, 369.0]
[543, 570, 705]
p03559
u299801457
2,000
262,144
The season for Snuke Festival has come again this year. First of all, Ringo will perform a ritual to summon Snuke. For the ritual, he needs an altar, which consists of three parts, one in each of the three categories: upper, middle and lower. He has N parts for each of the three categories. The size of the i-th upper ...
['n=int(input())\na=list(map(int,input().split()))\nb=list(map(int,input().split()))\nc=list(map(int,input().split()))\n\na.sort()\nb.sort()\nc.sort()\n\ndef binary_search(x,i):\n\tlow = 0\n\thigh = len(x)\n\tt = (low + high) // 2 \n\twhile (low<=high):\n\t\tif (i==x[t]):\n\t\t\tbreak\n\t\telif (i > x[t]):\n\t\t\tlow =...
['Runtime Error', 'Accepted']
['s422580501', 's175848331']
[24180.0, 23360.0]
[2105.0, 330.0]
[507, 275]
p03559
u314057689
2,000
262,144
The season for Snuke Festival has come again this year. First of all, Ringo will perform a ritual to summon Snuke. For the ritual, he needs an altar, which consists of three parts, one in each of the three categories: upper, middle and lower. He has N parts for each of the three categories. The size of the i-th upper ...
['from bisect import bisect_left, bisect_right, insort_left, insort_right\ndef main():\n N = int(input())\n A = sorted(list(map(int, input().split())))\n B = sorted(list(map(int, input().split())))\n C = sorted(list(map(int, input().split())))\n\n print("A",A)\n print("B",B)\n print("C",C)\n\n B...
['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s080008280', 's125067937', 's259167507', 's420376706']
[31840.0, 28076.0, 24264.0, 24948.0]
[556.0, 398.0, 222.0, 361.0]
[749, 692, 569, 642]
p03559
u345966487
2,000
262,144
The season for Snuke Festival has come again this year. First of all, Ringo will perform a ritual to summon Snuke. For the ritual, he needs an altar, which consists of three parts, one in each of the three categories: upper, middle and lower. He has N parts for each of the three categories. The size of the i-th upper ...
['from bisect import*\nr=lambda:sorted(map(int,input().split()))\nN=r()[0]\nA,B,C,w,s=r(),r(),r(),[0]*N,0\nfor i in range(N-1,-1,-1):s=w[i]=s+N-bisect(C,B[i])\nprint(sum(w[bisect(B,A[i])]for i in range(N)))', 'from bisect import*;(N,),A,B,C=[sorted(map(int,input().split()))for _ in[0]*4];print(sum(bisect_left(A,b)*(N-b...
['Runtime Error', 'Accepted']
['s784475681', 's759116075']
[22720.0, 22720.0]
[360.0, 297.0]
[199, 133]
p03559
u368780724
2,000
262,144
The season for Snuke Festival has come again this year. First of all, Ringo will perform a ritual to summon Snuke. For the ritual, he needs an altar, which consists of three parts, one in each of the three categories: upper, middle and lower. He has N parts for each of the three categories. The size of the i-th upper ...
['K = int(input())\nwhile not K%2:\n K //= 2\nwhile not K%5:\n K //= 5\nans = sum(map(int, str(K)))\nfor i in range(1,100000):\n x = i*K\n ans = min(ans, sum(map(int, str(x))))\nprint(ans)', "N = int(input())\nA = list(map(int, input().split()))\n#A = [int(x) for x in input().split()]\nB = list(map(int, inp...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s155837965', 's878403380', 's915442920']
[3060.0, 23220.0, 23616.0]
[239.0, 1624.0, 367.0]
[189, 697, 227]
p03559
u370331385
2,000
262,144
The season for Snuke Festival has come again this year. First of all, Ringo will perform a ritual to summon Snuke. For the ritual, he needs an altar, which consists of three parts, one in each of the three categories: upper, middle and lower. He has N parts for each of the three categories. The size of the i-th upper ...
['N = int(input())\nA = list(map(int,input().split()))\nB = list(map(int,input().split()))\nC = list(map(int,input().split()))\nA = list(set(A))\nB = list(set(B))\nC = list(set(C))\nn1,n2,n3 = len(A),len(B),len(C)\nAll = [] \nB_A = [] \nB_C = [] \n\nfor i in range(n1): All.append([A[i],0])\nfor i in range(n2): All.appe...
['Wrong Answer', 'Accepted']
['s970955758', 's615442470']
[64200.0, 23232.0]
[1513.0, 330.0]
[1269, 384]
p03559
u370721525
2,000
262,144
The season for Snuke Festival has come again this year. First of all, Ringo will perform a ritual to summon Snuke. For the ritual, he needs an altar, which consists of three parts, one in each of the three categories: upper, middle and lower. He has N parts for each of the three categories. The size of the i-th upper ...
['import bisect\nfrom collections import deque\nN = int(input())\nA = list(map(int, input().split()))\nB = list(map(int, input().split()))\nC = list(map(int, input().split()))\nA.sort()\nB.sort()\nC.sort()\n\nd = deque([])\nfor i in range(N):\n n = bisect.bisect_right(C, B[N-1-i])\n if len(d) == 0:\n d.appendleft(...
['Runtime Error', 'Accepted']
['s110393502', 's108429271']
[29548.0, 29640.0]
[563.0, 555.0]
[433, 447]
p03559
u397531548
2,000
262,144
The season for Snuke Festival has come again this year. First of all, Ringo will perform a ritual to summon Snuke. For the ritual, he needs an altar, which consists of three parts, one in each of the three categories: upper, middle and lower. He has N parts for each of the three categories. The size of the i-th upper ...
['N=int(input())\nA=list(map(int,input().split()))\nB=list(map(int,input().split()))\nC=list(map(int,input().split()))\nA.sort()\nB.sort()\nC.sort()\nans=0\nfor j in range(N):\n a=bisect.bisect_left(a, B[j])\n c=bisect.bisect_right(a, B[j])\n ans+=a*c\nprint(ans)', 'from bisect import bisect_left, bisect_right...
['Runtime Error', 'Accepted']
['s722998052', 's150720751']
[23328.0, 23360.0]
[196.0, 332.0]
[258, 293]
p03559
u426649993
2,000
262,144
The season for Snuke Festival has come again this year. First of all, Ringo will perform a ritual to summon Snuke. For the ritual, he needs an altar, which consists of three parts, one in each of the three categories: upper, middle and lower. He has N parts for each of the three categories. The size of the i-th upper ...
['from bisect import bisect_right\n\nif __name__ == "__main__":\n n = int(input())\n a = list(map(int, input().split()))\n b = list(map(int, input().split()))\n c = list(map(int, input().split()))\n a = sorted(a)\n b = sorted(b)\n c = sorted(c)\n\n ans = 0\n\n \n clist = [0] * n\n clist...
['Runtime Error', 'Accepted']
['s132191556', 's907121241']
[23924.0, 24052.0]
[344.0, 356.0]
[610, 637]
p03559
u452885705
2,000
262,144
The season for Snuke Festival has come again this year. First of all, Ringo will perform a ritual to summon Snuke. For the ritual, he needs an altar, which consists of three parts, one in each of the three categories: upper, middle and lower. He has N parts for each of the three categories. The size of the i-th upper ...
['import bisect\n\nN= int(input())\na = map(int, input().split(" "))\nb = map(int, input().split(" "))\nc = map(int, input().split(" "))\n\na = sorted(a)\nb = sorted(b)\nc = sorted(c,reverse=True)\n\nresult = 0\nfor i in b:\n ta = bisect.bisect_left(a,i)\n tc = bisect.bisect_right(c,i)\n result += ta*(N-tc)\np...
['Wrong Answer', 'Accepted']
['s268253670', 's713544217']
[35448.0, 35704.0]
[232.0, 238.0]
[314, 301]
p03559
u463775490
2,000
262,144
The season for Snuke Festival has come again this year. First of all, Ringo will perform a ritual to summon Snuke. For the ritual, he needs an altar, which consists of three parts, one in each of the three categories: upper, middle and lower. He has N parts for each of the three categories. The size of the i-th upper ...
['import bisect\nn = int(input())\na = sorted(list(map(int,input().split())))\nb = sorted(list(map(int,input().split())))\nc = sorted(list(map(int,input().split())))\nans = 0\nfor i in range(n):\n l = (bisect.bisect_left(a,b[i]))*(n-bisect.bisect_right(c,b[i]))\n ans += 1\nprint(ans)', 'import bisect\n\nn = int(i...
['Wrong Answer', 'Accepted']
['s046903595', 's910981579']
[23244.0, 23744.0]
[321.0, 368.0]
[279, 306]
p03559
u520158330
2,000
262,144
The season for Snuke Festival has come again this year. First of all, Ringo will perform a ritual to summon Snuke. For the ritual, he needs an altar, which consists of three parts, one in each of the three categories: upper, middle and lower. He has N parts for each of the three categories. The size of the i-th upper ...
['N = int(input())\nA = sorted(list(map(int,input().split())))\nB = list(map(int,input().split()))\nC = sorted(list(map(int,input().split())))\n\nans = 0\n#print(A)\n#print(C)\nfor b in B:\n lenA = bisect.bisect_left(A,b) \n lenC = N - bisect.bisect_left(C,b) if b not in C else N - C.index(b) - 1\n ans += lenA...
['Runtime Error', 'Accepted']
['s507287165', 's218324023']
[23744.0, 23744.0]
[161.0, 368.0]
[384, 321]
p03559
u537782349
2,000
262,144
The season for Snuke Festival has come again this year. First of all, Ringo will perform a ritual to summon Snuke. For the ritual, he needs an altar, which consists of three parts, one in each of the three categories: upper, middle and lower. He has N parts for each of the three categories. The size of the i-th upper ...
['import bisect\na = int(input())\nb = list(map(int, input().split()))\nb.sort()\nc = list(map(int, input().split()))\nd = list(map(int, input().split()))\nd.sort()\nans = 0\nfor i in range(a):\n ans += bisect.bisect_left(b, c[i]) * (a - bisect.bisect_right(d, c[i]))\n ', 'import bisect\n\na = int(input())\nb = lis...
['Wrong Answer', 'Accepted']
['s191258745', 's053998845']
[23232.0, 23360.0]
[358.0, 348.0]
[262, 253]
p03559
u569272329
2,000
262,144
The season for Snuke Festival has come again this year. First of all, Ringo will perform a ritual to summon Snuke. For the ritual, he needs an altar, which consists of three parts, one in each of the three categories: upper, middle and lower. He has N parts for each of the three categories. The size of the i-th upper ...
['def function1(array, number, first, last):\n if first+1 == last:\n return last\n index = (first+last)//2\n if number <= array[index]:\n return function1(array, number, first, index)\n else:\n return function1(array, number, index, last)\n\n\ndef function2(array, number, first, last):\...
['Wrong Answer', 'Accepted']
['s547246820', 's095529706']
[23328.0, 23360.0]
[1200.0, 349.0]
[808, 290]
p03559
u569322757
2,000
262,144
The season for Snuke Festival has come again this year. First of all, Ringo will perform a ritual to summon Snuke. For the ritual, he needs an altar, which consists of three parts, one in each of the three categories: upper, middle and lower. He has N parts for each of the three categories. The size of the i-th upper ...
['\nimport bisect\n\n\nI = lambda: list(map(int, input().split()))\nN = I()\nA = I()\nB = I()\nC = I()\nA.sort()\nB.sort()\nC.sort()\n\nsumm = 0\nfor ai in A:\n r = bisect.bisect_right(B, ai)\n for bi in B[r:]:\n rr = bisect.bisect_right(C, bi)\n summ += (N - r) * (N - rr)\n\nprint(summ)\n', 'import...
['Runtime Error', 'Accepted']
['s940854189', 's806480927']
[23328.0, 23360.0]
[261.0, 348.0]
[287, 291]
p03559
u614181788
2,000
262,144
The season for Snuke Festival has come again this year. First of all, Ringo will perform a ritual to summon Snuke. For the ritual, he needs an altar, which consists of three parts, one in each of the three categories: upper, middle and lower. He has N parts for each of the three categories. The size of the i-th upper ...
['n = int(input())\na = list(map(int,input().split()))\nb = list(map(int,input().split()))\nc = list(map(int,input().split()))\na = sorted(a)\nb = sorted(b)\nc = sorted(c)\ncount = 0\nimport bisect\nfor i in range(n):\n A = bisect.bisect(a,b[i]-1)\n B = bisect.bisect(c,b[i]+1)\n count += A*(n-B)\nprint(count)'...
['Wrong Answer', 'Accepted']
['s417721448', 's186898404']
[23164.0, 23328.0]
[349.0, 354.0]
[304, 315]
p03559
u623687794
2,000
262,144
The season for Snuke Festival has come again this year. First of all, Ringo will perform a ritual to summon Snuke. For the ritual, he needs an altar, which consists of three parts, one in each of the three categories: upper, middle and lower. He has N parts for each of the three categories. The size of the i-th upper ...
['import bisect\nn=int(input())\na=sorted(list(map(int,input().split())))\nb=sorted(list(map(int,input().split())))\nc=sorted(list(map(int,input().split())))\nans=0\nfor i in range(n):\n d=bisect.bisect_left(a,b[i])\n e=bisect.bisect_right(c,b[i])\n ans+=d*e\nprint(ans)\n', 'import bisect\nn=int(input())\na=sorted(l...
['Wrong Answer', 'Accepted']
['s827493989', 's208282999']
[23092.0, 23200.0]
[329.0, 331.0]
[262, 266]
p03559
u703890795
2,000
262,144
The season for Snuke Festival has come again this year. First of all, Ringo will perform a ritual to summon Snuke. For the ritual, he needs an altar, which consists of three parts, one in each of the three categories: upper, middle and lower. He has N parts for each of the three categories. The size of the i-th upper ...
['N = int(input())\nA = list(map(int, input().split()))\nB = list(map(int, input().split()))\nC = list(map(int, input().split()))\ns = 0\n\nA = sorted(A)\nB = sorted(B)\nC = sorted(C)\n\nia = 0\nic = 0\n\nfor b in B:\n while True:\n if ia == N-1 or A[ia+1]>=b: \n break\n ia += 1\n while True:\n if ic ==...
['Wrong Answer', 'Accepted']
['s849336111', 's322834878']
[23328.0, 23328.0]
[381.0, 349.0]
[378, 380]
p03559
u707124227
2,000
262,144
The season for Snuke Festival has come again this year. First of all, Ringo will perform a ritual to summon Snuke. For the ritual, he needs an altar, which consists of three parts, one in each of the three categories: upper, middle and lower. He has N parts for each of the three categories. The size of the i-th upper ...
['import bisect\nn=int(input())\na=sorted(list(map(int,input().split())))\nb=sorted(list(map(int,input().split())))\nc=sorted(list(map(int,input().split())))\nab={} \nl=bisect.bisect_right(b,a[0])\nab[0]=l\nfor i in range(1,n):\n if a[i]<b[ab[i-1]]:\n ab[i]=ab[i-1]\n else:\n j=ab[i-1]+1\n while n>j and a[i]>...
['Runtime Error', 'Accepted']
['s631845417', 's327361285']
[46340.0, 23200.0]
[2106.0, 324.0]
[719, 350]
p03559
u767664985
2,000
262,144
The season for Snuke Festival has come again this year. First of all, Ringo will perform a ritual to summon Snuke. For the ritual, he needs an altar, which consists of three parts, one in each of the three categories: upper, middle and lower. He has N parts for each of the three categories. The size of the i-th upper ...
['from bisect import bisect_left\n\nN = int(input())\nA = sorted(list(map(int, input().split())))\nB = sorted(list(map(int, input().split())))\nC = sorted(list(map(int, input().split())))\n\nans = 0\n\nfor ai in range(N):\n bi = bisect_left(B, A[ai])\n ci = bisect_left(C, B[bi])\n ans += (N-bi)*(N-ci)\n\nprint...
['Runtime Error', 'Accepted']
['s518724293', 's769373329']
[23092.0, 23232.0]
[335.0, 345.0]
[310, 343]
p03559
u817328209
2,000
262,144
The season for Snuke Festival has come again this year. First of all, Ringo will perform a ritual to summon Snuke. For the ritual, he needs an altar, which consists of three parts, one in each of the three categories: upper, middle and lower. He has N parts for each of the three categories. The size of the i-th upper ...
['k = int(input())\nkn = [0]*30\ntmp = k\nfor i in range(30) :\n kn[i] = tmp%10\n tmp = tmp//10\np = [0,1,2,3,-4,-3,-2,-1,0]\nans = sum(kn)\nfor i in range(1, 10) :\n res = 0\n for j in range(30) :\n res += i*kn[j]%10\n res += i*kn[j]//10\n ans = min(ans, res)\n\nprint(ans)', 'import bisect...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s889428266', 's900838973', 's957910671']
[3064.0, 23360.0, 23360.0]
[20.0, 322.0, 374.0]
[286, 414, 302]
p03559
u859897687
2,000
262,144
The season for Snuke Festival has come again this year. First of all, Ringo will perform a ritual to summon Snuke. For the ritual, he needs an altar, which consists of three parts, one in each of the three categories: upper, middle and lower. He has N parts for each of the three categories. The size of the i-th upper ...
['n=int(input())\na=list(map(int,input().split()))\nb=list(map(int,input().split()))\nc=list(map(int,input().split()))\na.sort()\nb.sort()\nc.sort()\ni,j=0,0\nm1=[]\nfor k in a:\n if b[i]>k:\n j+=1\n else:\n m1.append(j)\nfor t in range(len(m1),len(b)):\n m1.append(j)\ni,j=0,0\nm2=[]\nfor k in range(n):\n if ...
['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted']
['s131652077', 's165474322', 's360605438', 's424808153', 's666723029', 's751208800', 's938720913', 's301878846']
[24052.0, 35004.0, 35004.0, 34732.0, 35004.0, 30744.0, 37036.0, 23476.0]
[228.0, 179.0, 292.0, 165.0, 309.0, 280.0, 361.0, 369.0]
[410, 378, 415, 325, 405, 450, 460, 463]
p03559
u864453204
2,000
262,144
The season for Snuke Festival has come again this year. First of all, Ringo will perform a ritual to summon Snuke. For the ritual, he needs an altar, which consists of three parts, one in each of the three categories: upper, middle and lower. He has N parts for each of the three categories. The size of the i-th upper ...
['import bisect\nn = int(input())\na = sorted(list(map(int, input().split())))\nb = sorted(list(map(int, input().split())))\nc = sorted(list(map(int, input().split())))\ncnt = 0\nfor bb in b:\n anum = bisect.bisect_left(a, bb)\n cnum = bisect.bisect_right(c, bb)\n cnt += (anum * cnum)\nprint(cnt)', 'import bis...
['Wrong Answer', 'Accepted']
['s251232674', 's170496298']
[23156.0, 23200.0]
[323.0, 326.0]
[294, 298]
p03559
u871352270
2,000
262,144
The season for Snuke Festival has come again this year. First of all, Ringo will perform a ritual to summon Snuke. For the ritual, he needs an altar, which consists of three parts, one in each of the three categories: upper, middle and lower. He has N parts for each of the three categories. The size of the i-th upper ...
['N = int(input())\nA = sorted(list(map(int, input().split())))\nB = sorted(list(map(int, input().split())))\nC = sorted(list(map(int, input().split())))\nad = defaultdict(lambda: -1)\ni, j = 0, 0\nwhile i < N and j < N:\n if A[i] < B[j]:\n ad[i] = j\n i += 1\n else:\n j += 1\nbd = defaultdic...
['Runtime Error', 'Accepted']
['s264979369', 's259982082']
[23156.0, 28636.0]
[201.0, 365.0]
[681, 362]
p03559
u876442898
2,000
262,144
The season for Snuke Festival has come again this year. First of all, Ringo will perform a ritual to summon Snuke. For the ritual, he needs an altar, which consists of three parts, one in each of the three categories: upper, middle and lower. He has N parts for each of the three categories. The size of the i-th upper ...
['import numpy as np\nN = int(input())\na = np.array( list(map(float, input().split(" "))) )\nb = np.array( list(map(float, input().split(" "))) )\nc = np.array( list(map(float, input().split(" "))) )\n\n# sort(a)\n# sort(b)\n# sort(c)\n\nmem_a = np.zeros(10**5) - 1\n\ndict_c = {}\ndef count_c(v):\n key = v\n if ...
['Runtime Error', 'Accepted']
['s796853387', 's668939159']
[24124.0, 21024.0]
[2109.0, 930.0]
[667, 1576]
p03559
u905582793
2,000
262,144
The season for Snuke Festival has come again this year. First of all, Ringo will perform a ritual to summon Snuke. For the ritual, he needs an altar, which consists of three parts, one in each of the three categories: upper, middle and lower. He has N parts for each of the three categories. The size of the i-th upper ...
['import bisect\nn=int(input())\na=list(map(int,input().split()))\nb=list(map(int,input().split()))\nc=list(map(int,input().split()))\na.sort()\nb.sort()\nc.sort()\nans=0\nfor i in range(n):\n x=a[i]\n y=bisect.bisect_right(b,x)\n if y<n:\n z=bisect.bisect_right(c,b[y])\n ans+=n-z\nprint(ans)', 'import bisect\...
['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s383196402', 's805387085', 's939726817', 's994489471', 's934352598']
[22720.0, 23360.0, 3064.0, 23360.0, 22720.0]
[328.0, 192.0, 17.0, 195.0, 327.0]
[285, 281, 273, 267, 271]
p03559
u922487073
2,000
262,144
The season for Snuke Festival has come again this year. First of all, Ringo will perform a ritual to summon Snuke. For the ritual, he needs an altar, which consists of three parts, one in each of the three categories: upper, middle and lower. He has N parts for each of the three categories. The size of the i-th upper ...
['import bisect\n\nN = int(input())\nAs = sorted(list(map(int, input().split())))\nBs = sorted(list(map(int, input().split())))\nCs = sorted(list(map(int, input().split())))\n\n\nB_Cs = [0] * N\nfor i, b in enumerate(Bs):\n index = bisect.bisect_left(Cs, b+1)\n B_Cs[i] = (N - index)\n\ncumsum_BC =[sum(B_Cs[i:]) f...
['Runtime Error', 'Runtime Error', 'Accepted']
['s210732941', 's610798228', 's228205625']
[23092.0, 23156.0, 23244.0]
[2105.0, 421.0, 329.0]
[501, 645, 301]
p03559
u941884460
2,000
262,144
The season for Snuke Festival has come again this year. First of all, Ringo will perform a ritual to summon Snuke. For the ritual, he needs an altar, which consists of three parts, one in each of the three categories: upper, middle and lower. He has N parts for each of the three categories. The size of the i-th upper ...
['N = int(input())\nAs = list(map(int,input().split()))\nBs = list(map(int,input().split()))\nCs = list(map(int,input().split()))\nAs.sort()\nBs.sort()\nCs.sort()\n\ntotal,Aindex,Cindex=0,0,0\nCstart = 0\nfor x in range(N):\n if Bs[0] < Cs[x]:\n Cstart = x\n break\nfor i in range(N):\n if Bs[i] <= A...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s577454816', 's608585920', 's149939418']
[23092.0, 23328.0, 23360.0]
[379.0, 519.0, 328.0]
[673, 698, 276]
p03559
u943057856
2,000
262,144
The season for Snuke Festival has come again this year. First of all, Ringo will perform a ritual to summon Snuke. For the ritual, he needs an altar, which consists of three parts, one in each of the three categories: upper, middle and lower. He has N parts for each of the three categories. The size of the i-th upper ...
['import bisect\nn=int(input())\na=list(map(int,input().split()))\nb=list(map(int,input().split()))\nc=list(map(int,input().split()))\nans=0\nfor i in b:\n x=bisect.bisect_left(a,i)\n y=bisect.bisect_right(c,i)\n ans+=x*(n-y)\n print(x,y)\nprint(ans)', 'import bisect\nn=int(input())\na=sorted(list(map(int,i...
['Wrong Answer', 'Accepted']
['s183025476', 's204733093']
[29380.0, 29264.0]
[233.0, 239.0]
[249, 258]
p03559
u993435350
2,000
262,144
The season for Snuke Festival has come again this year. First of all, Ringo will perform a ritual to summon Snuke. For the ritual, he needs an altar, which consists of three parts, one in each of the three categories: upper, middle and lower. He has N parts for each of the three categories. The size of the i-th upper ...
['#include <bits/stdc++.h>\nusing namespace std;\n\nint main(){\n int N;\n cin >> N;\n int con;\n con = 0;\n vector<vector<int>> parts(3, vector<int>(N));\n\n for(int i = 0;i < 3; i++){\n for(int j = 0;j < N; j++){\n cin >> parts[i][j];\n }\n }\n\n for (int i = 0;i < N; ...
['Runtime Error', 'Accepted']
['s580809869', 's167398115']
[2940.0, 23840.0]
[17.0, 336.0]
[617, 343]
p03560
u102461423
2,000
262,144
Find the smallest possible sum of the digits in the decimal notation of a positive multiple of K.
['from collections import deque\n\n\n\nK = int(input())\nq = deque()\nq.append((1,1)) \nvisited = [False]*K\n\nans = 0\n\nwhile ans == 0:\n s,x = q.popleft()\n visited[x] = True\n if x == 0:\n ans = s\n break\n q.appendleft((s,(10*x)%K))\n q.append((s+1,(x+1)%K))\n\nprint(ans)', 'from collections import dequ...
['Time Limit Exceeded', 'Accepted']
['s186399720', 's764108401']
[323296.0, 14444.0]
[2124.0, 123.0]
[378, 413]
p03560
u187205913
2,000
262,144
Find the smallest possible sum of the digits in the decimal notation of a positive multiple of K.
['k = int(input())\ng = [[] for _ in range(k)]\nfrom collections import deque\ndic = {1:1}\nqueue = deque([[1,1]])\nwhile queue:\n v,cost = queue.popleft()\n if not v+1 in dic.keys() or cost+1<dic[v+1]:\n dic[v+1] = cost+1\n queue.append([v+1,cost+1])\n if not v*10%k in dic.keys() or cost<dic[v*1...
['Time Limit Exceeded', 'Accepted']
['s687380335', 's620516609']
[244464.0, 20736.0]
[2111.0, 1366.0]
[391, 384]
p03603
u104282757
2,000
262,144
We have a tree with N vertices. Vertex 1 is the root of the tree, and the parent of Vertex i (2 \leq i \leq N) is Vertex P_i. To each vertex in the tree, Snuke will allocate a color, either black or white, and a non-negative integer weight. Snuke has a favorite integer sequence, X_1, X_2, ..., X_N, so he wants to all...
['# E\nN = int(input())\nP_list = list(map(int, input().split()))\nX_list = list(map(int, input().split()))\n\n# graph\nchild_list = [[] for _ in range(N+1)]\nfor i in range(2, N+1):\n child_list[P_list[i-2]].append(i)\n\n# from root\n# minimize local total weight\n\ncolor1 = [0]+X_list\ncolor2 = [0]*(N+1)\n\n\ndef ...
['Runtime Error', 'Accepted']
['s015679163', 's437971123']
[3188.0, 3440.0]
[21.0, 38.0]
[1489, 1499]
p03604
u102461423
2,000
262,144
There are 2N balls in the xy-plane. The coordinates of the i-th of them is (x_i, y_i). Here, x_i and y_i are integers between 1 and N (inclusive) for all i, and no two balls occupy the same coordinates. In order to collect these balls, Snuke prepared 2N robots, N of type A and N of type B. Then, he placed the type-A r...
['import sys\ninput = sys.stdin.readline\n\nfrom scipy.sparse import csr_matrix\nfrom scipy.sparse.csgraph import connected_components\n\nMOD = 10**9 + 7\n\nN = int(input())\nball = (tuple(int(x) for x in row.split()) for row in sys.stdin.readlines())\n\n\n\n\ngraph = [set() for _ in range(N+N+1)]\nfor x,y in ball:\n ...
['Wrong Answer', 'Accepted']
['s443299813', 's584606318']
[107224.0, 147992.0]
[1316.0, 1929.0]
[830, 2314]
p03613
u408375121
2,000
262,144
You are given an integer sequence of length N, a_1,a_2,...,a_N. For each 1≤i≤N, you have three choices: add 1 to a_i, subtract 1 from a_i or do nothing. After these operations, you select an integer X and count the number of i such that a_i=X. Maximize this count by making optimal choices.
['n = int(input())\na = list(map(int, input().split()))\nd = [0] * (10**5 + 2)\nneg_count = 0\nfor i in range(len(a)):\n d[a[i] - 1] += 1\n d[a[i]] += 1\n d[a[i] + 1] += 1\nans = max(d)', 'n = int(input())\na = list(map(int, input().split()))\nd = [0] * (10**5 + 2)\nneg_count = 0\nfor i in range(len(a)):\n d[a[i] -...
['Wrong Answer', 'Accepted']
['s174600321', 's870084064']
[20704.0, 20696.0]
[92.0, 86.0]
[178, 189]
p03613
u543954314
2,000
262,144
You are given an integer sequence of length N, a_1,a_2,...,a_N. For each 1≤i≤N, you have three choices: add 1 to a_i, subtract 1 from a_i or do nothing. After these operations, you select an integer X and count the number of i such that a_i=X. Maximize this count by making optimal choices.
['n = int(input())\na = list(map(int, input().split()))\ncnt = 0\nfor i in range(n-1):\n if a[i] == i+1:\n a[i],a[i+1] = a[i+1],a[i]\n cnt += 1\nif a[-1] == n:\n cnt += 1\nprint(cnt)\n', 'from collections import Counter\nn = int(input())\nd = Counter(map(int, input().split()))\ncnt = 0\nfor i in d:\n new = d.g...
['Wrong Answer', 'Accepted']
['s248394262', 's915168741']
[13964.0, 16588.0]
[53.0, 98.0]
[180, 197]
p03613
u667024514
2,000
262,144
You are given an integer sequence of length N, a_1,a_2,...,a_N. For each 1≤i≤N, you have three choices: add 1 to a_i, subtract 1 from a_i or do nothing. After these operations, you select an integer X and count the number of i such that a_i=X. Maximize this count by making optimal choices.
['a = input()\nprint(a[0]+str(len(a)-2)+a[-1])', 'n = int(input())\nlis = [0 for i in range(10 ** 5 + 2)]\nli = list(map(int,input().split()))\nfor i in range(n):\n lis[li[i]-1] += 1\n lis[li[i]] += 1\n lis[li[i]+1] += 1\nprint(max(lis))']
['Wrong Answer', 'Accepted']
['s827695918', 's045218432']
[2940.0, 14792.0]
[19.0, 94.0]
[43, 183]
p03613
u682985065
2,000
262,144
You are given an integer sequence of length N, a_1,a_2,...,a_N. For each 1≤i≤N, you have three choices: add 1 to a_i, subtract 1 from a_i or do nothing. After these operations, you select an integer X and count the number of i such that a_i=X. Maximize this count by making optimal choices.
['n = int(input())\np = list(map(int, input().split()))\ncnt = 0\n\nfor idx, pi in enumerate(p):\n if (idx+1) == pi:\n if idx+1 < n:\n p[idx], p[idx+1] = p[idx+1], p[idx]\n else:\n p[idx], p[idx-1] = p[idx-1], p[idx]\n cnt += 1\n\nprint(cnt)', 'n = int(input())\na = list(ma...
['Wrong Answer', 'Accepted']
['s715802959', 's860352386']
[13964.0, 13964.0]
[52.0, 86.0]
[273, 186]
p03613
u707870100
2,000
262,144
You are given an integer sequence of length N, a_1,a_2,...,a_N. For each 1≤i≤N, you have three choices: add 1 to a_i, subtract 1 from a_i or do nothing. After these operations, you select an integer X and count the number of i such that a_i=X. Maximize this count by making optimal choices.
['# -*- coding: utf-8 -*-\n#ARC082C\nimport copy\nimport sys\nimport math\n\nn = int(input())\ntmp = input().split()\nhoge = list(map(lambda a: int(a), tmp))\n\nhoge.sort()\nhoge.append(-1)\na=0\nb=0\nc=1\nmaxhoge=0\nfor i in range(0,n):\n\tif(hoge[i]!=hoge[i+1]):\n\t\tif(i!=n-1):\n\t\t\tif(hoge[i+1]-hoge[i]==1):\n\t\t...
['Runtime Error', 'Accepted']
['s071269757', 's759835051']
[14604.0, 14476.0]
[137.0, 173.0]
[512, 518]
p03613
u846372029
2,000
262,144
You are given an integer sequence of length N, a_1,a_2,...,a_N. For each 1≤i≤N, you have three choices: add 1 to a_i, subtract 1 from a_i or do nothing. After these operations, you select an integer X and count the number of i such that a_i=X. Maximize this count by making optimal choices.
['#Together\n\nN = int(input())\na = list(map(int, input().split()))\n\nb = []\n\nfor ai in a:\n b.append(ai-1)\n b.append(ai)\n b.append(ai+1)\n#print(b)\n\nimport collections\ncnt = collections.Counter(b)\n#print(cnt)\nmax(cnt.values())', '#Together\n\nN = int(input())\na = list(map(int, input().split()))\n\...
['Wrong Answer', 'Accepted']
['s752503336', 's511438838']
[25848.0, 27232.0]
[126.0, 120.0]
[229, 236]
p03613
u855200003
2,000
262,144
You are given an integer sequence of length N, a_1,a_2,...,a_N. For each 1≤i≤N, you have three choices: add 1 to a_i, subtract 1 from a_i or do nothing. After these operations, you select an integer X and count the number of i such that a_i=X. Maximize this count by making optimal choices.
['rt numpy as np\nN = int(input())\na = [int(i) for i in input().split(" ")]\na = np.array(a,dtype=\'int\')\ndef count(a):\n return [1 if i==1 or i== 0 or i == -1 else 0 for i in a]\nif N == 1:\n print(1)\nelse:\n min_ = min(a)-1\n max_ = max(a)+1\n ans = -1\n for K in range(min_,max_):\n b = a...
['Runtime Error', 'Accepted']
['s050676713', 's515383289']
[2940.0, 19424.0]
[17.0, 131.0]
[394, 293]
p03613
u925364229
2,000
262,144
You are given an integer sequence of length N, a_1,a_2,...,a_N. For each 1≤i≤N, you have three choices: add 1 to a_i, subtract 1 from a_i or do nothing. After these operations, you select an integer X and count the number of i such that a_i=X. Maximize this count by making optimal choices.
['\n\nimport numpy as np\n\nN = int(input())\na = list(map(int,input().split(" ")))\n\na.sort()\na2 = np.array(a)\n\nminval = a[0]\nmaxval = a[-1]\nl = (maxval - minval +1)\n\nnum = [0]*l\nnum_ans = []\n\n\nnum[0] = len(np.where(a2==a[0]))\n\nfor i in a:\n\tif num[i-minval] == 0:\n\t\tnum[i-minval] = len(np.where(a2==i...
['Wrong Answer', 'Accepted']
['s399313979', 's435215526']
[23372.0, 13964.0]
[2109.0, 107.0]
[539, 272]
p03613
u977193988
2,000
262,144
You are given an integer sequence of length N, a_1,a_2,...,a_N. For each 1≤i≤N, you have three choices: add 1 to a_i, subtract 1 from a_i or do nothing. After these operations, you select an integer X and count the number of i such that a_i=X. Maximize this count by making optimal choices.
['n=int(input())\nA=sorted(list(map(int,input().split())))\nL={}\nif n==1:\n print(1)\nelif n==2:\n if abs(A[0]-A[1])==1:\n print(2)\n else:\n print(1)\nelse:\n for i in A:\n if i not in L:\n L[i]=1\n else:\n L[i]+=1\n print(L)\n ans=[]\n for j ...
['Runtime Error', 'Accepted']
['s612343341', 's603099707']
[14092.0, 14164.0]
[173.0, 171.0]
[711, 702]
p03614
u026788530
2,000
262,144
You are given a permutation p_1,p_2,...,p_N consisting of 1,2,..,N. You can perform the following operation any number of times (possibly zero): Operation: Swap two **adjacent** elements in the permutation. You want to have p_i ≠ i for all 1≤i≤N. Find the minimum required number of operations to achieve this.
["N = int(input())\n\np = input().split(' ')\nans = 1\nfor i in range(N):\n if int(p[i])==i):\n ans += 1\n\nprint(ans//2)\n", "N = int(input())\n\np = input().split(' ')\nans = 0\nfor i in range(N):\n if int(p[i]) == i+1:\n if not(i==N-1) and not(p[i+1] ==i+1):\n rrr = p[i]\n p...
['Runtime Error', 'Accepted']
['s450445184', 's980015401']
[2940.0, 10420.0]
[17.0, 87.0]
[122, 360]
p03614
u102126195
2,000
262,144
You are given a permutation p_1,p_2,...,p_N consisting of 1,2,..,N. You can perform the following operation any number of times (possibly zero): Operation: Swap two **adjacent** elements in the permutation. You want to have p_i ≠ i for all 1≤i≤N. Find the minimum required number of operations to achieve this.
['def main():\n\n S = list(input())\n checklist = [0 for i in range(26)]\n for i in S:\n checklist[ord(i) - ord("a")] += 1\n ans = True\n\n for i in checklist:\n if i > 1:\n ans = False\n\n if not ans:\n print(-1)\n return 0\n else:\n ans = False\n ...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s268571702', 's434529769', 's508158836', 's815354222', 's924891798']
[13940.0, 13940.0, 14008.0, 13940.0, 14008.0]
[46.0, 49.0, 46.0, 57.0, 56.0]
[4996, 4995, 4995, 5003, 334]
p03614
u298297089
2,000
262,144
You are given a permutation p_1,p_2,...,p_N consisting of 1,2,..,N. You can perform the following operation any number of times (possibly zero): Operation: Swap two **adjacent** elements in the permutation. You want to have p_i ≠ i for all 1≤i≤N. Find the minimum required number of operations to achieve this.
['n = int(input())\nans = 0\nfor i,p in enumerate(map(int,input().split())):\n if i + 1 == p:\n ans += 1\nprint(max(ans-1, 0))', 'n = int(input())\nans = 0\nfor i,p in enumerate(map(int,input().split())):\n if i + 1 == p:\n ans += 1\nprint(max(ans-1), 0)', 'n = int(input())\nans = 0\nfor i,p in enumerate(map(in...
['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s086300791', 's312818838', 's491650322', 's971088785', 's000058788']
[10612.0, 10420.0, 10420.0, 10420.0, 10420.0]
[60.0, 67.0, 61.0, 63.0, 70.0]
[123, 123, 115, 123, 226]
p03614
u375616706
2,000
262,144
You are given a permutation p_1,p_2,...,p_N consisting of 1,2,..,N. You can perform the following operation any number of times (possibly zero): Operation: Swap two **adjacent** elements in the permutation. You want to have p_i ≠ i for all 1≤i≤N. Find the minimum required number of operations to achieve this.
['# python template for atcoder1\nimport sys\nsys.setrecursionlimit(10**9)\ninput = sys.stdin.readline\n\nN = int(input())\nA = list(map(int, input().split()))\n\nseq = 0\nans = 0\nfor i in range(1, N+1):\n if A[i] == i:\n seq += 1\n else:\n ans += (seq+1)//2\n seq = 0\nans += (seq+1)//2\npri...
['Runtime Error', 'Wrong Answer', 'Accepted']
['s346060603', 's585484184', 's013445093']
[13876.0, 13876.0, 13876.0]
[68.0, 75.0, 67.0]
[309, 318, 311]
p03614
u690536347
2,000
262,144
You are given a permutation p_1,p_2,...,p_N consisting of 1,2,..,N. You can perform the following operation any number of times (possibly zero): Operation: Swap two **adjacent** elements in the permutation. You want to have p_i ≠ i for all 1≤i≤N. Find the minimum required number of operations to achieve this.
['n=int(input())\nv=sum(1 for i,j in enumerate(map(int,input().split())) if i+1==j)\nif v: \n print(v-1)\nelse:\n print(0)', 'n=int(input())\n*l,=map(int,input().split())\nv=0\nfor i in range(n-1):\n if l[i]==i+1:\n l[i],l[i+1]=l[i+1],l[i]\n v+=1\nif l[N-1]==N:\n l[N-2],l[N-1]=l[N-1],l[N-2]\n v+=1\n \npri...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s253224058', 's780932209', 's984677061']
[10420.0, 14008.0, 14008.0]
[52.0, 69.0, 71.0]
[117, 186, 186]
p03614
u785989355
2,000
262,144
You are given a permutation p_1,p_2,...,p_N consisting of 1,2,..,N. You can perform the following operation any number of times (possibly zero): Operation: Swap two **adjacent** elements in the permutation. You want to have p_i ≠ i for all 1≤i≤N. Find the minimum required number of operations to achieve this.
['\nN=int(input())\np = list(map(int,input().split()))\ncount=0\nfor i in range(N):\n if i+1==p[i]:\n count+=1\n \nif count%2==0:\n print(int(count/2))\nelse:\n print(int((count+1)/2))', '\n\nN=int(input())\np = list(map(int,input().split()))\nbuf = 0\ncount = 0\nfor i in range(N):\n if i+1==p...
['Wrong Answer', 'Accepted']
['s083916298', 's545260512']
[14008.0, 14008.0]
[59.0, 78.0]
[194, 213]
p03615
u985443069
2,000
262,144
You are given N points (x_i,y_i) located on a two-dimensional plane. Consider a subset S of the N points that forms a convex polygon. Here, we say a set of points S _forms a convex polygon_ when there exists a convex polygon with a positive area that has the same set of vertices as S. All the interior angles of the pol...
['4\n0 0\n0 1\n1 0\n1 1\n', "import sys\nfrom collections import defaultdict\n\n\n\n\ndef read_int_list():\n return list(map(int, input().split()))\n\n\ndef read_int():\n return int(input())\n\n\ndef read_str_list():\n return input().split()\n\n\ndef read_str():\n return input()\n\n\ndef gcd(a, b):\n if ...
['Runtime Error', 'Accepted']
['s589195155', 's353629901']
[2940.0, 11876.0]
[17.0, 95.0]
[18, 1257]
p03617
u026155812
2,000
262,144
You've come to your favorite store Infinitesco to buy some ice tea. The store sells ice tea in bottles of different volumes at different costs. Specifically, a 0.25-liter bottle costs Q yen, a 0.5-liter bottle costs H yen, a 1-liter bottle costs S yen, and a 2-liter bottle costs D yen. The store has an infinite supply...
['Q, H, S, D = map(int, input().split())\nN = int(input())\nq = 8*Q\nh = 4*H\ns = 2*S\nif N%2 == 0:\n print(min(q,h,s,S)*(N//2))\nelse:\n print(min(q,h,s,S)*(N//2) + min(4*Q,2*H,S,D))', 'Q, H, S, D = map(int, input().split())\nN = int(input())\nq = 8*Q\nh = 4*H\ns = 2*S\nif N%2 == 0:\n print(min(q,h,s,D)*(N//2...
['Wrong Answer', 'Accepted']
['s700724577', 's265436831']
[3060.0, 3064.0]
[17.0, 18.0]
[179, 177]