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 |
|---|---|---|---|---|---|---|---|---|---|---|
p02959 | u672316981 | 2,000 | 1,048,576 | There are N+1 towns. The i-th town is being attacked by A_i monsters. We have N heroes. The i-th hero can defeat monsters attacking the i-th or (i+1)-th town, for a total of at most B_i monsters. What is the maximum total number of monsters the heroes can cooperate to defeat? | ['n = int(input())\na_lst = list(map(int,input().split()))\nb_lst = list(map(int,input().split()))\nmonster = 0\n\nfor i in range(n):\n a1 = a_lst[i]\n a2 = a_lst[i+1]\n b1 = b_lst[i]\n tmp = b1-a1\n\n monster += min(a1,b1)\n if tmp>0:\n if a2-tmp<=0:\n monster += a2\n a_l... | ['Wrong Answer', 'Accepted'] | ['s656280377', 's016709735'] | [18476.0, 19244.0] | [168.0, 163.0] | [414, 401] |
p02959 | u673338219 | 2,000 | 1,048,576 | There are N+1 towns. The i-th town is being attacked by A_i monsters. We have N heroes. The i-th hero can defeat monsters attacking the i-th or (i+1)-th town, for a total of at most B_i monsters. What is the maximum total number of monsters the heroes can cooperate to defeat? | ['n = int(input())\na = list(map(int,input().split()))\nb = list(map(int,input().split()))\nc = 0\nfor i in range(n):\n if b[i] >= a[i]:\n c += a[i]\n elif b[i]+b[i+1] >= a[i]:\n c += a[i]\n b[i+1] -= a[i]-b[i]\n else:\n c += b[i]+b[i+1]\n b[i+1] = 0\nprint(c)\n ', 'n = int(input())\na = list(map(int... | ['Runtime Error', 'Accepted'] | ['s328656614', 's270800301'] | [18476.0, 19156.0] | [132.0, 135.0] | [266, 274] |
p02959 | u683406607 | 2,000 | 1,048,576 | There are N+1 towns. The i-th town is being attacked by A_i monsters. We have N heroes. The i-th hero can defeat monsters attacking the i-th or (i+1)-th town, for a total of at most B_i monsters. What is the maximum total number of monsters the heroes can cooperate to defeat? | ['n = int(input())\na = list(map(int, input().split()))\nb = list(map(int, input().split()))\n\ntaoshita = 0\nfor i in range(n):\n taoshita += min(a[i], b[i])\n yoryoku = max(a[i]-b[i], 0)\n taoshita += min(a[i+1], yoryoku)\n a[i+1] = max(a[i+1]-yoryoku, 0)\n\nprint(taoshita)', 'n = int(input())\na = list(map(int, ... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s051561809', 's839004867', 's144707485'] | [19156.0, 18604.0, 19244.0] | [209.0, 244.0, 220.0] | [267, 267, 267] |
p02959 | u685662874 | 2,000 | 1,048,576 | There are N+1 towns. The i-th town is being attacked by A_i monsters. We have N heroes. The i-th hero can defeat monsters attacking the i-th or (i+1)-th town, for a total of at most B_i monsters. What is the maximum total number of monsters the heroes can cooperate to defeat? | ['n=int(input())\nmonsters=list(map(int, input().split()))\nbattle=list(map(int, input().split()))\nremain=0\nwin=0\nfor i in range(n):\n if remain != 0:\n win += remain\n battle[i] -= remain\n remain = 0\n if monsters[i] < battle[i]:\n win += monsters[i]\n monsters[i+1] -= batt... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s015377430', 's728793329', 's782889173'] | [18624.0, 18476.0, 19156.0] | [131.0, 118.0, 162.0] | [412, 411, 459] |
p02959 | u686230543 | 2,000 | 1,048,576 | There are N+1 towns. The i-th town is being attacked by A_i monsters. We have N heroes. The i-th hero can defeat monsters attacking the i-th or (i+1)-th town, for a total of at most B_i monsters. What is the maximum total number of monsters the heroes can cooperate to defeat? | ['n = int(input())\na = list(map(int, input()))\nb = list(map(int, input()))\nmonster = 0\nfor i in range(n):\n if b[i] <= a[i]:\n monster += b[i]\n elif b[i] <= a[i] + a[i+1]:\n monster += b[i]\n a[i+1] -= b[i] - a[i]\n else:\n monster += a[i] + a[i+1]\n a[i+1] = 0\nprint(monster)', 'n = int(input())... | ['Runtime Error', 'Accepted'] | ['s128058217', 's137310865'] | [6004.0, 18624.0] | [20.0, 134.0] | [285, 301] |
p02959 | u687159441 | 2,000 | 1,048,576 | There are N+1 towns. The i-th town is being attacked by A_i monsters. We have N heroes. The i-th hero can defeat monsters attacking the i-th or (i+1)-th town, for a total of at most B_i monsters. What is the maximum total number of monsters the heroes can cooperate to defeat? | ['\nn = int(input())\na = list(map(int, input().split()))\nb = list(map(int, input().split()))\n\nans = 0\n\nfor i in range(n):\n \n tmp = a[i] - b[i]\n \n \n if tmp < 0 and -tmp <= a[i+1]:\n ans += b[i]\n a[i+1] += tmp\n \n elif tmp < 0 and -tmp > a[i+1]:\n ans += a[i]+a[i+1]\... | ['Wrong Answer', 'Accepted'] | ['s315272287', 's946117163'] | [18624.0, 18624.0] | [129.0, 131.0] | [566, 578] |
p02959 | u692453235 | 2,000 | 1,048,576 | There are N+1 towns. The i-th town is being attacked by A_i monsters. We have N heroes. The i-th hero can defeat monsters attacking the i-th or (i+1)-th town, for a total of at most B_i monsters. What is the maximum total number of monsters the heroes can cooperate to defeat? | ['#C - City Savers\n\nN = int(input())\nA = list(map(int, input().split()))\nB = list(map(int, input().split()))\ncount = 0\nad = 0\n\nfor i in range(N):\n if A[i] <= B[i] + ad:\n count += A[i]\n ad = max(0, B[i] - max(A[i] - ad, 0))\n print(count, ad)\n else:\n count += B[i] + ad\n ad = 0\n print(c... | ['Wrong Answer', 'Accepted'] | ['s024156291', 's889095379'] | [18624.0, 18476.0] | [269.0, 146.0] | [354, 339] |
p02959 | u692746605 | 2,000 | 1,048,576 | There are N+1 towns. The i-th town is being attacked by A_i monsters. We have N heroes. The i-th hero can defeat monsters attacking the i-th or (i+1)-th town, for a total of at most B_i monsters. What is the maximum total number of monsters the heroes can cooperate to defeat? | ['n=int(input())\na=[int(x) for x in input().split()]\nb=[int(x) for x in input().split()]\nt=0\n\nprint(a)\nprint(b)\n\nfor i in range(n):\n if a[i]>b[i]:\n t+=b[i]\n else:\n t+=a[i]\n if a[i+1]<b[i]-a[i]:\n t+=a[i+1]\n a[i+1]=0\n else:\n t+=b[i]-a[i]\n a[i+1]-=b[i]-a[i]\n\nprint(t)\n... | ['Wrong Answer', 'Accepted'] | ['s121950539', 's377270329'] | [18624.0, 19648.0] | [190.0, 165.0] | [297, 278] |
p02959 | u697696097 | 2,000 | 1,048,576 | There are N+1 towns. The i-th town is being attacked by A_i monsters. We have N heroes. The i-th hero can defeat monsters attacking the i-th or (i+1)-th town, for a total of at most B_i monsters. What is the maximum total number of monsters the heroes can cooperate to defeat? | ['n=int(input())\naa=list(map(int,input().split()))\nbb=list(map(int,input().split()))\nbef=sum(aa)\nfor i in range(n):\n aa[i] -= bb[i]\n if aa[i] >= 0:\n bb[i]=0\n else:\n aa[i]=0\n bb[i]=0-bb[i]\n aa[i+1] -= bb[i]\n if aa[i+1] >= 0:\n bb[i]=0\n else:\n aa[i+1]=0\n bb[i]=0-bb[i]\nprint(bef-sum... | ['Wrong Answer', 'Accepted'] | ['s707180191', 's747633752'] | [24032.0, 23972.0] | [114.0, 123.0] | [306, 309] |
p02959 | u703890795 | 2,000 | 1,048,576 | There are N+1 towns. The i-th town is being attacked by A_i monsters. We have N heroes. The i-th hero can defeat monsters attacking the i-th or (i+1)-th town, for a total of at most B_i monsters. What is the maximum total number of monsters the heroes can cooperate to defeat? | ['N = int(input())\nA = list(map(int,input().split()))\nB = list(map(int,input().split()))\n\nkill = 0\n\nif A[0] >= B[0]:\n kill += B[0]\n B[0] = 0\nelse:\n kill += A[0]\n B[0] -= A[0]\n\nfor i in range(N):\n if A[i+1] <= B[i]:\n kill += A[i+1]\n else:\n A[i+1] -= B[i]\n kill += B[i]\n if A[i+1] >= B... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s002065457', 's806121696', 's698544022'] | [19132.0, 18476.0, 18476.0] | [168.0, 165.0, 164.0] | [410, 397, 470] |
p02959 | u706414019 | 2,000 | 1,048,576 | There are N+1 towns. The i-th town is being attacked by A_i monsters. We have N heroes. The i-th hero can defeat monsters attacking the i-th or (i+1)-th town, for a total of at most B_i monsters. What is the maximum total number of monsters the heroes can cooperate to defeat? | ['N = int(input())\nA = list(map(int,input().split()))\nB = list(map(int,input().split()))\ncnt = 0\nfor i in range(N):\n if A[i] > B[i]:\n cnt += B[i]\n A[i] -= B[i]\n B[i] = 0\n \n else:\n cnt += A[i]\n A[i] = 0\n B[i] -= A[i]\n \n \n if A[i+... | ['Wrong Answer', 'Accepted'] | ['s502752256', 's294377301'] | [24196.0, 24152.0] | [137.0, 147.0] | [529, 580] |
p02959 | u726615467 | 2,000 | 1,048,576 | There are N+1 towns. The i-th town is being attacked by A_i monsters. We have N heroes. The i-th hero can defeat monsters attacking the i-th or (i+1)-th town, for a total of at most B_i monsters. What is the maximum total number of monsters the heroes can cooperate to defeat? | ['2\n100 1 1\n1 100', 'N = int(input())\nA = list(map(int, input().split()))\nB = list(map(int, input().split()))\n\nans = 0\nfor i in range(N):\n left = min(A[i], B[i])\n A[i] -= left\n B[i] -= left\n ans += left\n right = min(A[i + 1], B[i])\n A[i + 1] -= right\n B[i] -= right\n ans += right\n... | ['Runtime Error', 'Accepted'] | ['s601086940', 's825839977'] | [2940.0, 19156.0] | [17.0, 201.0] | [15, 294] |
p02959 | u728120584 | 2,000 | 1,048,576 | There are N+1 towns. The i-th town is being attacked by A_i monsters. We have N heroes. The i-th hero can defeat monsters attacking the i-th or (i+1)-th town, for a total of at most B_i monsters. What is the maximum total number of monsters the heroes can cooperate to defeat? | ['#N = int(input())\nA = list(map(int, input().split()))\nB = list(map(int, input().split()))\nfenum = sum(A)\n\nif B[0] >= A[0]:\n B[0] -= A[0]\n A[0] = 0\n if B[0] > A[1]:\n A[1] = 0\n else:\n A[1] -= B[0]\n B[0] = 0\n \nelse:\n A[0] -= B[0] \n B[0] = 0\n \nfor i in range(... | ['Runtime Error', 'Accepted'] | ['s861931797', 's984269162'] | [14400.0, 19004.0] | [42.0, 139.0] | [563, 557] |
p02959 | u747427153 | 2,000 | 1,048,576 | There are N+1 towns. The i-th town is being attacked by A_i monsters. We have N heroes. The i-th hero can defeat monsters attacking the i-th or (i+1)-th town, for a total of at most B_i monsters. What is the maximum total number of monsters the heroes can cooperate to defeat? | ['n = int(input())\na = [int(i) for i in input().split()]\nb = [int(i) for i in input().split()]\nans = 0\nfor i in range(n):\n if a[i] + a[i+1] <= b[i]:\n s += a[i] + a[i+1]\n a[i+1] = 0\n elif a[i] + a[i+1] > b[i] and a[i] <= b[i]:\n s += b[i]\n a[i+1] -= b[i] - a[i]\n elif a[i] > b[i]:\n s += a[i]\... | ['Runtime Error', 'Accepted'] | ['s850080340', 's282636561'] | [18624.0, 19648.0] | [79.0, 170.0] | [324, 322] |
p02959 | u750378652 | 2,000 | 1,048,576 | There are N+1 towns. The i-th town is being attacked by A_i monsters. We have N heroes. The i-th hero can defeat monsters attacking the i-th or (i+1)-th town, for a total of at most B_i monsters. What is the maximum total number of monsters the heroes can cooperate to defeat? | ['n = int(input())\na = list(map(int, input().split()))\nb = list(map(int, input().split()))\nans = 0\nfor i in range(n):\n if b[i]>=a[i]+a[i+1]:\n ans += a[i]+a[i+1]\n else:\n ans += b[i]\n if a[i] < b[i]:\n a[i+1] -= b[i]-a[i]\nif ans >... | ['Wrong Answer', 'Accepted'] | ['s156069704', 's368933731'] | [18476.0, 18476.0] | [140.0, 152.0] | [363, 446] |
p02959 | u756604554 | 2,000 | 1,048,576 | There are N+1 towns. The i-th town is being attacked by A_i monsters. We have N heroes. The i-th hero can defeat monsters attacking the i-th or (i+1)-th town, for a total of at most B_i monsters. What is the maximum total number of monsters the heroes can cooperate to defeat? | ['import sys\ndef input():\n return sys.stdin.readline()[:-1]\n\nN = int(input())\nA = list(map(int, input().split()))\nB = list(map(int, input().split()))\nB.append(0)\n\nmonster_count = 0\nnext_saver = 0\n\nfor i in range(N+1):\n if A[i] > B[i] + next_saver:\n print(i)\n monster_count += B[i] + ne... | ['Wrong Answer', 'Accepted'] | ['s231633170', 's232870781'] | [18624.0, 18624.0] | [133.0, 123.0] | [520, 504] |
p02959 | u758884263 | 2,000 | 1,048,576 | There are N+1 towns. The i-th town is being attacked by A_i monsters. We have N heroes. The i-th hero can defeat monsters attacking the i-th or (i+1)-th town, for a total of at most B_i monsters. What is the maximum total number of monsters the heroes can cooperate to defeat? | ["import sys\ndef main():\n input = sys.stdin.readline\n\n N = int(input())\n A = list(map(int, input().split()))\n B = list(map(int, input().split()))\n print(A)\n\n res = 0\n for i in range(N):\n a = A[i]\n b = B[i]\n\n if a >= b:\n res += b\n A[i] = A[i... | ['Wrong Answer', 'Accepted'] | ['s160058114', 's965808168'] | [19376.0, 19376.0] | [126.0, 117.0] | [666, 653] |
p02959 | u759721333 | 2,000 | 1,048,576 | There are N+1 towns. The i-th town is being attacked by A_i monsters. We have N heroes. The i-th hero can defeat monsters attacking the i-th or (i+1)-th town, for a total of at most B_i monsters. What is the maximum total number of monsters the heroes can cooperate to defeat? | ['n=int(input())\na=list(map(int,input().split()))\nb=list(map(int,input().split()))\ni=0\ncount=0\nwhile True:\n count+=min(a[i],b[i])\n if i==n:\n break\n elif a[i]>b[i]:\n i+=1\n else:\n c=b[i]-a[i]\n count+=min(a[i+1],c)\n if c>a:\n a[i+1]=0\n i+=... | ['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s166781870', 's226578479', 's562135076', 's751082447', 's896982796'] | [18380.0, 18396.0, 18476.0, 18624.0, 18624.0] | [66.0, 65.0, 159.0, 217.0, 151.0] | [370, 370, 342, 423, 332] |
p02959 | u762420987 | 2,000 | 1,048,576 | There are N+1 towns. The i-th town is being attacked by A_i monsters. We have N heroes. The i-th hero can defeat monsters attacking the i-th or (i+1)-th town, for a total of at most B_i monsters. What is the maximum total number of monsters the heroes can cooperate to defeat? | ['N = int(input())\nAlist = list(map(int, input().split()))\nBlist = list(map(int, input().split()))\namari = 0\nans = 0\nfor i in range(N):\n can_kill = amari + Blist[i]\n enemy = Alist[i]\n if can_kill > enemy:\n ans += enemy\n amari = max(Blist[i] - enemy, 0)\n else:\n ans += can_kil... | ['Wrong Answer', 'Accepted'] | ['s007583793', 's196588122'] | [18624.0, 18396.0] | [124.0, 149.0] | [403, 538] |
p02959 | u762469320 | 2,000 | 1,048,576 | There are N+1 towns. The i-th town is being attacked by A_i monsters. We have N heroes. The i-th hero can defeat monsters attacking the i-th or (i+1)-th town, for a total of at most B_i monsters. What is the maximum total number of monsters the heroes can cooperate to defeat? | ["import sys\ndata = sys.stdin.readline().split('\\n')\ntwn = int(data[0]) + 1\nysh = int(data[0])\nyshabl = list(map(int,data[2].split()))\nmnstr = list(map(int,data[1].split()))\n\ncnt = 0\n\nfor i in range(-1,-1*len(yshabl)-1,-1):\n\ty = yshabl[i]\n\tm = mnstr[i]+mnstr[i-1]\n\tif m >= y:\n\t\tcnt += y\n\t\tmnstr[i-1... | ['Runtime Error', 'Accepted'] | ['s615595544', 's914335865'] | [3064.0, 19156.0] | [17.0, 135.0] | [360, 321] |
p02959 | u767664985 | 2,000 | 1,048,576 | There are N+1 towns. The i-th town is being attacked by A_i monsters. We have N heroes. The i-th hero can defeat monsters attacking the i-th or (i+1)-th town, for a total of at most B_i monsters. What is the maximum total number of monsters the heroes can cooperate to defeat? | ['N = int(input())\nA = list(map(int, input().split()))\nB = list(map(int, input().split()))\n\nans, mod = 0, 0\n\nfor i in range(N):\n if mod > A[i]:\n ans += A[i]\n A[i] = 0\n else:\n A[i] -= mod\n mod = 0\n\n if B[i] > A[i]:\n ans += A[i]\n mod = B[i] - A[i]\n el... | ['Wrong Answer', 'Accepted'] | ['s989816833', 's774338704'] | [18624.0, 18624.0] | [128.0, 135.0] | [353, 396] |
p02959 | u769215762 | 2,000 | 1,048,576 | There are N+1 towns. The i-th town is being attacked by A_i monsters. We have N heroes. The i-th hero can defeat monsters attacking the i-th or (i+1)-th town, for a total of at most B_i monsters. What is the maximum total number of monsters the heroes can cooperate to defeat? | ['a=[]\nb=[]\nah=[]\nbh=[]\nc=int(input())\nfor x in input().split(" "):\n a.append(int(x))\nfor x in input().split(" "):\n b.append(int(x))\n\nfor x in a:\n ah.append(x)\nfor x in b:\n bh.append(x)\n\ni=0\nn=0\n\nwhile i<c:\n if ah[i]>bh[i]:\n n+=bh[i]\n ah[i]=ah[i]-bh[i]\n else:\n ... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s201777534', 's304709872', 's120539270'] | [19004.0, 18344.0, 19004.0] | [203.0, 185.0, 188.0] | [495, 512, 421] |
p02959 | u769633956 | 2,000 | 1,048,576 | There are N+1 towns. The i-th town is being attacked by A_i monsters. We have N heroes. The i-th hero can defeat monsters attacking the i-th or (i+1)-th town, for a total of at most B_i monsters. What is the maximum total number of monsters the heroes can cooperate to defeat? | ['C:\\acm\\python\\python.exe C:/acm/py/44.py\n3\n5 6 3 8\n5 100 8\n22\n2\n100 1 1\n1 100\n3\n2\n3 5 2\n4 5\n9\n', 'while True:\n try:\n sum=0\n n=eval(input())\n l1=list(map(int,input().split()))\n l2=list(map(int,input().split()))\n for i in range(n):\n ss=1\n ... | ['Runtime Error', 'Accepted'] | ['s851182869', 's669613127'] | [2940.0, 19004.0] | [18.0, 155.0] | [94, 613] |
p02959 | u771007149 | 2,000 | 1,048,576 | There are N+1 towns. The i-th town is being attacked by A_i monsters. We have N heroes. The i-th hero can defeat monsters attacking the i-th or (i+1)-th town, for a total of at most B_i monsters. What is the maximum total number of monsters the heroes can cooperate to defeat? | ['#C\nn = int(input())\na = list(map(int,input().split()))\nb = list(map(int,input().split()))\nb.append(0)\nm = [0 for _ in range(n+1)]\ntmp = 0\n\nfor i in range(n+1):\n if tmp >= a[i]:\n m[i] += a[i]\n tmp = b[i]\n \n elif tmp < a[i]:\n if a[i] <= b[i]:\n b[i] -= a[i]\n ... | ['Wrong Answer', 'Accepted'] | ['s689092803', 's194157542'] | [18752.0, 19004.0] | [145.0, 154.0] | [468, 532] |
p02959 | u776929617 | 2,000 | 1,048,576 | There are N+1 towns. The i-th town is being attacked by A_i monsters. We have N heroes. The i-th hero can defeat monsters attacking the i-th or (i+1)-th town, for a total of at most B_i monsters. What is the maximum total number of monsters the heroes can cooperate to defeat? | ['# coding: utf-8\n\nN = int(input())\nA = list(map(int, input().split()))\nB = list(map(int, input().split()))\n\nans = 0 \n\nta = A[-1]\n\nfor a, b in list(zip(A[:-1], B))[::-1]:\n print(ans, a,b,ta)\n tb = b\n if ta >= b:\n ans += b\n ta = a\n continue\n else:\n ans += ta\n ... | ['Wrong Answer', 'Accepted'] | ['s627973400', 's599047695'] | [23900.0, 19244.0] | [362.0, 130.0] | [445, 423] |
p02959 | u780962115 | 2,000 | 1,048,576 | There are N+1 towns. The i-th town is being attacked by A_i monsters. We have N heroes. The i-th hero can defeat monsters attacking the i-th or (i+1)-th town, for a total of at most B_i monsters. What is the maximum total number of monsters the heroes can cooperate to defeat? | ['#city savers\nn=int(input())\nans=0\na=list(map(int,input().split()))\nb=list(map(int,input().split()))\nfor i in range(n):\n if a[i]>=b[i]:\n ans+=b[i]\n a[i]-=b[i]\n else:\n \n ans+=a[i]\n a[i]=0\n b[i]-=a[i]\n if a[i+1]>=b[i]:\n ans+=b[i]\n ... | ['Wrong Answer', 'Accepted'] | ['s542370896', 's861794063'] | [19156.0, 18624.0] | [159.0, 162.0] | [434, 447] |
p02959 | u791527495 | 2,000 | 1,048,576 | There are N+1 towns. The i-th town is being attacked by A_i monsters. We have N heroes. The i-th hero can defeat monsters attacking the i-th or (i+1)-th town, for a total of at most B_i monsters. What is the maximum total number of monsters the heroes can cooperate to defeat? | ['N = int(input())\nA = list(map(int,input().split()))\nB = list(map(int,input().split()))\ncount = 0\nfor i in range(N):\n if B[i] >= A[i]:\n s = B[i] - A[i]\n count += A[i]\n A[i] = 0\n if s >= A[i + 1]:\n count += A[i + 1]\n A[i + 1] = 0\n else:\n count += s\n A[i + 1] -= s\n els... | ['Wrong Answer', 'Accepted'] | ['s041015386', 's375217962'] | [18624.0, 18476.0] | [146.0, 146.0] | [340, 353] |
p02959 | u796842765 | 2,000 | 1,048,576 | There are N+1 towns. The i-th town is being attacked by A_i monsters. We have N heroes. The i-th hero can defeat monsters attacking the i-th or (i+1)-th town, for a total of at most B_i monsters. What is the maximum total number of monsters the heroes can cooperate to defeat? | ['N = int(input())\nA = list(map(int, input().split()))\nB = list(map(int, input().split()))\n\ncount = 0\n\nfor i in range(N):\n if B[i] >= A[i] + A[i+1]:\n count += A[i] + A[i+1]\n A[i+1] = 0\n else:\n A[i+1] = A[i+1] - B[i]\n count += B[i]\n\nprint(count)', 'N = int(input())\nA = li... | ['Wrong Answer', 'Accepted'] | ['s634765575', 's404827443'] | [19116.0, 18624.0] | [127.0, 147.0] | [276, 358] |
p02959 | u798818115 | 2,000 | 1,048,576 | There are N+1 towns. The i-th town is being attacked by A_i monsters. We have N heroes. The i-th hero can defeat monsters attacking the i-th or (i+1)-th town, for a total of at most B_i monsters. What is the maximum total number of monsters the heroes can cooperate to defeat? | ['# coding: utf-8\n# Your code here!\nN=int(input())\n\nA=list(map(int,input().split()))\nB=list(map(int,input().split()))\n\ncount=0\nfor i in range(N):\n hiku=min(A[i],B[i])\n count+=hiku\n A[i]-=hiku\n B[i]-=hiku\n hiku=min(A[i+1],B[i])\n count+=hiku\n A[i+1]-=hiku\n B[i]-=hiku\n\nprint(A)\np... | ['Wrong Answer', 'Accepted'] | ['s752025937', 's269194140'] | [18624.0, 18624.0] | [212.0, 400.0] | [321, 303] |
p02959 | u802963389 | 2,000 | 1,048,576 | There are N+1 towns. The i-th town is being attacked by A_i monsters. We have N heroes. The i-th hero can defeat monsters attacking the i-th or (i+1)-th town, for a total of at most B_i monsters. What is the maximum total number of monsters the heroes can cooperate to defeat? | ['N = int(input())\nA = list(map(int, input().split()))\nB = list(map(int, input().split()))\n\ncnt = 0\nfor i in range(N):\n if i != N-1:\n# cnt += min(A[i], B[i])\n if A[i] >= B[i]:\n cnt += B[i]\n else:\n cnt += A[i]\n \n kantuu = B[i] - A[i]\n \n taosu = max(A[i+1], kantuu)\n... | ['Wrong Answer', 'Accepted'] | ['s129108677', 's341290712'] | [18624.0, 19116.0] | [169.0, 245.0] | [443, 252] |
p02959 | u813452457 | 2,000 | 1,048,576 | There are N+1 towns. The i-th town is being attacked by A_i monsters. We have N heroes. The i-th hero can defeat monsters attacking the i-th or (i+1)-th town, for a total of at most B_i monsters. What is the maximum total number of monsters the heroes can cooperate to defeat? | ["n = int(input())\na = [int(i) for i in input().split()]\nb = [int(i) for i in input().split()]\nprint('OK')\nsu = sum(a)\na_len = len(a)\ncount = 0\ni = 0\na_idx = 0\nb_idx = 0\na_num = a[a_idx]\nb_num = b[b_idx]\nwhile(b_idx < n and a_idx <= a_len and count < su):\n \n a_num = a_num - 1\n \n if i == b_nu... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s379170378', 's540435955', 's077853107'] | [18348.0, 19648.0, 18624.0] | [2104.0, 2104.0, 155.0] | [475, 512, 501] |
p02959 | u814475088 | 2,000 | 1,048,576 | There are N+1 towns. The i-th town is being attacked by A_i monsters. We have N heroes. The i-th hero can defeat monsters attacking the i-th or (i+1)-th town, for a total of at most B_i monsters. What is the maximum total number of monsters the heroes can cooperate to defeat? | ['n = int(input())\na = list(map(int, input().split()))\nb = list(map(int, input().split()))\n\nans = 0\nremain = a[0]\n\nfor i in range(n):\n k = b[i] - remain\n if k <= 0:\n ans += b[i]\n remain = a[i+1]\n elif k > 0:\n if k >= a[i+1]:\n ans += remain + a[i+1]\n rem... | ['Wrong Answer', 'Accepted'] | ['s624217117', 's677040910'] | [18624.0, 19116.0] | [204.0, 198.0] | [417, 276] |
p02959 | u821284362 | 2,000 | 1,048,576 | There are N+1 towns. The i-th town is being attacked by A_i monsters. We have N heroes. The i-th hero can defeat monsters attacking the i-th or (i+1)-th town, for a total of at most B_i monsters. What is the maximum total number of monsters the heroes can cooperate to defeat? | ['\nimport numpy as np\nN = int(input())\n\nA_ls = np.array(list(map(int,input().split(" "))))\nB_ls = np.array(list(map(int,input().split(" "))))\n\nS = 0\n\nfor i,b in B_ls:\n if b > A_ls[i]:\n A_ls[i] == 0\n b -= A_ls[i]\n S += A_ls[i]\n if A_ls[i+1] >= b:\n A_ls[i+1] -=b\n ... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s199715085', 's425464937', 's294034147'] | [23976.0, 3064.0, 23968.0] | [212.0, 17.0, 443.0] | [420, 420, 409] |
p02959 | u821712904 | 2,000 | 1,048,576 | There are N+1 towns. The i-th town is being attacked by A_i monsters. We have N heroes. The i-th hero can defeat monsters attacking the i-th or (i+1)-th town, for a total of at most B_i monsters. What is the maximum total number of monsters the heroes can cooperate to defeat? | ['n=int(input())\na=[int(i) for i in input().split()]\nb=[int(i) for i in input().split()]\na1=a\nfor i in range(n):\n if b[i]>=a[i]+a[i+1]:\n a[i],a[i+1]=0,0\n elif b[i]>=a[i]:\n a[i+1]=b[i]-a[i]\n a[i]=0\n else:\n a[i]-=b[i]\nprint(sum(a1)-sum(a))\n ', 'n=int(input())\na=[int(i) for i in input().spl... | ['Wrong Answer', 'Accepted'] | ['s816929275', 's383407535'] | [19648.0, 19648.0] | [133.0, 159.0] | [255, 328] |
p02959 | u828261239 | 2,000 | 1,048,576 | There are N+1 towns. The i-th town is being attacked by A_i monsters. We have N heroes. The i-th hero can defeat monsters attacking the i-th or (i+1)-th town, for a total of at most B_i monsters. What is the maximum total number of monsters the heroes can cooperate to defeat? | [' n = int(input())\n a = list(map(int,input().split()))\n b = list(map(int,input().split()))\n\n cnt = 0\n res = 0 \n for i in range(n):\n\n ch = min(a[i],res)\n cnt += ch\n a[i] -= ch\n if b[i] > a[i]:\n cnt += a[i]\n res = b[i] - a[i]\n else:... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s447219977', 's637015275', 's032663258'] | [2940.0, 14400.0, 19116.0] | [17.0, 78.0, 155.0] | [401, 431, 329] |
p02959 | u840958781 | 2,000 | 1,048,576 | There are N+1 towns. The i-th town is being attacked by A_i monsters. We have N heroes. The i-th hero can defeat monsters attacking the i-th or (i+1)-th town, for a total of at most B_i monsters. What is the maximum total number of monsters the heroes can cooperate to defeat? | ['n=int(input())\na=list(map(int,input().split()))\nb=list(map(int,input().split()))\np=sum(a)\nb.append(0)\nfor i in range(len(a)):\n if a[i]-b[i]<0:\n if a[i]-b[i]<0:\n a[i+1]=0\n else:\n a[i+1]-=b[i]-a[i]\n a[i]=0\n else:\n a[i]-=b[i]\nprint(p-sum(a))', 'n=int(... | ['Wrong Answer', 'Accepted'] | ['s499679376', 's338318240'] | [18476.0, 18624.0] | [114.0, 139.0] | [294, 301] |
p02959 | u849829379 | 2,000 | 1,048,576 | There are N+1 towns. The i-th town is being attacked by A_i monsters. We have N heroes. The i-th hero can defeat monsters attacking the i-th or (i+1)-th town, for a total of at most B_i monsters. What is the maximum total number of monsters the heroes can cooperate to defeat? | ['2\n100 1 1\n1 100', 'N = int(input())\nA = [int(i) for i in input().split()]\nB = [int(i) for i in input().split()]\ncnt = 0\nfor i in range(N):\n cnt += min(A[i]+A[i+1], B[i])\n if A[i] < B[i]:\n A[i+1] = max(A[i+1]+A[i]-B[i], 0)\nprint(cnt)'] | ['Runtime Error', 'Accepted'] | ['s315411775', 's750225281'] | [2940.0, 19156.0] | [17.0, 186.0] | [15, 218] |
p02959 | u856169020 | 2,000 | 1,048,576 | There are N+1 towns. The i-th town is being attacked by A_i monsters. We have N heroes. The i-th hero can defeat monsters attacking the i-th or (i+1)-th town, for a total of at most B_i monsters. What is the maximum total number of monsters the heroes can cooperate to defeat? | ['N = int(input())\nA = list(map(int, input().split()))\nB = list(map(int, input().split()))\n\nans = 0\nL = 0\nfor i in range(N):\n ans += min(B[i] + L, A[i])\n L = max(B[i] - A[i], 0)\nif L > 0:\n ans += min(L, A[N])\nprint(ans)', 'N = int(input())\nA = list(map(int, input().split()))\nB = list(map(int, inpu... | ['Wrong Answer', 'Accepted'] | ['s511522887', 's851759765'] | [18624.0, 18624.0] | [137.0, 164.0] | [226, 238] |
p02959 | u857408368 | 2,000 | 1,048,576 | There are N+1 towns. The i-th town is being attacked by A_i monsters. We have N heroes. The i-th hero can defeat monsters attacking the i-th or (i+1)-th town, for a total of at most B_i monsters. What is the maximum total number of monsters the heroes can cooperate to defeat? | ['N = int(input())\nA = [int(_) for _ in input().split()]\nB = [int(_) for _ in input().split()]\n\nprint(A)\nprint(B)\n# print(P_true)\ndef_Bsum = sum(B)\n\nfor i in range(N+1):\n if(i==0):\n if (A[i] < B[i]):\n B[i] -= A[i]\n A[i] = 0\n else:\n A[i] -= B[i]\n ... | ['Wrong Answer', 'Accepted'] | ['s410018295', 's433811338'] | [18624.0, 18624.0] | [194.0, 180.0] | [855, 859] |
p02959 | u860002137 | 2,000 | 1,048,576 | There are N+1 towns. The i-th town is being attacked by A_i monsters. We have N heroes. The i-th hero can defeat monsters attacking the i-th or (i+1)-th town, for a total of at most B_i monsters. What is the maximum total number of monsters the heroes can cooperate to defeat? | ['N = int(input())\nA = list(map(int, input().split()))\nB = list(map(int, input().split()))\n\nsa = sum(A)\n\nfor i, b in enumerate(B):\n tmp = min(A[i], b) \n A[i] -= tmp\u3000\u3000\n A[i + 1] -= min(A[i + 1], b - tmp)\u3000\u3000\n\nprint(sa - sum(A))\u3000\u3000', 'N = int(input())\nA = list(map(int, inp... | ['Runtime Error', 'Accepted'] | ['s820054660', 's788683721'] | [2940.0, 18624.0] | [17.0, 155.0] | [419, 407] |
p02959 | u872030436 | 2,000 | 1,048,576 | There are N+1 towns. The i-th town is being attacked by A_i monsters. We have N heroes. The i-th hero can defeat monsters attacking the i-th or (i+1)-th town, for a total of at most B_i monsters. What is the maximum total number of monsters the heroes can cooperate to defeat? | ["N = int(input())\nA = list(map(int, input().split()))\nB = list(map(int, input().split()))\n\nmonster = 0\naddPower = 0\n\nfor i in range(N):\n print(A[i],'+', A[i+1], ' vs ', B[i], end = ' => ')\n AA = A[i] + A[i+1]\n BA = B[i] - A[i]\n BAA= B[i] - AA\n if BAA >= 0:\n print(':', end='')\n ... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s213665077', 's559026554', 's200969264'] | [19284.0, 18752.0, 18624.0] | [686.0, 166.0, 177.0] | [535, 538, 535] |
p02959 | u874333466 | 2,000 | 1,048,576 | There are N+1 towns. The i-th town is being attacked by A_i monsters. We have N heroes. The i-th hero can defeat monsters attacking the i-th or (i+1)-th town, for a total of at most B_i monsters. What is the maximum total number of monsters the heroes can cooperate to defeat? | ['N = int(input())\nA = list(map(int,input().split()))\na = A[:]\nB = list(map(int,input().split()))\nb = B[:]\n\nattack = 0\n\nfor i in range(N):\n if i != (N-1):\n if a[i] > b[i]:\n attack += b[i]\n a[i] = a[i]-b[i]\n b[i] = 0\n else:\n attack += a[i]\n a[i] = 0\n b[i] = b[i]-a[i]... | ['Wrong Answer', 'Accepted'] | ['s404797751', 's616348187'] | [19168.0, 18624.0] | [228.0, 247.0] | [730, 239] |
p02959 | u877428733 | 2,000 | 1,048,576 | There are N+1 towns. The i-th town is being attacked by A_i monsters. We have N heroes. The i-th hero can defeat monsters attacking the i-th or (i+1)-th town, for a total of at most B_i monsters. What is the maximum total number of monsters the heroes can cooperate to defeat? | ['N = int(input()) \nA = list(map(int,input().split())) \nB = list(map(int,input().split())) \n\nans = 0 \nfor i in range(N): \n d = min(A[i], B[i]) \n ans += d \n A[i] -= d \n B[i] -= d \n d = min(A[i + 1], B[i]) \n ans += d A[i + 1] -= d \n B[i] -= d print(ans)\nprint(ans)', 'N = int(input()) A =... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s750050602', 's823085563', 's194159359'] | [3060.0, 2940.0, 19116.0] | [17.0, 17.0, 196.0] | [281, 231, 274] |
p02959 | u882370611 | 2,000 | 1,048,576 | There are N+1 towns. The i-th town is being attacked by A_i monsters. We have N heroes. The i-th hero can defeat monsters attacking the i-th or (i+1)-th town, for a total of at most B_i monsters. What is the maximum total number of monsters the heroes can cooperate to defeat? | ['import sys\ninput = sys.stdin.readline\n \nn = int(input())\na = list(map(int, input().split()))\nb = list(map(int, input().split()))\n \nans = 0\nfor i in range(n):\n if a[i] <= b[i]:\n ans += a[i]\n b[i] -= a[i]\n if a[i + 1] <= b[i]:\n ans += a[i + 1]\n a[i + 1] = 0\n else:\n ans += b[i]\n ... | ['Runtime Error', 'Accepted'] | ['s680141278', 's307403899'] | [3064.0, 19228.0] | [17.0, 153.0] | [361, 374] |
p02959 | u886747123 | 2,000 | 1,048,576 | There are N+1 towns. The i-th town is being attacked by A_i monsters. We have N heroes. The i-th hero can defeat monsters attacking the i-th or (i+1)-th town, for a total of at most B_i monsters. What is the maximum total number of monsters the heroes can cooperate to defeat? | ['N = int(input())\nA_l = list(map(int, input().split()))\nB_l = list(map(int, input().split()))\n\n\n\nkilled_monsters = 0\n\nfor idx in range(N-1):\n if B_l[idx] - A_l[idx] > 0:\n A_l[idx+1] -= B_l[idx] - A_l[idx]\n killed_monsters += A_l[idx]\n else:\n killed_monsters += B_l[idx]\n\nkilled... | ['Wrong Answer', 'Accepted'] | ['s537339337', 's273260323'] | [18624.0, 18624.0] | [120.0, 215.0] | [469, 520] |
p02959 | u890461092 | 2,000 | 1,048,576 | There are N+1 towns. The i-th town is being attacked by A_i monsters. We have N heroes. The i-th hero can defeat monsters attacking the i-th or (i+1)-th town, for a total of at most B_i monsters. What is the maximum total number of monsters the heroes can cooperate to defeat? | ['i = int(input())\na = list(map(int, input().split()))\nb = list(map(int, input().split()))\nc = []\nd = 0\ne = 0\nz = 0\ny = 0\n\nfor f in range(i):\n d = b[f] - a[f]\n if d > 0:\n z = z + a[f]\n y = a[f+1]\n a[f+1] = a[f+1] - d\n if a[f+1] <= 0:\n a[f+1] = 0\n ... | ['Wrong Answer', 'Accepted'] | ['s805993977', 's397446277'] | [19004.0, 19004.0] | [148.0, 147.0] | [423, 423] |
p02959 | u892227843 | 2,000 | 1,048,576 | There are N+1 towns. The i-th town is being attacked by A_i monsters. We have N heroes. The i-th hero can defeat monsters attacking the i-th or (i+1)-th town, for a total of at most B_i monsters. What is the maximum total number of monsters the heroes can cooperate to defeat? | ['# -*- coding: utf-8 -*-\n\nN=int(input())\nA=[int(i) for i in input().split()]\nB=[int(i) for i in input().split()]\n\ncount = 0\n\nfor i in range(N+1):\n if i > 0:\n if (A[i] > 0) and (B[i-1] > 0):\n tmp = min(A[i],B[i-1])\n count += tmp\n A[i] -= tmp\n B[i-1] -=... | ['Runtime Error', 'Accepted'] | ['s088767191', 's140283540'] | [19776.0, 19648.0] | [227.0, 242.0] | [460, 570] |
p02959 | u893063840 | 2,000 | 1,048,576 | There are N+1 towns. The i-th town is being attacked by A_i monsters. We have N heroes. The i-th hero can defeat monsters attacking the i-th or (i+1)-th town, for a total of at most B_i monsters. What is the maximum total number of monsters the heroes can cooperate to defeat? | ['# -*- coding: utf-8 -*- \n\nn = int(input())\na = list(map(int, input().split()))\nb = list(map(int, input().split()))\n\nkilled = 0\n\nfor i in range(n):\n if b[i] <= a[i]:\n killed += b[i]\n continue\n else:\n b[... | ['Runtime Error', 'Accepted'] | ['s408181386', 's284297334'] | [3188.0, 18624.0] | [18.0, 188.0] | [404, 411] |
p02959 | u896726004 | 2,000 | 1,048,576 | There are N+1 towns. The i-th town is being attacked by A_i monsters. We have N heroes. The i-th hero can defeat monsters attacking the i-th or (i+1)-th town, for a total of at most B_i monsters. What is the maximum total number of monsters the heroes can cooperate to defeat? | ['n = int(input())\na = list(map(int, input().split()))\nb = list(map(int, input().split()))\n\nans, kurikosi = 0, 0\nfor i in range(n+1):\n if a[i]<=kurikosi:\n ans += a[i]\n kurikosi = b[i]\n elif kurikosi < a[i] <= kurikosi+b[i]:\n ans += a[i]\n kurikosi = kurikosi+b[i] - a[i]\n ... | ['Runtime Error', 'Accepted'] | ['s008108101', 's909416511'] | [19116.0, 19156.0] | [127.0, 167.0] | [382, 428] |
p02959 | u898080410 | 2,000 | 1,048,576 | There are N+1 towns. The i-th town is being attacked by A_i monsters. We have N heroes. The i-th hero can defeat monsters attacking the i-th or (i+1)-th town, for a total of at most B_i monsters. What is the maximum total number of monsters the heroes can cooperate to defeat? | ['n = int(input())\na = list(map(int, input().split()))\nb = list(map(int, input().split()))\n\nb_rest = [max(b[0]-a[0],0)]\na_rest = [max(a[0]-b[0],0)]\n\nfor i in range(1, n-1):\n b_rest.append( min(b[i], max( ((b[i]+b_rest[i-1])-a[i]), 0 ) ) )\n a_rest.append( max( a[i]-(b[i]+b_rest[i-1]), 0 ) ) \n\na_rest.append(... | ['Wrong Answer', 'Accepted'] | ['s626277060', 's493418171'] | [18396.0, 18476.0] | [205.0, 195.0] | [408, 492] |
p02959 | u903005414 | 2,000 | 1,048,576 | There are N+1 towns. The i-th town is being attacked by A_i monsters. We have N heroes. The i-th hero can defeat monsters attacking the i-th or (i+1)-th town, for a total of at most B_i monsters. What is the maximum total number of monsters the heroes can cooperate to defeat? | ['n = int(input())\nmonsters = list(map(int, input().split()))\nheros = list(map(int, input().split()))\n\ndef f(i, j):\n if i == j == 1:\n return min(monsters[i], heros[i])\n if i == j - 1:\n return min(monsters[i+1], heros[i] - f(i, i)\n if i == j:\n\treturn min(monsters[i] - f(i-1, i), heros[i])\n\ns = 0\nf... | ['Runtime Error', 'Accepted'] | ['s011330183', 's674834900'] | [2940.0, 18476.0] | [17.0, 151.0] | [353, 304] |
p02959 | u905582793 | 2,000 | 1,048,576 | There are N+1 towns. The i-th town is being attacked by A_i monsters. We have N heroes. The i-th hero can defeat monsters attacking the i-th or (i+1)-th town, for a total of at most B_i monsters. What is the maximum total number of monsters the heroes can cooperate to defeat? | ['N = int(input())\nA = list(map(int,input().split()))\nB = list(map(int,input().split()))\nans = 0\nfor i in range(N):\n ans += min(A[i], B[i])\n A[i+1] -= max(0, B[i]-A[i])\n if A[i] < B[i]:\n ans += B[i]-A[i]\n\nif A[-1] > 0:\n ans += max(0,B[-1]-A[-2])\nprint(ans)', 'N = int(input())\nA = list(map(int,input(... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s114517698', 's886777837', 's987825323', 's045256852'] | [18476.0, 19116.0, 19116.0, 18476.0] | [187.0, 161.0, 151.0, 142.0] | [261, 220, 222, 306] |
p02959 | u912652535 | 2,000 | 1,048,576 | There are N+1 towns. The i-th town is being attacked by A_i monsters. We have N heroes. The i-th hero can defeat monsters attacking the i-th or (i+1)-th town, for a total of at most B_i monsters. What is the maximum total number of monsters the heroes can cooperate to defeat? | ['n = int(input())\na = list(map(int,input().split()))\nb = list(map(int,input().split()))\n\n\nc = []\ncount = 0\n\nfor i in range(n):\n\n if a[i] - b[i] >= 0:\n count += b[i]\n elif a[i] - b[i] < 0:\n count += a[i]\n if a[i+1] + (a[i] - b[i]) >0:\n a[i+1] = a[i+1] + (a[i] - b[i])... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s447349072', 's585191710', 's219973354'] | [19004.0, 19004.0, 18752.0] | [191.0, 186.0, 183.0] | [452, 459, 452] |
p02959 | u917874190 | 2,000 | 1,048,576 | There are N+1 towns. The i-th town is being attacked by A_i monsters. We have N heroes. The i-th hero can defeat monsters attacking the i-th or (i+1)-th town, for a total of at most B_i monsters. What is the maximum total number of monsters the heroes can cooperate to defeat? | ['#! /usr/bin/env python3\n# -*- coding:utf-8 -*-\n\ndef city_saver(a, b):\n monster = 0\n for i in range(len(b)):\n monster += min(a[i], b[i])\n if(a[i]<b[i]):\n monster += min(b[i]-a[i], a[i+1])\n a[i+1] -= min(b[i]-a[i], a[i+1])\n return monster\n\ndef main():\n n = in... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s245644074', 's624806090', 's788357020', 's268976046'] | [3064.0, 3064.0, 3060.0, 18476.0] | [17.0, 18.0, 17.0, 192.0] | [472, 465, 432, 463] |
p02959 | u927534107 | 2,000 | 1,048,576 | There are N+1 towns. The i-th town is being attacked by A_i monsters. We have N heroes. The i-th hero can defeat monsters attacking the i-th or (i+1)-th town, for a total of at most B_i monsters. What is the maximum total number of monsters the heroes can cooperate to defeat? | ['n=int(input())\nl=list(map(int,input().split()))\nla=list(map(int,input().split()))\n\nflag=0\nfor m,i in enumerate(la):\n ans+=min(i,l[m])+l[m+1]-max(0,l[m+1]-i+min(i,l[m]))\n l[m+1]=max(0,l[m+1]-i+min(i,l[m]))\nprint(ans)\n', 'n=int(input())\nl=list(map(int,input().split()))\nla=list(map(int,input().split()))\n\n... | ['Runtime Error', 'Accepted'] | ['s089806665', 's465347439'] | [18624.0, 19244.0] | [65.0, 243.0] | [218, 217] |
p02959 | u931834240 | 2,000 | 1,048,576 | There are N+1 towns. The i-th town is being attacked by A_i monsters. We have N heroes. The i-th hero can defeat monsters attacking the i-th or (i+1)-th town, for a total of at most B_i monsters. What is the maximum total number of monsters the heroes can cooperate to defeat? | ['N = int(input())\nA = list(map(int, input().split()))\nB = list(map(int, input().split()))\n\ncount = 0\n\nfor num in range(N):\n if A[num] >= B[num]:\n num_dead_monster = B[num]\n else:\n num_dead_monster = A[num]\n #print("now index", num_dead_monster)\n count += num_dead_monster\n A[nu... | ['Wrong Answer', 'Accepted'] | ['s327416661', 's383221008'] | [18476.0, 19156.0] | [169.0, 168.0] | [693, 684] |
p02959 | u932868243 | 2,000 | 1,048,576 | There are N+1 towns. The i-th town is being attacked by A_i monsters. We have N heroes. The i-th hero can defeat monsters attacking the i-th or (i+1)-th town, for a total of at most B_i monsters. What is the maximum total number of monsters the heroes can cooperate to defeat? | ['n=int(input())\na=list(map(int,input().split()))\nb=list(map(int,input().split()))\nfor i in range(n):\n a[i]=max(a[i]-b[i],0)\n b[i]=max(b[i]-a[i],0)\nfor i in range(n):\n a[i+1]=max(b[i]-a[i+1],0)\nprint(sum(a))', 'n=int(input())\na=list(map(int,input().split()))\ns=sum(a)\nb=list(map(int,input().split()))\nfor ... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s013735004', 's579677013', 's630926894', 's368036707'] | [18624.0, 18476.0, 18624.0, 19156.0] | [182.0, 186.0, 194.0, 192.0] | [208, 225, 214, 206] |
p02959 | u941438707 | 2,000 | 1,048,576 | There are N+1 towns. The i-th town is being attacked by A_i monsters. We have N heroes. The i-th hero can defeat monsters attacking the i-th or (i+1)-th town, for a total of at most B_i monsters. What is the maximum total number of monsters the heroes can cooperate to defeat? | ['n=int(input())\na=[int(i) for i in input().split()]\nb=[int(i) for i in input().split()]\nd=[0]*(n+2)\nfor i in range(n):\n d[i+1]=min(a[i]+a[i+1],b[i]+d[i])\nprint(sum(d)) ', 'n=int(input())\na=[int(i) for i in input().split()]\nb=[int(i) for i in input().split()]\nb.append(0)\nd=[0]*(n+2)\nfor i in range(n):\n ... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s429010257', 's777794443', 's141759661'] | [19648.0, 18732.0, 18624.0] | [131.0, 143.0, 188.0] | [170, 180, 276] |
p02959 | u944325914 | 2,000 | 1,048,576 | There are N+1 towns. The i-th town is being attacked by A_i monsters. We have N heroes. The i-th hero can defeat monsters attacking the i-th or (i+1)-th town, for a total of at most B_i monsters. What is the maximum total number of monsters the heroes can cooperate to defeat? | ['N=int(input())\na=list(map(int,input().split()))\nB=list(map(int,input().split()))\nA=a.copy()\nfor i in range(N-1,-1,-1):\n if A[i+1]-B[i]<=0:\n A[i+1]=0\n if A[i]-A[i+1]+B[i]>=0:\n A[i]=A[i]+A[i+1]-B[i]\n else:\n A[i]=0\n else:\n A[i+1]=A[i+1]-B[i]\nprint(sum(a)-sum(A))', 'n=int(input())\na=... | ['Wrong Answer', 'Accepted'] | ['s310778690', 's466941432'] | [18752.0, 24228.0] | [151.0, 128.0] | [283, 342] |
p02959 | u945641805 | 2,000 | 1,048,576 | There are N+1 towns. The i-th town is being attacked by A_i monsters. We have N heroes. The i-th hero can defeat monsters attacking the i-th or (i+1)-th town, for a total of at most B_i monsters. What is the maximum total number of monsters the heroes can cooperate to defeat? | ["S = str(input())\nans = [0] * 13\nans[0] = 1\nMOD = 10**9 + 7\nfor i in S:\n dp = [0] * 13\n for j in range(13):\n dp[(j * 10) % 13] = ans[j] % MOD\n dp += dp\n if i == '?':\n for j in range(13):\n ans[j] = sum(dp[j+4:j+14])\n else:\n for j in range(13):\n ans... | ['Wrong Answer', 'Accepted'] | ['s911604654', 's107770937'] | [3064.0, 18476.0] | [17.0, 156.0] | [349, 451] |
p02959 | u947327691 | 2,000 | 1,048,576 | There are N+1 towns. The i-th town is being attacked by A_i monsters. We have N heroes. The i-th hero can defeat monsters attacking the i-th or (i+1)-th town, for a total of at most B_i monsters. What is the maximum total number of monsters the heroes can cooperate to defeat? | ['N = int(input())\nA = list(map(int, input().split()))\nB = list(map(int, input().split()))\n \nans = 0\nfor i in range(N):\n left = min(A[i], B[i])\n B[i] -= left\n ans += left\n right = min(A[i + 1], B[i])\n A[i + 1] -= right\n B[i] -= right\n ans += right\n ', 'n = int(input())\nA = list(map(in... | ['Wrong Answer', 'Accepted'] | ['s078077977', 's222432462'] | [18476.0, 19116.0] | [217.0, 182.0] | [268, 261] |
p02959 | u962479059 | 2,000 | 1,048,576 | There are N+1 towns. The i-th town is being attacked by A_i monsters. We have N heroes. The i-th hero can defeat monsters attacking the i-th or (i+1)-th town, for a total of at most B_i monsters. What is the maximum total number of monsters the heroes can cooperate to defeat? | ['N=int(input())\na=list(map(int,input().split()))\nb=list(map(int,input().split()))\nb.append(0)\nsum1=0\nrest=0\nfor i in range(N+1):\n sum1+=min(a[i],b[i]+rest)\n a[i]-=min(a[i],b[i]+rest)\n b[i]=min(b[i],b[i]+rest-min(a[i],b[i]+rest))\n if b[i]<a[i]:\n continue\n elif b[i]>a[i]:\n rest=b[i]-a[i]\n\nprint... | ['Wrong Answer', 'Accepted'] | ['s375416583', 's452725837'] | [18624.0, 19156.0] | [255.0, 181.0] | [309, 266] |
p02959 | u964521959 | 2,000 | 1,048,576 | There are N+1 towns. The i-th town is being attacked by A_i monsters. We have N heroes. The i-th hero can defeat monsters attacking the i-th or (i+1)-th town, for a total of at most B_i monsters. What is the maximum total number of monsters the heroes can cooperate to defeat? | ['\nN = int(input())\n\nA_list = list(map(int, input().split()))\n\nB_list = list(map(int, input().split()))\n\ncount = 0\nfor i in range(N):\n if(A_list[i] >= B_list[i]):\n count = count + B_list[i]\n elif(A_list[i] - B_list[i] <= A_list[i+1]):\n count = count + A_list[i] - B_list[i]\n A_list[i+1] = A_list[... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s275462328', 's414822083', 's710757447'] | [19156.0, 18380.0, 18624.0] | [120.0, 163.0, 161.0] | [514, 692, 855] |
p02959 | u969211566 | 2,000 | 1,048,576 | There are N+1 towns. The i-th town is being attacked by A_i monsters. We have N heroes. The i-th hero can defeat monsters attacking the i-th or (i+1)-th town, for a total of at most B_i monsters. What is the maximum total number of monsters the heroes can cooperate to defeat? | ['n = int(input())\na = map(int,input().split())\nb = map(int,input().split())\n\n\n\nc = [0]*n\nfor i in range(n):\n if i > 0 and b[i - 1] > a[i] + a[i - 1]:\n c[i] = min(a[i] + a[i + 1] + a[i - 1] - c[i - 1], b[i])\n else:\n c[i] = min(a[i] + a[i + 1], b[i])\n\nprint(sum(c))', 'n = int(input())\n... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s103760264', 's176980168', 's651890244', 's998679152', 's382104323'] | [19372.0, 19412.0, 19412.0, 18624.0, 18476.0] | [36.0, 37.0, 37.0, 36.0, 155.0] | [283, 285, 257, 236, 220] |
p02959 | u974679980 | 2,000 | 1,048,576 | There are N+1 towns. The i-th town is being attacked by A_i monsters. We have N heroes. The i-th hero can defeat monsters attacking the i-th or (i+1)-th town, for a total of at most B_i monsters. What is the maximum total number of monsters the heroes can cooperate to defeat? | ['N = int(input())\nA = list(map(int, input().split()))\nB = list(map(int, input().split()))\n\nsum = 0\nfor i in range(0,N):#0,1,,,,N-1\n print(i)\n if A[i] >= B[i]:\n sum += B[i]\n else:\n sum +=A[i]\n if A[i+1] >= B[i] -A[i]:\n A[i+1] -= B[i]-A[i]\n sum += B[i]-A[i... | ['Wrong Answer', 'Accepted'] | ['s886206101', 's000989474'] | [18752.0, 18476.0] | [239.0, 158.0] | [380, 367] |
p02959 | u982808037 | 2,000 | 1,048,576 | There are N+1 towns. The i-th town is being attacked by A_i monsters. We have N heroes. The i-th hero can defeat monsters attacking the i-th or (i+1)-th town, for a total of at most B_i monsters. What is the maximum total number of monsters the heroes can cooperate to defeat? | ['n=int(input())\na=list(map(int,input().split()))\nb=list(map(int,input().split()))\ncnt=0\n\n\nfor i in range(n):\n if(b[i]<=a[i]):\n cnt+=b[i]\n a[i]-=b[i]\n elif(b[i]>a[i] and a[i]+a[i+1]>b[i]):\n cnt+=a[i]\n cnt+=b[i]-a[i]\n a[i+1]-=b[i]-a[i]\n a[i]=0\n else:\n cnt+=a[i]+a[i+1]\n a[i]=0\... | ['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s088356930', 's168417342', 's325212810', 's034281229'] | [147396.0, 147392.0, 18752.0, 19004.0] | [1876.0, 1829.0, 168.0, 175.0] | [345, 343, 327, 346] |
p02959 | u987164499 | 2,000 | 1,048,576 | There are N+1 towns. The i-th town is being attacked by A_i monsters. We have N heroes. The i-th hero can defeat monsters attacking the i-th or (i+1)-th town, for a total of at most B_i monsters. What is the maximum total number of monsters the heroes can cooperate to defeat? | ['from sys import stdin\nn = int(stdin.readline().rstrip())\nA = list(map(int,stdin.readline().rstrip().split()))\nB = list(map(int,stdin.readline().rstrip().split()))\npoint = 0\nfa = min(A[0],B[0])\nfb = min(A[1],B[0]-f00)\npoint += fb\npoint += fa\nfor i in range(1,n):\n fc = min(A[i]-fb,B[i])\n point += fc\n ... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s401586938', 's796470120', 's863806664', 's187220317'] | [18624.0, 18624.0, 18476.0, 18476.0] | [66.0, 70.0, 67.0, 156.0] | [362, 371, 371, 361] |
p02959 | u991269553 | 2,000 | 1,048,576 | There are N+1 towns. The i-th town is being attacked by A_i monsters. We have N heroes. The i-th hero can defeat monsters attacking the i-th or (i+1)-th town, for a total of at most B_i monsters. What is the maximum total number of monsters the heroes can cooperate to defeat? | ['N = int(input())\nA = [int(_) for _ in input().split()]\nB = [int(_) for _ in input().split()]\ndef_Bsum = sum(B)\n \nfor i in range(N+1):\n if(i==0):\n if (A[i] < B[i]):\n B[i] -= A[i]\n A[i] = 0\n else:\n A[i] -= B[i]\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s078466876', 's460196376', 's475368599', 's155198496'] | [2940.0, 2940.0, 3064.0, 19648.0] | [17.0, 17.0, 17.0, 167.0] | [880, 880, 881, 871] |
p02959 | u992465933 | 2,000 | 1,048,576 | There are N+1 towns. The i-th town is being attacked by A_i monsters. We have N heroes. The i-th hero can defeat monsters attacking the i-th or (i+1)-th town, for a total of at most B_i monsters. What is the maximum total number of monsters the heroes can cooperate to defeat? | ["def main():\n N = int(input())\n A = list(map(int,input().split()))\n B = list(map(int,input().split()))\n\n ans = 0\n for i in range(N):\n attack = min(A[i],B[i])\n A[i] -= attack\n B[i] -= attack\n ans += attack\n print('i: {}, attack: {}'.format(i,attack))\n ... | ['Wrong Answer', 'Accepted'] | ['s312120011', 's955385861'] | [18752.0, 18476.0] | [419.0, 155.0] | [587, 479] |
p02959 | u993435350 | 2,000 | 1,048,576 | There are N+1 towns. The i-th town is being attacked by A_i monsters. We have N heroes. The i-th hero can defeat monsters attacking the i-th or (i+1)-th town, for a total of at most B_i monsters. What is the maximum total number of monsters the heroes can cooperate to defeat? | ['N = int(input())\nA = list(map(int, input().split()))\nB = list(map(int, input().split()))\n\nE = 0\n\nfor i in range(N-1,-1,-1):\n\tfor j in range(i+1,i-1,-1):\n\t\tif B[i] - A[j] > 0:\n\t\t\tE += A[j]\n\t\t\tB[i] = B[i] - A[j]\n\t\t\tA[j] = 0\n\t\t\tprint(E)\n\t\tif B[i] - A[j] <= 0:\n\t\t\tE += B[i]\n\t\t\tB[i] = ... | ['Wrong Answer', 'Accepted'] | ['s376900886', 's650203726'] | [18476.0, 18476.0] | [293.0, 247.0] | [325, 323] |
p02959 | u993461026 | 2,000 | 1,048,576 | There are N+1 towns. The i-th town is being attacked by A_i monsters. We have N heroes. The i-th hero can defeat monsters attacking the i-th or (i+1)-th town, for a total of at most B_i monsters. What is the maximum total number of monsters the heroes can cooperate to defeat? | ['N = int(input())\nA = list(map(int, input().split()))\nB = list(map(int, input().split()))\n\ndp = [0]*N\n\nfor i in range(N):\n dp[i] = min(A[i], B[i])\n A[i], B[i] -= dp[i]\n if rem==0:\n tmp = min(A[i+1], B[i])\n dp[i] += tmp\n A[i+1] -= tmp\nprint(sum(dp))\n', 'N = int(input())\nA = list(map(int, inpu... | ['Runtime Error', 'Accepted'] | ['s442824933', 's421812511'] | [3064.0, 18624.0] | [17.0, 200.0] | [260, 302] |
p02959 | u994521204 | 2,000 | 1,048,576 | There are N+1 towns. The i-th town is being attacked by A_i monsters. We have N heroes. The i-th hero can defeat monsters attacking the i-th or (i+1)-th town, for a total of at most B_i monsters. What is the maximum total number of monsters the heroes can cooperate to defeat? | ['n=int(input())\nA=list(map(int,input().split()))\nB=list(map(int,input().split()))\nremain=A[0]\nans1=0\nfor i in range(n):\n if B[i]<=remain:\n ans1+=B[i]\n remain=A[i+1]\n if B[i]>remain:\n ans1+=remain\n yoryoku=B[i]-remain\n if yoryoku>A[i+1]:\n ans1+=A[i+1]\n ... | ['Runtime Error', 'Accepted'] | ['s263525803', 's584056975'] | [19156.0, 18476.0] | [143.0, 127.0] | [773, 456] |
p02959 | u998880072 | 2,000 | 1,048,576 | There are N+1 towns. The i-th town is being attacked by A_i monsters. We have N heroes. The i-th hero can defeat monsters attacking the i-th or (i+1)-th town, for a total of at most B_i monsters. What is the maximum total number of monsters the heroes can cooperate to defeat? | ['N = int(input())\nA = list(map(int, input().split()))\nB = list(map(int, input().split()))\n\ntotal = 0\nfor i in reversed(range(len(B))):\n if i == 0:\n break\n if A[i+1] > 0:\n down1 = min(A[i+1], B[i])\n A[i+1] -= down1\n B[i] -= down1\n total += down1\n if B[i] > 0:\n ... | ['Wrong Answer', 'Accepted'] | ['s765291833', 's530996801'] | [18624.0, 18624.0] | [230.0, 190.0] | [456, 627] |
p02960 | u007991836 | 2,000 | 1,048,576 | Given is a string S. Each character in S is either a digit (`0`, ..., `9`) or `?`. Among the integers obtained by replacing each occurrence of `?` with a digit, how many have a remainder of 5 when divided by 13? An integer may begin with 0. Since the answer can be enormous, print the count modulo 10^9+7. | ["s = [int(x) if x!='?' else -1 for x in input()]\n\nmod = 1000000007\nlength = len(s)\nans = list([0]*13 for i in range(length+1))\nans[0][0] = 1\n\nmod_x10 = [0]*13\nfor i in range(13):\n mod_x10[i] = i * 10 % 13 - 14\n\nfor i in range(length):\n if s[i] == -1:\n for j in range(13):\n x = mod_... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s362575917', 's496126134', 's584142956', 's663628087', 's878284050', 's894433789', 's461469626'] | [65388.0, 1334696.0, 65372.0, 62028.0, 2940.0, 65116.0, 4092.0] | [2107.0, 2185.0, 2106.0, 2108.0, 17.0, 2107.0, 1095.0] | [564, 544, 588, 556, 571, 551, 418] |
p02960 | u095021077 | 2,000 | 1,048,576 | Given is a string S. Each character in S is either a digit (`0`, ..., `9`) or `?`. Among the integers obtained by replacing each occurrence of `?` with a digit, how many have a remainder of 5 when divided by 13? An integer may begin with 0. Since the answer can be enormous, print the count modulo 10^9+7. | ["def dot(A, x):\n return [sum([x[t]*A[s][t] for t in range(13)]) for s in range(13)]\n\nS=input()\nN=len(S)\nif N==1:\n if S=='?' or int(S)==5:\n print(1)\n else:\n print(0)\n exit()\n\nMOD=10**9+7\n\nif S[0]=='?':\n x=[1]*10+[0]*3\nelse:\n x=[0]*13\n x[int(S[0])]=1\n \nP=[\n [\n [1, 0, 0, 0, 0, 0, 0... | ['Wrong Answer', 'Accepted'] | ['s748100169', 's202435347'] | [4728.0, 3564.0] | [515.0, 488.0] | [7726, 1700] |
p02960 | u096616343 | 2,000 | 1,048,576 | Given is a string S. Each character in S is either a digit (`0`, ..., `9`) or `?`. Among the integers obtained by replacing each occurrence of `?` with a digit, how many have a remainder of 5 when divided by 13? An integer may begin with 0. Since the answer can be enormous, print the count modulo 10^9+7. | ['S = "?6?42???8??2??06243????9??3???7258??5??7???????774????4?1??17???9?5?70???76???"\nINF = 10 ** 9 + 7\nmod = [1,10,9,12,3,4]\ndp = [[0 for _ in range(13)] for l in range(len(S))]\nS_li = [_ for _ in S]\nS_li = S_li[::-1]\nif S_li[0] == \'?\':\n dp[0][0:10] = [1,1,1,1,1,1,1,1,1,1]\nelse:\n dp[0][int(S_li[0])] ... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s223593419', 's337010839', 's825158530', 's965750680', 's555877161'] | [3064.0, 39752.0, 14500.0, 39756.0, 4092.0] | [21.0, 2113.0, 151.0, 2114.0, 1078.0] | [629, 687, 702, 703, 498] |
p02960 | u102461423 | 2,000 | 1,048,576 | Given is a string S. Each character in S is either a digit (`0`, ..., `9`) or `?`. Among the integers obtained by replacing each occurrence of `?` with a digit, how many have a remainder of 5 when divided by 13? An integer may begin with 0. Since the answer can be enormous, print the count modulo 10^9+7. | ["import numpy as np\nMOD = 10 ** 9 + 7\n\ndp = np.zeros(13, dtype = np.int64)\ndp[0] = 1\n\nmove = np.arange(0,52,4) % 13\nfor s in input():\n prev = dp#[move]\n dp = np.zeros(13, dtype=np.int64)\n if s == '?':\n add = range(10)\n else:\n add = [int(s)]\n for x in add:\n dp[x:13] += prev[:13-x]\n dp[0... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s399266411', 's943888135', 's531542302'] | [14648.0, 12728.0, 12684.0] | [2108.0, 198.0, 205.0] | [351, 881, 1055] |
p02960 | u144913062 | 2,000 | 1,048,576 | Given is a string S. Each character in S is either a digit (`0`, ..., `9`) or `?`. Among the integers obtained by replacing each occurrence of `?` with a digit, how many have a remainder of 5 when divided by 13? An integer may begin with 0. Since the answer can be enormous, print the count modulo 10^9+7. | ["import numpy as np\n\nS = input()\nmod = int(10**9 + 7)\ndp = np.zeros(13)\ndp[0] = 1\n\namari = [[0]*13 for _ in range(13)]\nfor j in range(10):\n for i in range(13):\n amari[i][(i*10+j)%13] += 1\nM = np.array(amari)\n\nfor s in range(len(S)):\n ndp = np.zeros(13)\n if s == '?':\n ndp = np.matmul(dp... | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s020158699', 's173703789', 's285283048', 's555328814', 's928887284'] | [18896.0, 2940.0, 14640.0, 3064.0, 14656.0] | [1892.0, 17.0, 2109.0, 17.0, 1833.0] | [447, 489, 447, 420, 433] |
p02960 | u196697332 | 2,000 | 1,048,576 | Given is a string S. Each character in S is either a digit (`0`, ..., `9`) or `?`. Among the integers obtained by replacing each occurrence of `?` with a digit, how many have a remainder of 5 when divided by 13? An integer may begin with 0. Since the answer can be enormous, print the count modulo 10^9+7. | ["r = [[(j - k) * 9 % 13 for j in range(10)] for k in range(13)]\nd = [1] + [0] * 12\n\nfor c in input():\n if c == '?':\n d = [sum(d[j] for j in k) % M for k in r]\n else:\n d = [d[(int(c) - k) * 9 % 13] for k in range(13)]\n #print(d)\nprint(d[5])", "r = [[(j - k) * 9 % 13 for j in range(10)] f... | ['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s171293871', 's680840207', 's944294204', 's533230262'] | [3316.0, 123764.0, 23628.0, 3188.0] | [554.0, 2104.0, 2108.0, 1412.0] | [261, 256, 506, 276] |
p02960 | u223904637 | 2,000 | 1,048,576 | Given is a string S. Each character in S is either a digit (`0`, ..., `9`) or `?`. Among the integers obtained by replacing each occurrence of `?` with a digit, how many have a remainder of 5 when divided by 13? An integer may begin with 0. Since the answer can be enormous, print the count modulo 10^9+7. | ["mod=10**9+7\nr=[[(j-k)*9%13 for j in range(10)] for k in range(13)]\ndp=[1]+[0]*12\nfor c in input():\n dp = [sum(dp[j] for j in k)%mod for k in r] if c>'9' else [dp[(int(c)-k)*9%13] for k in range(13)]\nprint(d[5])", "s=list(input())\nn=len(s)\nmod=10**9 + 7\ndp=[[0]*(n) for i in range(13)]\n\nif s[n-1]=='?':\n ... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s797693219', 's868577063', 's290974421'] | [3236.0, 979700.0, 3188.0] | [1416.0, 418.0, 1424.0] | [211, 576, 212] |
p02960 | u237513745 | 2,000 | 1,048,576 | Given is a string S. Each character in S is either a digit (`0`, ..., `9`) or `?`. Among the integers obtained by replacing each occurrence of `?` with a digit, how many have a remainder of 5 when divided by 13? An integer may begin with 0. Since the answer can be enormous, print the count modulo 10^9+7. | ["import sys\ninput = sys.stdin.readline\n\nM=10**9+7\nr=tuple(tuple((j-k)*9%13for j in range(10))for k in range(13))\nd=[1]+[0]*12\nfor c in input():\n if c>'9':\n d=[sum(d[j]for j in k)%M for k in r]\n else:\n d=[d[(int(c)-k)*9%13]for k in range(13)]\nprint(d[5])\n", "M=10**9+7\nr=tuple(tuple((j-k)*9%... | ['Runtime Error', 'Accepted'] | ['s609878201', 's275759538'] | [3188.0, 3188.0] | [1452.0, 1433.0] | [269, 233] |
p02960 | u347640436 | 2,000 | 1,048,576 | Given is a string S. Each character in S is either a digit (`0`, ..., `9`) or `?`. Among the integers obtained by replacing each occurrence of `?` with a digit, how many have a remainder of 5 when divided by 13? An integer may begin with 0. Since the answer can be enormous, print the count modulo 10^9+7. | ["def main():\n s = ''.join(reversed(input()))\n multiplier = 1\n divisor = 10 ** 9 + 7\n list10 = list(range(10))\n list13 = list(range(13))\n p = [0 for i in list13]\n np = [0 for i in list13]\n rt = [i % 13 for i in range(100)]\n if s[0] != '?':\n p[int(s[0])] = 1\n else:\n for j in range(10):\n ... | ['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s064887020', 's514541150', 's552541344', 's824243684', 's904714711', 's100531094'] | [4084.0, 4084.0, 21108.0, 4084.0, 121252.0, 62460.0] | [340.0, 1922.0, 89.0, 20.0, 2104.0, 1795.0] | [713, 609, 581, 631, 707, 602] |
p02960 | u396518935 | 2,000 | 1,048,576 | Given is a string S. Each character in S is either a digit (`0`, ..., `9`) or `?`. Among the integers obtained by replacing each occurrence of `?` with a digit, how many have a remainder of 5 when divided by 13? An integer may begin with 0. Since the answer can be enormous, print the count modulo 10^9+7. | ["def main():\n M=10**9+7\n r=tuple(tuple((j-k)*9%13for j in range(10))for k in range(13))\n d=[1]+[0]*12\n for c in input():\n d = if c>'9' [sum(d[j]for j in k)%M for k in r] else [d[(int(c)-k)*9%13]for k in range(13)]\n print(d[5])\nmain()", "M=10**9+7\nr=[[(j-k)*9%13for j in range(10)]for k in range(13)]\nd=... | ['Runtime Error', 'Accepted'] | ['s917300993', 's783976078'] | [2940.0, 3188.0] | [17.0, 1417.0] | [240, 199] |
p02960 | u408620326 | 2,000 | 1,048,576 | Given is a string S. Each character in S is either a digit (`0`, ..., `9`) or `?`. Among the integers obtained by replacing each occurrence of `?` with a digit, how many have a remainder of 5 when divided by 13? An integer may begin with 0. Since the answer can be enormous, print the count modulo 10^9+7. | ["import sys,math,copy\nimport numpy as np\ninput = sys.stdin.readline\nS = [int(x) if x != '?' else -1 for x in input().strip()]\nN = len(S)\n\ndp = np.zeros((13), dtype=int)\ndp_ = np.zeros((13), dtype=int)\ndp_[0] = 1\nmod = 1\nfor i, s in enumerate(S[::-1], start=1):\n if s == -1:\n for d in range(10):\n ... | ['Wrong Answer', 'Accepted'] | ['s328860789', 's784302379'] | [16200.0, 4468.0] | [2112.0, 1994.0] | [659, 1040] |
p02960 | u409773778 | 2,000 | 1,048,576 | Given is a string S. Each character in S is either a digit (`0`, ..., `9`) or `?`. Among the integers obtained by replacing each occurrence of `?` with a digit, how many have a remainder of 5 when divided by 13? An integer may begin with 0. Since the answer can be enormous, print the count modulo 10^9+7. | ['def main():\n n = 13\n mod = 1000000007\n r = 5\n in_str = input()\n\n amari_list = amari(n)\n l = len(amari_list)\n\n ans_list = initial(in_str[-1:], n)\n\n for i, s in enumerate(reversed(in_str)):\n if i == 0:\n continue\n if s == "?":\n shift_list = [shif... | ['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s360392338', 's898990547', 's910093959', 's271097283'] | [3316.0, 3316.0, 3444.0, 16480.0] | [19.0, 19.0, 2104.0, 1795.0] | [1128, 1162, 1097, 1315] |
p02960 | u517516365 | 2,000 | 1,048,576 | Given is a string S. Each character in S is either a digit (`0`, ..., `9`) or `?`. Among the integers obtained by replacing each occurrence of `?` with a digit, how many have a remainder of 5 when divided by 13? An integer may begin with 0. Since the answer can be enormous, print the count modulo 10^9+7. | ['import numpy as np\nimport sys\ndef input():\n return sys.stdin.readline()[:-1]\n\nS = [int(x) if x!="?" else -1 for x in input()]\n\ndiv_num = 1000000007\narr = np.arange(13, dtype = np.uint64)\ndp = np.zeros([2, 13], dtype = np.uint64)\n\ndiv13_list = [1]\nfor ii in range(1, len(S)):\n n = div13_list[-1] * 10... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s283251179', 's367717441', 's796187037', 's646189038'] | [14964.0, 13768.0, 15316.0, 15308.0] | [804.0, 171.0, 2109.0, 1318.0] | [924, 930, 906, 2023] |
p02960 | u591589288 | 2,000 | 1,048,576 | Given is a string S. Each character in S is either a digit (`0`, ..., `9`) or `?`. Among the integers obtained by replacing each occurrence of `?` with a digit, how many have a remainder of 5 when divided by 13? An integer may begin with 0. Since the answer can be enormous, print the count modulo 10^9+7. | ['#!/usr/bin/env python\n\nimport sys\n\ns= sys.stdin.readline()\n#\nm0 = 0\nmmap= []\nfor i in range(6):\n b = 10**i % 13\n mmap.append( [ (b*i)%13 for i in range(10) ] )\n#\ndp= [ 0 for i in range(13) ]\nfor i,c in enumerate(reversed(s)):\n tmp = dp.copy()\n if i==0: tmp[0]= 1\n #\n if c=="?":\n ... | ['Runtime Error', 'Accepted'] | ['s939323777', 's442606369'] | [3188.0, 3316.0] | [18.0, 1981.0] | [633, 663] |
p02960 | u648212584 | 2,000 | 1,048,576 | Given is a string S. Each character in S is either a digit (`0`, ..., `9`) or `?`. Among the integers obtained by replacing each occurrence of `?` with a digit, how many have a remainder of 5 when divided by 13? An integer may begin with 0. Since the answer can be enormous, print the count modulo 10^9+7. | ['import sys\n\n\ndef main():\n s = str(input())\n l = len(s)\n ans = [0 for _ in range(13)]\n MOD = 10**9+7\n ans[0] = 1\n print(len(s))\n \n for st in s:\n dp = [0 for _ in range(13)]\n for i in range(13):\n dp[(10*i)%13] = ans[i]%MOD\n dp += dp\n if st !... | ['Wrong Answer', 'Accepted'] | ['s131233154', 's453278801'] | [3188.0, 3188.0] | [876.0, 893.0] | [597, 579] |
p02960 | u684120680 | 2,000 | 1,048,576 | Given is a string S. Each character in S is either a digit (`0`, ..., `9`) or `?`. Among the integers obtained by replacing each occurrence of `?` with a digit, how many have a remainder of 5 when divided by 13? An integer may begin with 0. Since the answer can be enormous, print the count modulo 10^9+7. | ["MOD = 10**9 + 7\n\ndef main():\n s = [int(in_i) if in_i != '?' else -1 for in_i in list(open(0).read())[:-1]]\n n = len(s)\n\n cnt = [0] * 13\n if s[0] == -1:\n for j in range(10):\n cnt[j] = 1\n else:\n cnt[s[0]] = 1\n\n for cur_s in s[1:]:\n print(cnt)\n dp = ... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s236806429', 's619003962', 's968242836'] | [19856.0, 8456.0, 4784.0] | [1199.0, 2108.0, 829.0] | [667, 801, 663] |
p02960 | u692746605 | 2,000 | 1,048,576 | Given is a string S. Each character in S is either a digit (`0`, ..., `9`) or `?`. Among the integers obtained by replacing each occurrence of `?` with a digit, how many have a remainder of 5 when divided by 13? An integer may begin with 0. Since the answer can be enormous, print the count modulo 10^9+7. | ["s=input()\nl=len(s)\na=10**9+7\nprint(a)\n\nif s[l-1]=='?':\n n=[1,1,1,1,1,1,1,1,1,1,0,0,0]\nelse:\n n=[0,0,0,0,0,0,0,0,0,0,0,0,0]\n n[int(s[l-1])]=1\nd=[0,0,0,0,0,0,0,0,0,0,0,0,0]\n\nm=1\nfor i in range(1,len(s)):\n m=(m*10)%13\n if s[l-1-i] == '?':\n for j in range(13):\n for k in range(10):\n d... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s340278087', 's827964349', 's084011635'] | [3316.0, 3316.0, 3188.0] | [2104.0, 2107.0, 1049.0] | [456, 446, 265] |
p02960 | u716270596 | 2,000 | 1,048,576 | Given is a string S. Each character in S is either a digit (`0`, ..., `9`) or `?`. Among the integers obtained by replacing each occurrence of `?` with a digit, how many have a remainder of 5 when divided by 13? An integer may begin with 0. Since the answer can be enormous, print the count modulo 10^9+7. | ['MOD = 10 ** 9 + 7\n\n\ndef main(s):\n reminder = [[(j - k) * 9 % 13 for j in range(10)] for k in range(13)]\n dp = [1] + [0] * 12\n for char in s:\n if char == "?":\n dp = [sum(dp[j] for j in k) % MOD for k in reminder]\n else:\n dp = [dp[(int(char) - k) * 9 % 13] for k in... | ['Wrong Answer', 'Accepted'] | ['s345144153', 's233391508'] | [17140.0, 3188.0] | [1743.0, 1422.0] | [384, 366] |
p02960 | u896451538 | 2,000 | 1,048,576 | Given is a string S. Each character in S is either a digit (`0`, ..., `9`) or `?`. Among the integers obtained by replacing each occurrence of `?` with a digit, how many have a remainder of 5 when divided by 13? An integer may begin with 0. Since the answer can be enormous, print the count modulo 10^9+7. | ['mod = 10**9+7\ns=list(input())\nl=len(s)\nmod=10**9+7\ndp=[0]*13\ndp[0] = 1\nmul=1\nfor i in s[::-1]:\n nextDp=[0]*13\n if i=="?":\n for k in range(10):\n for j in range(13):\n nextDp[(k*mul+j)%13] += dp[j]\n nextDp[(k*mul+j)%13]%=mod\n else:\n for j in ... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s121112274', 's763561359', 's492655928'] | [15940.0, 89980.0, 3316.0] | [2104.0, 2107.0, 1863.0] | [474, 362, 443] |
p02960 | u948911484 | 2,000 | 1,048,576 | Given is a string S. Each character in S is either a digit (`0`, ..., `9`) or `?`. Among the integers obtained by replacing each occurrence of `?` with a digit, how many have a remainder of 5 when divided by 13? An integer may begin with 0. Since the answer can be enormous, print the count modulo 10^9+7. | ['import numpy as np\na0 = np.array([1,1,1,1,1,1,1,1,1,1,0,0,0])\nprint(a0[10])', 's = str(input())\nmod = 10**9 + 7\nn = len(s)\n\nif s[0] == "?":\n ans = [1,1,1,1,1,1,1,1,1,1,0,0,0]\nelse:\n ans = [0,0,0,0,0,0,0,0,0,0,0,0,0]\n ans[int(s[0])] = 1\n\n\nfor i in s[1:]:\n dp = [0]*13\n for j in range(13):\n dp[j*... | ['Wrong Answer', 'Accepted'] | ['s643514080', 's767829142'] | [12852.0, 3188.0] | [159.0, 1177.0] | [75, 408] |
p02962 | u102461423 | 2,000 | 1,048,576 | Given are two strings s and t consisting of lowercase English letters. Determine if the number of non-negative integers i satisfying the following condition is finite, and find the maximum value of such i if the number is finite. * There exists a non-negative integer j such that the concatenation of i copies of t is... | ['import sys\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\n\nimport numpy as np\n\nS = np.array(list(readline().rstrip()),np.int64)\nT = np.array(list(readline().rstrip()),np.int64)\n\nLS = len(S); LT = len(T)\nLSext = LS + LT\nLSext += (-LSext) % LS\nSext ... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s283712288', 's585033710', 's318302712'] | [88604.0, 139372.0, 142740.0] | [430.0, 539.0, 755.0] | [1101, 1097, 1470] |
p02962 | u340781749 | 2,000 | 1,048,576 | Given are two strings s and t consisting of lowercase English letters. Determine if the number of non-negative integers i satisfying the following condition is finite, and find the maximum value of such i if the number is finite. * There exists a non-negative integer j such that the concatenation of i copies of t is... | ["from fractions import gcd\n\n\ndef larger_divisor(n):\n ret = set()\n for i in range(1, int(n ** 0.5) + 1):\n if n % i == 0:\n ret.add(n // i)\n return sorted(ret)\n\n\ndef solve(s, t):\n ls, lt = len(s), len(t)\n for d in larger_divisor(gcd(ls, lt)):\n unit = s[:d]\n if... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s081695558', 's312349347', 's550920381', 's638024708', 's638538061', 's740824698', 's599647135'] | [14944.0, 106560.0, 148336.0, 15120.0, 180256.0, 150804.0, 535948.0] | [2104.0, 2107.0, 2108.0, 2108.0, 2108.0, 2106.0, 1739.0] | [752, 1295, 1053, 844, 1281, 1267, 1078] |
p02964 | u029452384 | 2,000 | 1,048,576 | We have a sequence of N \times K integers: X=(X_0,X_1,\cdots,X_{N \times K-1}). Its elements are represented by another sequence of N integers: A=(A_0,A_1,\cdots,A_{N-1}). For each pair i, j (0 \leq i \leq K-1,\ 0 \leq j \leq N-1), X_{i \times N + j}=A_j holds. Snuke has an integer sequence s, which is initially empty... | ['import numpy as np\n\nN,K = map(int, input().split())\nA = np.array(input().split(), dtype=np.int64)\ns = np.zeros(0)\n\nfor i in range(N):\n for j in range(N):\n if np.any(s == A[j]) == False:\n s = np.append(s, A[j])\n \n else:\n k = np.where(s == A[j])[0][-1]\n ... | ['Wrong Answer', 'Accepted'] | ['s523988808', 's987524300'] | [33188.0, 43704.0] | [2109.0, 346.0] | [362, 713] |
p02964 | u315485238 | 2,000 | 1,048,576 | We have a sequence of N \times K integers: X=(X_0,X_1,\cdots,X_{N \times K-1}). Its elements are represented by another sequence of N integers: A=(A_0,A_1,\cdots,A_{N-1}). For each pair i, j (0 \leq i \leq K-1,\ 0 \leq j \leq N-1), X_{i \times N + j}=A_j holds. Snuke has an integer sequence s, which is initially empty... | ["N, K = list(map(int, input().split()))\nA = list(map(int, input().split()))\n\n#print(*range(10000))\n\ndef func(L):\n s = []\n for l in L:\n if l in s:\n del s[s.index(l):]\n #s_set.remove(l)\n else:\n s.append(l)\n #s_set.add(l)\n return s\n\nindex_dict={}\n\nfor i,a in enumerate(A):\n ... | ['Wrong Answer', 'Accepted'] | ['s095148987', 's427161271'] | [62516.0, 68816.0] | [2107.0, 799.0] | [743, 1076] |
p02964 | u608088992 | 2,000 | 1,048,576 | We have a sequence of N \times K integers: X=(X_0,X_1,\cdots,X_{N \times K-1}). Its elements are represented by another sequence of N integers: A=(A_0,A_1,\cdots,A_{N-1}). For each pair i, j (0 \leq i \leq K-1,\ 0 \leq j \leq N-1), X_{i \times N + j}=A_j holds. Snuke has an integer sequence s, which is initially empty... | ['import sys\n\ndef solve():\n input = sys.stdin.readline\n N, K = map(int, input().split())\n A = [int(a) for a in input().split()]\n\n numpos = dict()\n wordlist = [-1] * N\n for i in reversed(range(N)):\n if A[i] not in numpos:\n wordlist[i] = A[i]\n \n else:\n ... | ['Wrong Answer', 'Accepted'] | ['s401676325', 's397668073'] | [84148.0, 82928.0] | [319.0, 336.0] | [1839, 1843] |
p02964 | u667469290 | 2,000 | 1,048,576 | We have a sequence of N \times K integers: X=(X_0,X_1,\cdots,X_{N \times K-1}). Its elements are represented by another sequence of N integers: A=(A_0,A_1,\cdots,A_{N-1}). For each pair i, j (0 \leq i \leq K-1,\ 0 \leq j \leq N-1), X_{i \times N + j}=A_j holds. Snuke has an integer sequence s, which is initially empty... | ["# -*- coding: utf-8 -*-\n\ndef solve():\n N, K = map(int, input().split())\n A = list(map(int, input().split()))\n D = {}\n for j,a in enumerate(A):\n D[a] = D.get(a,[])+[j]\n\n t,k = 0,0\n T = [0]\n while True:\n k = (D[A[t]].index(t)+1)%len(D[A[t]])\n if k == 0:\n ... | ['Runtime Error', 'Accepted'] | ['s933560913', 's745807197'] | [66380.0, 66352.0] | [900.0, 637.0] | [679, 817] |
p02964 | u729133443 | 2,000 | 1,048,576 | We have a sequence of N \times K integers: X=(X_0,X_1,\cdots,X_{N \times K-1}). Its elements are represented by another sequence of N integers: A=(A_0,A_1,\cdots,A_{N-1}). For each pair i, j (0 \leq i \leq K-1,\ 0 \leq j \leq N-1), X_{i \times N + j}=A_j holds. Snuke has an integer sequence s, which is initially empty... | ['n,k,*a=map(int,open(0).read().split())\nl,r,*b=[[]for _ in range(10**6)]\nfor i,v in enumerate(a):\n b[v]+=i,\n l+=len(b[v]),\ns=a[0]\ni=c=0\nwhile 1:\n j=l[i]%len(b[s])\n if(c>k-2)>j:\n r+=s,\n i+=1\n else:i=-~b[s][j]%n\n c+=j<1\n if i<1:\n if c>k-2:break\n k%=c+1\n c=0\n s=a[i]\nprint(*r)', '... | ['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s171181201', 's575262202', 's647349208', 's332112387'] | [101240.0, 54420.0, 819076.0, 105764.0] | [973.0, 455.0, 2121.0, 1018.0] | [295, 328, 332, 296] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.