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 |
|---|---|---|---|---|---|---|---|---|---|---|
p02732 | u814271993 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['rom collections import Counter\nN=int(input())\nA=list(map(int, input().split()))\n \ncount = Counter(A)\nvals = count.values()\nsum_ = 0\nfor v in vals:\n if v >= 2: sum_ += v*(v-1)\nsum_ //= 2\n \nfor k in range(N):\n if count[A[k]] < 2: print(sum_)\n else:print(sum_ + 1 - count[A[k]])', 'import numpy as np\nn =... | ['Runtime Error', 'Accepted'] | ['s385071674', 's227520008'] | [8948.0, 51424.0] | [26.0, 459.0] | [278, 196] |
p02732 | u814885356 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['import collections\n\n# input\nN = int(input())\nA = map(int,input().split())\n# calculatioin\ncnt = collections.Counter(A)\nfull_cnt = int(sum(cnt[key]*(cnt[key]-1)/2 for key in cnt))\nfor i in range(N):\n print(full_cnt - cnt[A[i]]+1)', 'import collections\n\n# input\nN = int(input())\nA = input().split()\n# calcu... | ['Runtime Error', 'Accepted'] | ['s165727892', 's152732130'] | [29472.0, 26784.0] | [151.0, 368.0] | [228, 219] |
p02732 | u819593641 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['from math import factorial\n\nN = int(input())\nAn = list(map(int, input().split()))\n\ndef combination(n,r):\n if n < 2:\n return 0\n else:\n print(factorial(n) / factorial(r) / factorial(n-r) )\n return factorial(n) / factorial(r) / factorial(n-r)\n\nlens = []\nans = 0\nfor p in range(N):\n lens.append(... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s648617154', 's705818551', 's048230697'] | [26140.0, 26140.0, 25644.0] | [2108.0, 2105.0, 410.0] | [485, 429, 264] |
p02732 | u830054172 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['from collections import Counter\nimport math\n\ndef combinations_count(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n\nN = int(input())\na = list(map(int, input().split()))\n\na_cnt = Counter(a)\n\na_comb = {}\nfor key, val in a_cnt.items():\n if val >= 2:\n a_comb[key... | ['Wrong Answer', 'Accepted'] | ['s598461316', 's940076066'] | [44140.0, 32276.0] | [2105.0, 1688.0] | [577, 443] |
p02732 | u830588156 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['import collections\nN = int(input())\nA = list(map(int,input().split()))\nCA = collections.Counter(A)\nS = 0\nfor i in CA.values():\n S += i*(i-1)//2\nfor x in range(A):\n print(S - count[x] + 1)', 'import collections\nN = int(input())\nA = list(map(int,input().split()))\nCA = collections.Counter(A)\nS = 0\nfor... | ['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s134453805', 's441374274', 's499721043', 's573004074', 's855881940', 's891593052', 's940331089', 's248145708'] | [26780.0, 26780.0, 26780.0, 26780.0, 26780.0, 26780.0, 26140.0, 26780.0] | [126.0, 120.0, 2104.0, 123.0, 116.0, 102.0, 2104.0, 350.0] | [193, 186, 197, 195, 194, 209, 158, 183] |
p02732 | u830881690 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['N = int(input())\nN = list(range(1,N+1))\nA = list(map(int, input().split())\n\nfor k in range(1, N+1):\n A = A.remove(A[k])\n ans = 0\n for i in range(1,N+1):\n \tn = sum(A[j] == i for j in range(1,N))\n \tnc2 = n * (n-1) / 2\n \tans += nc2\n \n print(a... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s189945206', 's333116553', 's429448655', 's565261591', 's826318579', 's429391340'] | [2940.0, 26268.0, 2940.0, 2940.0, 24748.0, 26140.0] | [17.0, 2104.0, 17.0, 18.0, 2104.0, 278.0] | [306, 214, 268, 280, 238, 196] |
p02732 | u833738197 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['n = int(input())\na_l = list(map(int, input().split()))\n\ncnt = [0 for i in range(n)]\n\nfor i in range(n):\n cnt[a_l[i]]+=1\nans = 0\n\nfor a in cnt:\n ans += a*(a-1)/2\nfor i in range(n):\n print(ans - (cnt[a_l[i]]-1))', 'n = int(input())\nA = list(map(int,input().split()))\n\nfrom collections import Coun... | ['Runtime Error', 'Accepted'] | ['s306092647', 's462468783'] | [26012.0, 32228.0] | [395.0, 265.0] | [218, 259] |
p02732 | u840974625 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['n = int(input())\nl = list(map(int, input().split()))\n\nans = 0\n\nk = [0 for _ in range(n+1)]\n\nfor i in range(n):\n k[l[i]] += 1\n \nll = len(k)\nfor i in range(ll):\n a = k[i]\n if a <= 1:\n pass\n else:\n ans += (a * (a - 1))/2\n \nfor i in range(n):\n a = k[l[i]]\n b =... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s812569246', 's920983162', 's754793767'] | [26140.0, 26140.0, 26140.0] | [486.0, 445.0, 456.0] | [467, 477, 476] |
p02732 | u845536647 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['from collections import Counter\nN = int(input())\nB = [int(x) for x in input().split()]\nA=Counter(B)\nV, C = zip(*A.most_common())\ncount=0\nfor x in C:\n if x==0:\n break\n count+=x*(x-1)/2\nfor x in A:\n ans=count-C[V.index(x)]+1\n print(int(ans))', 'from collections import Counter\nN = int(input())\nB = [... | ['Wrong Answer', 'Accepted'] | ['s042617981', 's077231738'] | [36488.0, 37024.0] | [2105.0, 514.0] | [246, 253] |
p02732 | u851035514 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['from operator import mul\nfrom functools import reduce\nimport numpy as np\n\ndef cmb(n,r):\n r = min(n-r,r)\n if r == 0: return 1\n over = reduce(mul, range(n, n - r, -1))\n under = reduce(mul, range(1,r + 1))\n return over // under\n\nN = int(input())\nA = list(map(int, input().split()))\nB = A[:]\nB... | ['Wrong Answer', 'Accepted'] | ['s507363464', 's781015106'] | [34108.0, 24748.0] | [2109.0, 315.0] | [918, 259] |
p02732 | u851319680 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['import collections\n_=int(input())\nl = list(map(int, input().split()))\nc = collections.Counter(l)\nM={}\n\nfor i,v in c.items():\n if v>1:\n M[i] = v*(v-1)/2\n\nfor k in l:\n M_ = M.copy()\n M_[k] = M_[k]*(c[k]-2)/c[k]\n print(sum(M_.values()))', 'import collections\n_ = int(input())\nl = list(... | ['Runtime Error', 'Accepted'] | ['s624301848', 's900222376'] | [30996.0, 26908.0] | [619.0, 376.0] | [254, 198] |
p02732 | u857547702 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['import copy\n\n# N=In[0][0]\n# A=In[1]\nN=int(input())\nI=list(map(int,input().split()))\nfor j in range(N):\n counter=[0 for i in range(N+1)]\n A=copy.deepcopy(I)\n A.pop(j)\n B=[]\n for i in A:\n counter[i]+=1\n for i in counter:\n if i>1:\n B.append(f(i)/(f(2)*f(i-2)))\n ... | ['Runtime Error', 'Accepted'] | ['s956147833', 's543264396'] | [26908.0, 27036.0] | [248.0, 392.0] | [381, 487] |
p02732 | u859987056 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['def cmb(n):\n if n < 2:\n return 0\n else:\n return (n*(n-1)/2)\n\nN = int(input())\nA = list(map(int,input().split()))\n\nnum_dict = {i:0 for i in range(1,N+1)}\nfor i in range(N):\n num_dict[A[i]] += 1\n\nS = 0\nfor i in range(1,N+1):\n S += cmb(num_dict[i])\n\nfor i in range(N):\n tmp ... | ['Wrong Answer', 'Accepted'] | ['s597450669', 's487271511'] | [40924.0, 40908.0] | [421.0, 414.0] | [394, 399] |
p02732 | u865119809 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['from collections import Counter\ndef cmb(n):\n if n < 2:\n return 0\n else:\n return (n * (n-1)) // 2\n\nn = int(input())\nls = list(map(int,input().split()))\n\ncs = Counter(a)\ns = 0\n\nfor v in cs.values():\n s += cmb(v)\n\nfor a in ls:\n print(s - cmb(c[a]) + cmb(c[a] - 1))', 'from colle... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s317373472', 's434004022', 's812900929', 's618102832'] | [27164.0, 27164.0, 27292.0, 26908.0] | [144.0, 125.0, 118.0, 482.0] | [287, 285, 289, 290] |
p02732 | u865383026 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['N = int(input())\nA = list(map(int,input().split()))\nB = [A.count(i) for i in range (N + 1)]\nprint(B)\nC = 0\nfor i in range(N + 1):\n C += int(B[i] * (B[i] - 1) / 2)\nfor j in A:\n print(0 if B[j] < 2 else C + 1 - B[j])', 'N = int(input())\nA = list(map(int,input().split()))', 'N = int(input())\nA = (input().spl... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s070569766', 's307637025', 's464505942', 's881528935', 's972299505'] | [26012.0, 26268.0, 19040.0, 24996.0, 32028.0] | [2104.0, 69.0, 2105.0, 78.0, 400.0] | [216, 51, 250, 58, 318] |
p02732 | u865413330 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['from math import factorial\n\nN = int(input())\nnums = list(map(int, input().split()))\nd = dict()\n\nfor num in nums:\n if num not in d:\n d[num] = 1\n else:\n d[num] += 1\n\ntotal = 0\nfor i in d:\n n = d[i]\n if n == 2:\n total += 1\n elif n > 2:\n total += factorial(n) /... | ['Runtime Error', 'Accepted'] | ['s027438362', 's997348545'] | [26140.0, 26140.0] | [822.0, 1724.0] | [480, 572] |
p02732 | u867826040 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['import collections\nfrom scipy.misc import comb\nn = int(input())\na = list(map(int,input().split()))\nfor i in range(len(a)):\n o = 0\n b = a[:]\n del b[i]\n c = collections.Counter(b)\n n = len(set(b))\n for i in c.values():\n o += comb(i,2,exact=True)\n print(o)\n ', 'from collections import Counter\nde... | ['Time Limit Exceeded', 'Accepted'] | ['s024989909', 's277943814'] | [46392.0, 25896.0] | [2112.0, 360.0] | [266, 217] |
p02732 | u868628468 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['n = int(input())\na = []\nd = {}\nans = 0\nfor _ in range(n):\n a.append(int(input()))\nfor i in a:\n d[i] = d.get(i,0) + 1\nfor key in d:\n ans += d[key]*(d[key]-1)//2\nfor i in a:\n print(ans + 1 - d[i])', 'n = int(input())\na = list(map(int,input().split()))\nd = {}\nans = 0\nfor i in a:\n d[i] = d.... | ['Runtime Error', 'Accepted'] | ['s209467811', 's823880915'] | [6492.0, 26268.0] | [25.0, 370.0] | [206, 188] |
p02732 | u870575557 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ["def main():\n import math\n import collections\n N = int(input())\n A = list(map(int, input().split()))\n tt = 0\n \n ann = 0\n\n def comb(m, n):\n #return math.factorial(m) // (math.factorial(n) * math.factorial(m - n))\n return ((m - 1 + 1) / 1) * (m - 2 + 1) / 2\n\n \n\n ... | ['Wrong Answer', 'Accepted'] | ['s179694421', 's131016728'] | [26780.0, 26780.0] | [567.0, 536.0] | [869, 874] |
p02732 | u878654696 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['n = int(input())\na = list(map(int, input().split()))\n\nb = set(a)\n\nc = {}\n\nfor i in a:\n c[i] = c.get(i, 0) + 1\n\nd = {}\n\nfor k in a:\n if d.get(k, "hello") == "hello":\n ans = 0\n for i in b:\n if i != k:\n ans += c[i]*(c[i]-1)//2\n else:\n ... | ['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s135387768', 's858325965', 's897534296', 's963501510', 's639583715'] | [29476.0, 26140.0, 26140.0, 35616.0, 35116.0] | [2108.0, 368.0, 2104.0, 221.0, 444.0] | [397, 202, 273, 414, 298] |
p02732 | u880480312 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['import collections\nN=int(input())\nA = list(map(int,input().split()))\ncn = collections.Counter(A)\nprint(cn[A[2]])\nsumC=sum([n * (n-1)//2 for n in cn.values()])\nfor k in range(N):\n print(sumC-cn[A[k]]+1)\n\n\n', 'import collections\nN=int(input())\nA = list(map(int,input().split()))\ncn = collections.Counter(... | ['Wrong Answer', 'Accepted'] | ['s864393780', 's269333140'] | [26780.0, 26780.0] | [326.0, 340.0] | [207, 189] |
p02732 | u886655280 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['\n\nN = int(input())\nA_list = list(map(int, input().split()))\n\nbox = [0] * (N + 1)\nbox_2 = [0] * (N + 1)\nbox_3 = [0] * (N + 1)\n\nfor i in range(N):\n box[A_list[i] + 1] += 1\n\nfor i in range(N):\n if box[i] > 1:\n box_2[i] = (box[i] * (box[i] - 1)) / 2\n box_3[i] = ((box[i] - 1) * (box[i] -... | ['Runtime Error', 'Accepted'] | ['s232132668', 's978530197'] | [26140.0, 26140.0] | [429.0, 420.0] | [565, 565] |
p02732 | u891422384 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['#count\nfor l in lis:\n if l in dic: dic[l] += 1\n else: dic[l] = 1\n\n#dic_sum = dic.copy()\ns = 0\n#calcurate\nfor d in dic:\n s += int(dic[d]*(dic[d]-1)/2)\n \nfor i in range(inp):\n \n t = dic[lis[i]]\n print(s-int(t*(t-1)/2)+int((t-1)*(t-2)/2))\n', 'inp = int(input())\nlis = list(map(int, input().split())... | ['Runtime Error', 'Accepted'] | ['s434296053', 's572559401'] | [3060.0, 26140.0] | [17.0, 487.0] | [270, 340] |
p02732 | u893307213 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['import numpy as np\nimport math\ndef comb(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n\n\nN = int(input())\nA = list(map(int, input().split()))\n\n\n\n\n\n\nnp_A = np.array(A)\n\n\ndic = {}\n\n\n\ntmp_all = np.array(A)\nunique = np.unique(tmp_all)\nprint("unique:", unique)\nan... | ['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s143799896', 's584620370', 's584912018', 's861834874', 's027813756'] | [34176.0, 34180.0, 34156.0, 34176.0, 34164.0] | [2110.0, 2109.0, 267.0, 686.0, 711.0] | [1120, 894, 1693, 666, 564] |
p02732 | u895592784 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ["N = int(input())\nA = list(map(int, input().split(' ')))\nnum_sum = 0\nfor i in range(1, N+1):\n c = A.count(i)\n num_sum += int(c * (c - 1) / 2)\n\nfor j in A:\n if A.count(j) == 1:\n print(sum(num_sum))\n else:\n print(sum(num_sum) - (A.count(j) - 1))", "N = int(input())\nA = list(map(int,... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s212885423', 's597060594', 's760254165'] | [26268.0, 26012.0, 26780.0] | [2104.0, 2104.0, 377.0] | [268, 270, 930] |
p02732 | u898058223 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['n=int(input())\na=list(map(int,input().split()))\nb=[0]*n\ncnt=0\nfor i in a:\n b[i-1]+=1\ncnt=sum(b)\nfor i in a:\n print(cnt+(1-b[i-1]))', 'n=int(input())\na=list(map(int,input().split()))\nb=[0]*n\ncnt=0\nfor i in a:\n b[i-1]+=1\nfor i in b:\n cnt+=i*(i-1)//2\nfor i in a:\n print(cnt+(1-b[i-1]))'] | ['Wrong Answer', 'Accepted'] | ['s441434276', 's705652177'] | [26268.0, 26140.0] | [290.0, 328.0] | [132, 151] |
p02732 | u903699277 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['import copy\ndef combinations_count(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n\ndef D159():\n N = int(input())\n A = input().split()\n \n for i in range(0, N):\n sum = 0\n A_ = copy.deepcopy(A)\n del A_[i]\n num = list(set(A_))\n ... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s079409465', 's545716852', 's811526479'] | [3444.0, 24220.0, 25716.0] | [22.0, 2104.0, 523.0] | [437, 275, 437] |
p02732 | u913662443 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ["stdin =open(0).read().split('\\n')\nN=int(stdin[0])\nA=list(map(int,stdin[1].split()))\nfrom collections import Counter\nC=Counter(A)\nans=0\nfor i in set(A):\n d[i]=A.count(i)\n ans+=d[i]*(d[i]-1)//2\nfor a in A:\n num = C[a]\n print(ans-num*(num-1)//2+(num-1)*(num-2)//2)", "stdin =open(0).read().split('... | ['Runtime Error', 'Accepted'] | ['s800428889', 's907685576'] | [27412.0, 26180.0] | [117.0, 407.0] | [273, 251] |
p02732 | u915879510 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['import numpy as np\n\nn = int(input())\n\na = np.array(list(map(int, input().split())))\nd = [0] * n\ns = {}\n\nfor i in a:\n d[i-1] += 1\n \nsum = 0\nfor k in d:\n if k>1:\n sum += (k*(k-1))//2\n\nfor i in range(n):\n nd = d[a[i]]\n ans = sum-(nd*(nd-1))//2\n nd -= 1\n if nd>1:\n ans += (nd*(nd-1))//2\n... | ['Runtime Error', 'Accepted'] | ['s111800549', 's087804101'] | [34156.0, 36204.0] | [775.0, 663.0] | [309, 311] |
p02732 | u920103253 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ["def n0():return int(input())\ndef n1():return [int(x) for x in input().split()]\ndef n2(n):return [int(input()) for _ in range(n)]\ndef n3(n):return [[int(x) for x in input().split()] for _ in range(n)]\n\ndef main()\n n=n0()\n a=n1()\n\n from math import factorial\n def comb(n):\n if n<=1:\n ... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s160867272', 's329810936', 's507049923', 's711686785', 's885610348'] | [2940.0, 2940.0, 2940.0, 26140.0, 32156.0] | [17.0, 17.0, 17.0, 2109.0, 433.0] | [605, 603, 595, 471, 488] |
p02732 | u922449550 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['N = int(input())\nA = list(map(int, input().split()))\n\nd = {}\nfor a in A:\n if a in d:\n d[a] += 1\n else:\n d[a] = 1\n\nans = 0\nfor a in d:\n n = d[a]\n ans += n * (n-1) // 2\n\nprint(ans)\nfor a in A:\n n = d[a]\n if n >= 2:\n print(ans - n + 1)\n else:\n print(a... | ['Wrong Answer', 'Accepted'] | ['s841274880', 's166413225'] | [26140.0, 24748.0] | [350.0, 362.0] | [300, 290] |
p02732 | u927839462 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['n=int(input())\na=list(map(int, input().split()))\nimport collections\nimport math\ndef combinations_count(n, r):\n if(n<=1):\n answer=0\n else:\n answer=math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n return answer\n\ntable=collections.Counter(a)\nkeytable=collections.Counte... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s635701323', 's896987078', 's530646099'] | [47720.0, 26140.0, 26140.0] | [2108.0, 2105.0, 451.0] | [656, 573, 447] |
p02732 | u928713799 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['import math\nimport collections\nfrom operator import mul\nfrom functools import reduce\n\ndef cmb(n,r):\n r = min(n-r,r)\n if r == 0: return 1\n over = reduce(mul, range(n, n - r, -1))\n under = reduce(mul, range(1,r + 1))\n return over // under\n\n\ndef combinations_count(n, r):\n\tif n < 2:\n\t\tret... | ['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s160972277', 's258439660', 's582627408', 's168790906'] | [26908.0, 26140.0, 26764.0, 25764.0] | [2105.0, 317.0, 2105.0, 308.0] | [661, 175, 496, 166] |
p02732 | u929768294 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['from collections import Counter\nN = int(input())\na = list(map(int, input().split()))\nc = Counter(a)\nprint(c.items())\nall=0\nfor i,j in c.items():\n all += j*(j-1)//2\nfor i in range(N):\n print(all-(a.count(a[i])-1))', 'from collections import Counter\nN = int(input())\na = list(map(int, input().split()))\... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s632130279', 's851869091', 's318059961'] | [30100.0, 30236.0, 26780.0] | [2105.0, 425.0, 353.0] | [218, 212, 213] |
p02732 | u931636178 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['import sys\ndef II(): return int(sys.stdin.readline())\ndef MI(): return map(int, sys.stdin.readline().split())\nN = II()\nA = list(MI())\nans = 0\ncum = {}\ndef couple_combination(n):\n if n >= 2:\n return int(n * (n - 1) / 2)\n else:\n return 0\nfor unique in list(set(A)):\n cum_count = A.cou... | ['Wrong Answer', 'Accepted'] | ['s262226549', 's577891558'] | [24988.0, 25912.0] | [2104.0, 398.0] | [421, 437] |
p02732 | u934868410 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['from collections import defaultdict\nn = int(input())\na = list(map(int,input().split()))\nd = defaultdict(int)\nfor x in a:\n d[x] += 1\nfor x in a:\n c = d[x] - 1\n print(c * (c-1) // 2)', 'from collections import defaultdict\nn = int(input())\na = list(map(int,input().split()))\nd = defaultdict(int)\nfor x in a... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s698867003', 's992494917', 's622438972'] | [25900.0, 2940.0, 26780.0] | [295.0, 17.0, 337.0] | [183, 184, 227] |
p02732 | u940533000 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['N = int(input())\nA = list(map(int, input().split()))\nB = sorted(A)\n\nall_c = 0\t\t\nidx = B[0]\nidx_count = 0\nidx_set = []\nfor i in range(N):\n if idx != B[i]:\n tmp1 = int(idx_count*(idx_count-1)/2)\t\t\n tmp2 = int((idx_count-1)*(idx_count-2)/2)\t\n all_c += tmp1\n idx_set.append([idx, tmp1, tmp2]... | ['Wrong Answer', 'Accepted'] | ['s515102674', 's200744404'] | [42944.0, 34156.0] | [2106.0, 1989.0] | [1254, 324] |
p02732 | u944325914 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['from collections import Counter\nn=int(input())\na=list(map(int,input().split()))\nb0=list(a[1:])\nc0=Counter(b0)\nd0=0\nfor i in c0:\n d0+=(c0[i])*(c0[i]-1)/2\nprint(d0)\nfor j in range(1,n-1):\n b=list(a[0:j])+list(a[j+1:])\n c=Counter(b)\n d=0\n for j in c:\n d+=(c[j])*(c[j]-1)/2\n print(d... | ['Wrong Answer', 'Accepted'] | ['s353785206', 's063070606'] | [46576.0, 34084.0] | [2105.0, 357.0] | [392, 343] |
p02732 | u944643608 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['import numpy as np\nN = int(input())\nA = list(map(int, input().split()))\nA = np.array(A)\nans = np.zeros(N)\ntotal = 0\nfor i in range(N):\n ans[A[i] - 1] += 1\nfor i in range(N):\n total += ans[i] * (ans[i] - 1) // 2\nfor i in range(N):\n print(total - max(ans[A[i]-1]-1,0))\n ', 'import numpy as np\nfrom sys i... | ['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s064277130', 's259174336', 's530836719', 's672938074', 's952906367', 's999391760', 's399349849'] | [34152.0, 43060.0, 2940.0, 36964.0, 2940.0, 37068.0, 35872.0] | [2112.0, 363.0, 17.0, 204.0, 17.0, 212.0, 563.0] | [272, 347, 351, 352, 288, 349, 515] |
p02732 | u947101138 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['import copy\n\nN=int(input())\n\nA=list(map(int,input().split()))\n\n#print(A)\n\nmama=dict()\npapa=dict()\npapa[0]=0\npapa[1]=0\npapa[2]=1\nfor i in range(3,N/2):\n papa[i]=int(i*papa[i-1]/2)\nfor i in range(N):\n\n if(A[i] in mama):\n print(mama[A[i]])\n continue\n \n AA=copy.deepcopy(A)\n... | ['Runtime Error', 'Accepted'] | ['s754488242', 's563341776'] | [26780.0, 28852.0] | [71.0, 526.0] | [614, 419] |
p02732 | u951113446 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['import itertools\n\nif __name__ == "__main__":\n N = int(input())\n A = input().split()\n all = len(tuple(filter(lambda t: t[0] == t[1], itertools.combinations(A, 2))))\n for x in range(N):\n count = A.count(A[x])\n tmp = tuple(["0" for _ in range(count)])\n result = tuple(filter(lamb... | ['Wrong Answer', 'Accepted'] | ['s389785207', 's155276605'] | [456100.0, 26784.0] | [2131.0, 390.0] | [393, 351] |
p02732 | u951480280 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['import math\n\ndef combinations_count(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n\nn = int(input())\na = sorted(map(int,input().split()))\ncnt = []\ncnt1 = 1\nfor i in range(1,n):\n if a[i] == a[i-1]:\n cnt1 += 1\n if i == n-1:\n cnt.append(cnt1)\n... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s752816775', 's882325845', 's978472361'] | [26140.0, 26140.0, 26652.0] | [2104.0, 2104.0, 1858.0] | [1076, 824, 773] |
p02732 | u952669998 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ["def main():\n import sys\n input = sys.stdin.readline\n import numpy as np\n from collections import Counter\n\n N = int(input())\n A = list(map(int,input().split()))\n print(set(A))\n c = Counter(A)\n\n tmp = np.array(list(c.values()))\n l1= tmp*(tmp-1)//2\n l2= (tmp-1)*((tmp-1)-1)//2\n S = np.sum(l1)\n\... | ['Wrong Answer', 'Accepted'] | ['s071813282', 's817564498'] | [35940.0, 26140.0] | [2109.0, 485.0] | [426, 204] |
p02732 | u952968889 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['n=int(input())\na=list(map(int,input().split()))\n\nfrom collections import Counter\nc=Counter(A)\n\nANS=0\t# max combination\nfor i in C.values():\n ANS+=i*(i-1)//2 # 6+1+1 = 8\n \nfor a in A:\n k=C[a] # 4 2 4 2 2 4 2 4\n \n print(ANS-(k*(k-1)//2)+((k-1)*(k-2)//2)) # different from max combination\... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s155973049', 's695884076', 's480344481'] | [26012.0, 25376.0, 26140.0] | [73.0, 136.0, 398.0] | [351, 363, 365] |
p02732 | u953794676 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ["n = 8\na = list(map(int, '1 2 1 4 2 1 4 1'.split()))\ncount_dict = {}\ntotal_sum = 0\nfor i in a:\n if i not in count_dict:\n count_dict[i] = a.count(i)\n total_sum += (a.count(i))*(a.count(i)-1)//2\nfor i in a:\n print(total_sum - (a.count(i)*(a.count(i)-1)//2) + (a.count(i)-1)*(a.count(i)-2)//2)... | ['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s029813068', 's731717070', 's935927296', 's605013022'] | [3060.0, 26772.0, 26140.0, 26772.0] | [17.0, 625.0, 66.0, 575.0] | [309, 290, 313, 295] |
p02732 | u954153335 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['import math\nimport collections\ndef calc_combi2(n):\n if n<=1:\n return 0\n return math.factorial(n)/(math.factorial(n-2)*math.factorial(2))\nn=int(input())\ndata=list(map(int,input().split()))\ndata_cnt=collections.Counter(data)\ncount=0\nfor i in data_cnt.values():\n if 2<=i:\n count+=calc_c... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s540668407', 's610692739', 's502376970'] | [26772.0, 26772.0, 36084.0] | [2104.0, 1636.0, 1649.0] | [469, 414, 464] |
p02732 | u956277093 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['n = int(input())\nl = list(map(int,input().split()))\nif len(set(l))==len(l):\n for i in range(len(l)):\n print(0)\nelif len(set(l))==1:\n for i in range(n):\n print((n*(n-1)//2)-n+1)\nelse:\n d = {}\n for i in l:\n if i in d:\n d[i]+=1\n else:\n d[i] = 1\... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s041730576', 's334659163', 's773449413', 's628352277'] | [29220.0, 26140.0, 26140.0, 26140.0] | [2105.0, 2104.0, 2105.0, 348.0] | [391, 316, 443, 209] |
p02732 | u959340534 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | [' = int(input())\nimport numpy as np\n\nA = list(map(int, input().split()))\ndp = np.zeros((N,N), dtype=np.int32)\nfor i in range(N):\n tmp = [0]*(A[i]-1)+[1]+[0]*(N-A[i])\n tmp = np.array(tmp, dtype=np.int32)\n dp[i] = tmp+dp[i-1]\n\ndp = np.array(dp)\nans = []\nfor i in range(N):\n if i > 0 and i < N-1:\n tmp... | ['Runtime Error', 'Accepted'] | ['s339063585', 's955287128'] | [2940.0, 31644.0] | [17.0, 432.0] | [687, 324] |
p02732 | u968404618 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['import sys\ninput = lambda: sys.stdin.readline().rstrip()\n\ndef choose2(n):\n return n*(n-1)//2\n\nn = int(input())\nA = list(map(int, input().split()))\n\nCnt = [(a-1) for a in A]\n\ntot = 0\nfor i in range(n):\n tot += choose2(Cnt[i])\n\nfor i in range(n):\n ans = tot\n ans -= choose2(Cnt[A[i]])\n a... | ['Runtime Error', 'Accepted'] | ['s608261541', 's065412967'] | [26268.0, 26268.0] | [483.0, 492.0] | [341, 391] |
p02732 | u969133463 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['import math\nn = int(input())\na = list(map(int,input().split()))\nmx = max(a)\nb=[0] * 2000000\nans = 0\nfor i in range(len(a)):\n b[a[i]-1] += 1\n\nfor i in range(mx):\n if(b[i] == 0 or b[i] == 1):\n ans += 0\n else:\n ans = ans + int(b[i] * (b[i]-1)/2)\nans1 = 0\n\n\nfor i in range(len(a)):\... | ['Wrong Answer', 'Accepted'] | ['s363023055', 's342329872'] | [31840.0, 31844.0] | [558.0, 579.0] | [559, 560] |
p02732 | u973972117 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['N = int(input())\nK = list(map(int,input().split()))\nA = [0]*N\nprint(A)\nfor i in range(N):\n A[K[i]-1] += 1\nr = 0\nfor k in range(N):\n r += 0.5*(A[k]*(A[k]-1))\nAn =[]\nfor j in range(N):\n D = A[K[j]-1]-1\n An.append(int(r-(0.5*(D+1)*(D))+(0.5*D*(D-1))))\nfor i in range(len(An)):\n print(An[i])',... | ['Wrong Answer', 'Accepted'] | ['s717550033', 's778415442'] | [26268.0, 26140.0] | [513.0, 515.0] | [302, 293] |
p02732 | u976169012 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['n = int(input())\na = list(map(int,input().split()))\nd = {}\naa = [0]\nfor i in range(1,n):\n\taa.append(aa[-1]+i)\nfor i in a:\n\tif i not in d:\n\t\td[i] = 1\n\telse:\n\t\td[i]+=1\ns = 0\nfor i in d:\n\ts+=aa[d[i]-1]\ndd = {}\nfor i in d:\n\tif i not in dd:\n\t\tif d[i]!=1:\n\t\t\tdd[i] = (s-aa[d[i]-1]+aa[d[i]-2])... | ['Wrong Answer', 'Accepted'] | ['s753096855', 's093073778'] | [43092.0, 44064.0] | [464.0, 412.0] | [343, 295] |
p02732 | u977193988 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['import sys\nimport numpy as np\n\n\ndef input():\n return sys.stdin.readline().strip()\n\n\ndef main():\n N = int(input())\n A = np.array(list(map(int, input().split())))\n List = np.unique(A)\n count = np.bincount(A)\n # print(count)\n\n dic = {}\n Ans = 0\n for l in List:\n n = cou... | ['Time Limit Exceeded', 'Accepted'] | ['s422964225', 's098097474'] | [40152.0, 26780.0] | [2110.0, 335.0] | [576, 458] |
p02732 | u979362546 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['from collections import Counter\n\nn = int(input())\nA = list(map(int, input().split()))\ncounter = Counter(A)\nans = 0\n\nfor i in counter.values():\n\tans = i * (i - 1) // 2\n\nfor j in A:\n\tcnt = counter[j]\n\tif cnt <= 1:\n\t\tprint(ans)\n\telse:\n\t\tprint(ans - cnt + 1)', 'from collections import Counter\n\nn ... | ['Wrong Answer', 'Accepted'] | ['s147146743', 's976611283'] | [26780.0, 26780.0] | [319.0, 365.0] | [254, 255] |
p02732 | u979444096 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['from collections import Counter\n\ndef main():\n N = int(input())\n A = list(map(int, input().split()))\n uq = list(set(A))\n ans_hash = {}\n num_hash = {}\n for u in uq:\n ans = 0\n a = A[:]\n i = a.index(u)\n del a[i]\n val = Counter(a).values()\n print("v... | ['Wrong Answer', 'Accepted'] | ['s355494615', 's972895626'] | [53644.0, 26780.0] | [2105.0, 417.0] | [1065, 386] |
p02732 | u981760053 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['N=int(input())\nlist1=list(map(int,input().split()))\nlist2=[0]*N\n\nfor i in range(N):\n list2[i]=list1.count(i+1)\n\ndef choose2(n):\n return n*(n-1)/2\n\ntotal=0\nfor i in list2:\n total+=choose2(i)\n\n\nfor i in list1:\n ans=total-(list2[i-1]-1)\n print(ans)', 'from collections import Counter\n\nN=... | ['Wrong Answer', 'Accepted'] | ['s758236662', 's514127152'] | [26140.0, 34116.0] | [2104.0, 251.0] | [260, 242] |
p02732 | u981931040 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['from collections import Counter\n\ndef cmb(n, r, mod=10**9+7):\n if ( r<0 or r>n ):\n return 0\n r = min(r, n-r)\n return g1[n] * g2[r] * g2[n-r] % mod\n\nmod = 10**9+7 \nN = 10**5 * 2 + 1\ng1 = [1, 1] \ng2 = [1, 1] \ninverse = [0, 1] 計算用テーブル\n\nfor i in range( 2, N + 1 ):\n g1.append( ( g1[-1] * i... | ['Wrong Answer', 'Accepted'] | ['s062183685', 's872614963'] | [52164.0, 28436.0] | [728.0, 461.0] | [816, 399] |
p02732 | u983181637 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['from scipy.misc import comb\nfrom collections import defaultdict\nd = defaultdict(lambda: -1)\nn = int(input())\na = [int(x) for x in input().split()]\nans = 0\nfor i in range(len(a)):\n a_ = a.copy()\n b = a_.pop(i)\n if d[str(b)] != -1:\n print(d[str(b)])\n continue\n A = list(set(a_))\n ans = 0\n for j... | ['Time Limit Exceeded', 'Wrong Answer', 'Time Limit Exceeded', 'Time Limit Exceeded', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s044277026', 's135921196', 's165633848', 's608074039', 's774831221', 's890451851', 's891759306', 's216882527'] | [36544.0, 26748.0, 36620.0, 35248.0, 36228.0, 35196.0, 37664.0, 26144.0] | [2109.0, 434.0, 2109.0, 2109.0, 243.0, 214.0, 250.0, 483.0] | [387, 251, 515, 247, 543, 543, 523, 269] |
p02732 | u991269553 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['n = int(input())\na = list(map(int,input().split()))\n\nimport math\n\ndef comb(n, r):\n if n <= 1:\n return 0\n else:\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n\n\ncount = 0\nkaisuu = []\nsum = 0\nkaisuu = [0 for _ in range(n)]\nfor num in range(1,max(a)+1):\n ... | ['Runtime Error', 'Accepted'] | ['s492176164', 's014758249'] | [26140.0, 26780.0] | [2104.0, 420.0] | [560, 244] |
p02732 | u996731299 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['M=int(input())\nN=list(input().split())\nprint(N)\ncheck=[0,0,0,0,0,0,0,0,0,0]\nfor i in range(M):\n check[int(N[i])]+=1\nnum=0\nfor i in range(M):\n num+=check[i]*(check[i]-1)//2\nfor i in range(M):\n print(num-(check[int(N[i])]-1))', 'M=int(input())\nN=list(input().split())\nprint(N)\ncheck=[0]*M\nfor i in... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s387044660', 's506182413', 's838893023'] | [22496.0, 24316.0, 20992.0] | [96.0, 428.0, 417.0] | [232, 220, 275] |
p02732 | u999503965 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['n=int(input())\nl=list(map(int,input().split()))\n\nd = [0]*n\nans=0\n \nfor a in l:\n d[a-1] += 1\n \nfor a in d:\n ans+=a*(a-1)//2\n \nprint(ans)\n ', '# -*- coding: utf-8 -*-\n"""\nCreated on Mon Sep 7 22:04:16 2020\n\n@author: liang\n"""\n\nN = int(input())\nA = [int(x) for x in input().split()]\nd = [0]*... | ['Wrong Answer', 'Accepted'] | ['s609479251', 's092661823'] | [32316.0, 32316.0] | [118.0, 210.0] | [144, 292] |
p02733 | u002539468 | 2,000 | 1,048,576 | We have a chocolate bar partitioned into H horizontal rows and W vertical columns of squares. The square (i, j) at the i-th row from the top and the j-th column from the left is dark if S_{i,j} is `0`, and white if S_{i,j} is `1`. We will cut the bar some number of times to divide it into some number of blocks. In ea... | ['import numpy as np\n\nH, W, K = map(int, input().split())\nS = []\nfor _ in range(H):\n S.append(list(map(int, list(input()))))\nS = np.array(S)\n\nif S.sum() <= K:\n print(0)\n exit(0)\n\ndef satisfy(left, right, S2):\n global K\n for row in S2:\n # if row[left:(right + 1)].sum() > K:\n ... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s592319545', 's698639883', 's104391330'] | [13416.0, 3188.0, 12564.0] | [324.0, 649.0, 1227.0] | [1630, 1536, 1748] |
p02733 | u033183216 | 2,000 | 1,048,576 | We have a chocolate bar partitioned into H horizontal rows and W vertical columns of squares. The square (i, j) at the i-th row from the top and the j-th column from the left is dark if S_{i,j} is `0`, and white if S_{i,j} is `1`. We will cut the bar some number of times to divide it into some number of blocks. In ea... | ["\nimport sys\n\nans = sys.maxsize\nH, W, K = map(int, input().split())\ns = [input() for _ in range(H)]\n\nfor h in range(1 << (H - 1)):\n g = 0\n ids = [-1 for _ in range(H)]\n for i in range(H):\n ids[i] = g\n if (h >> i) & 1:\n g += 1\n\n g += 1\n c = [[[0] * W] for _ in ran... | ['Runtime Error', 'Accepted'] | ['s691230201', 's064023186'] | [3064.0, 3188.0] | [18.0, 2000.0] | [1016, 1015] |
p02733 | u036104576 | 2,000 | 1,048,576 | We have a chocolate bar partitioned into H horizontal rows and W vertical columns of squares. The square (i, j) at the i-th row from the top and the j-th column from the left is dark if S_{i,j} is `0`, and white if S_{i,j} is `1`. We will cut the bar some number of times to divide it into some number of blocks. In ea... | ['import sys\nimport itertools\n# import numpy as np\nimport time\nimport math\nfrom heapq import heappop, heappush\nfrom collections import defaultdict\nfrom collections import Counter\nfrom collections import deque\nfrom itertools import permutations\nsys.setrecursionlimit(10 ** 7)\n \nINF = 10 ** 18\nMOD = 10 ** 9 +... | ['Wrong Answer', 'Accepted'] | ['s651627475', 's806928800'] | [9536.0, 9672.0] | [1973.0, 1993.0] | [1453, 1482] |
p02733 | u078181689 | 2,000 | 1,048,576 | We have a chocolate bar partitioned into H horizontal rows and W vertical columns of squares. The square (i, j) at the i-th row from the top and the j-th column from the left is dark if S_{i,j} is `0`, and white if S_{i,j} is `1`. We will cut the bar some number of times to divide it into some number of blocks. In ea... | ['h,w,k = list(map(int,input().split()))\narr = [[int(i) for i in input()] for _ in range(h)]\n\nfrom itertools import product\nans = [0]*(2**(h-1))\n\nfor idx,cond in enumerate(product((True,False),repeat=h-1)):\n div = sum(cond)\n spl = [arr[0][:]]\n for i in range(h-1):\n if h_cond[i]:\n s... | ['Runtime Error', 'Accepted'] | ['s711904667', 's318462096'] | [3188.0, 3316.0] | [19.0, 1269.0] | [810, 808] |
p02733 | u106778233 | 2,000 | 1,048,576 | We have a chocolate bar partitioned into H horizontal rows and W vertical columns of squares. The square (i, j) at the i-th row from the top and the j-th column from the left is dark if S_{i,j} is `0`, and white if S_{i,j} is `1`. We will cut the bar some number of times to divide it into some number of blocks. In ea... | ['import itertools\n\nH, W, K = map(int, input().split())\nS = []\nfor _ in range(H):\n S.append([int(s) for s in input()])\n \n\nans = 2000\nfor t in itertools.product([0, 1], repeat=H - 1):\n cnt = t.count(1)\n #print(cnt)\n lst = [[s for s in S[0]]]\n for h in range(H - 1):\n \n #prin... | ['Wrong Answer', 'Accepted'] | ['s813063128', 's499852753'] | [3316.0, 3188.0] | [1884.0, 1873.0] | [1521, 1522] |
p02733 | u111473084 | 2,000 | 1,048,576 | We have a chocolate bar partitioned into H horizontal rows and W vertical columns of squares. The square (i, j) at the i-th row from the top and the j-th column from the left is dark if S_{i,j} is `0`, and white if S_{i,j} is `1`. We will cut the bar some number of times to divide it into some number of blocks. In ea... | ["def main():\n import sys\n sys.setrecursionlimit(10**9)\n input = sys.stdin.readline\n INF = 10**9\n\n H, W, K = map(int, input().split())\n chocolate = [ input()[:-1] for _ in range(H) ]\n \n loop_H = range(H)\n loop_W = range(W)\n white_chocolate = [ [0]*(W+1) for _ in range(10) ]\n ... | ['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s308028850', 's695971386', 's696456428', 's665571824'] | [3188.0, 3064.0, 3064.0, 3064.0] | [20.0, 1339.0, 18.0, 421.0] | [1561, 1255, 1574, 1278] |
p02733 | u141786930 | 2,000 | 1,048,576 | We have a chocolate bar partitioned into H horizontal rows and W vertical columns of squares. The square (i, j) at the i-th row from the top and the j-th column from the left is dark if S_{i,j} is `0`, and white if S_{i,j} is `1`. We will cut the bar some number of times to divide it into some number of blocks. In ea... | ['\nimport numpy as np\n\nH, W, K = map(int, input().split())\nS = np.zeros((H, W), dtype=np.int64)\n\nans = H+W\n\nfor i in range(H):\n S[i] = list(str(input()))\n\nfor m in range(2**(H-1)):\n wp = np.zeros((H, W), dtype=np.int64)\n wq = np.zeros((H, ), dtype=np.int64)\n wp[0] = S[0]\n cut = 0\n for ... | ['Wrong Answer', 'Accepted'] | ['s177108494', 's016738149'] | [13660.0, 21264.0] | [191.0, 1247.0] | [643, 695] |
p02733 | u145600939 | 2,000 | 1,048,576 | We have a chocolate bar partitioned into H horizontal rows and W vertical columns of squares. The square (i, j) at the i-th row from the top and the j-th column from the left is dark if S_{i,j} is `0`, and white if S_{i,j} is `1`. We will cut the bar some number of times to divide it into some number of blocks. In ea... | ["h,w,k = map(int,input().split())\nchoco = [list(map(int,list(input()))) for _ in range(h)]\n\nwhite = [[0]*w for _ in range(h)]\nfor i in range(h):\n for j in range(w):\n if i != 0:\n white[i][j] += white[i-1][j]\n if j != 0:\n white[i][j] += white[i][j-1]\n if i != 0 and... | ['Wrong Answer', 'Accepted'] | ['s621181350', 's358742430'] | [3436.0, 3564.0] | [35.0, 1479.0] | [2101, 2109] |
p02733 | u171255092 | 2,000 | 1,048,576 | We have a chocolate bar partitioned into H horizontal rows and W vertical columns of squares. The square (i, j) at the i-th row from the top and the j-th column from the left is dark if S_{i,j} is `0`, and white if S_{i,j} is `1`. We will cut the bar some number of times to divide it into some number of blocks. In ea... | ['import numpy as np\nimport itertools\n\nH, W, K = map(int, input().split())\nS = np.array([[s for s in input()] for _ in range(H)], dtype=np.int)\n\nans = 2000\nfor t in itertools.product([0, 1], repeat=H - 1):\n cut = t.count(1)\n lst = np.zeros((cut + 1, W), dtype=np.int)\n lst[0] += S[0]\n c = 0\n f... | ['Time Limit Exceeded', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s101282704', 's108602097', 's823582458', 's793188747'] | [14440.0, 3064.0, 14456.0, 3188.0] | [2108.0, 18.0, 184.0, 1872.0] | [729, 771, 724, 765] |
p02733 | u174878451 | 2,000 | 1,048,576 | We have a chocolate bar partitioned into H horizontal rows and W vertical columns of squares. The square (i, j) at the i-th row from the top and the j-th column from the left is dark if S_{i,j} is `0`, and white if S_{i,j} is `1`. We will cut the bar some number of times to divide it into some number of blocks. In ea... | ['from itertools import combinations, chain\n\nH, W, K = map(int, input().split())\nSss = []\nfor _ in range(H):\n Sss.append(list(map(int, input())))\n\n\ndef h_divide(Sss, div_is):\n result = []\n for s, e in zip(chain([0], div_is), chain(div_is, [len(Sss)])):\n result.append(Sss[s:e])\n return res... | ['Wrong Answer', 'Accepted'] | ['s019715645', 's632967673'] | [3188.0, 3188.0] | [20.0, 1664.0] | [1385, 1397] |
p02733 | u197922478 | 2,000 | 1,048,576 | We have a chocolate bar partitioned into H horizontal rows and W vertical columns of squares. The square (i, j) at the i-th row from the top and the j-th column from the left is dark if S_{i,j} is `0`, and white if S_{i,j} is `1`. We will cut the bar some number of times to divide it into some number of blocks. In ea... | ['import numpy as np\nfrom itertools import product\n\nH,W,K = map(int, input().split())\nS = np.array(([list(map(int,list(input()))) for _ in range(H)])).T\n\nif sum(sum(s) for s in S)<=K:\n print(0)\nelse:\n answer = (H-1) * (W-1)\n for X in product([False,True], repeat=H-1):\n ans = np.sum(X)\n ... | ['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s140965667', 's197223049', 's249167465', 's416023566', 's633040587', 's638429428', 's703260567', 's757941909', 's726923323'] | [3064.0, 12680.0, 14380.0, 3316.0, 14732.0, 16604.0, 14684.0, 3316.0, 12496.0] | [17.0, 352.0, 2112.0, 21.0, 2108.0, 2108.0, 2108.0, 21.0, 589.0] | [920, 1097, 916, 1274, 720, 774, 830, 1193, 1152] |
p02733 | u268554510 | 2,000 | 1,048,576 | We have a chocolate bar partitioned into H horizontal rows and W vertical columns of squares. The square (i, j) at the i-th row from the top and the j-th column from the left is dark if S_{i,j} is `0`, and white if S_{i,j} is `1`. We will cut the bar some number of times to divide it into some number of blocks. In ea... | ['H,W,K = map(int,input().split())\nimport numpy as np\nfrom collections import deque\nans = 10000\nS = np.array([list(map(int,list(input()))) for _ in range(H)])\ncum = [[0]*W for _ in range(H+1)]\nfor j in range(W):\n for i in range(1,H+1):\n cum[i][j] = cum[i-1][j]+S[i-1][j]\n \ncum = np.array(cum)\nfor i in ... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s158383475', 's305588957', 's322662066', 's367720944', 's578480814', 's587732250', 's610168929', 's617562511', 's677282283', 's947970016', 's034194321'] | [12888.0, 12948.0, 14952.0, 12948.0, 12948.0, 2940.0, 12516.0, 12936.0, 12928.0, 12948.0, 12964.0] | [215.0, 499.0, 2109.0, 1216.0, 665.0, 17.0, 167.0, 164.0, 181.0, 161.0, 692.0] | [625, 752, 873, 926, 856, 1051, 205, 297, 870, 931, 1065] |
p02733 | u287132915 | 2,000 | 1,048,576 | We have a chocolate bar partitioned into H horizontal rows and W vertical columns of squares. The square (i, j) at the i-th row from the top and the j-th column from the left is dark if S_{i,j} is `0`, and white if S_{i,j} is `1`. We will cut the bar some number of times to divide it into some number of blocks. In ea... | ["import numpy as np\n\nh, w, k = map(int, input().split())\ns = []\nfor i in range(h):\n string = input()\n temp = []\n for j in range(w):\n temp.append(int(string[j]))\n s.append(temp)\n\ns_arr = np.array(s)\n\nans = 10**9\nfor i in range(2**(h-1)):\n bin_str = format(i, '0'+str(h-1)+'b')\n k... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s247206097', 's510807207', 's620058476', 's362897316'] | [12640.0, 12516.0, 12916.0, 13568.0] | [220.0, 154.0, 2109.0, 1599.0] | [983, 969, 1372, 961] |
p02733 | u368796742 | 2,000 | 1,048,576 | We have a chocolate bar partitioned into H horizontal rows and W vertical columns of squares. The square (i, j) at the i-th row from the top and the j-th column from the left is dark if S_{i,j} is `0`, and white if S_{i,j} is `1`. We will cut the bar some number of times to divide it into some number of blocks. In ea... | ['def main():\n import numpy as np\n h,w,k = map(int,input().split())\n l = [list(input()) for i in range(h)]\n\n def check(lis):\n \n num = np.zeros(len(lis))\n ans = 0\n for i in range(w):\n num2 = np.zeros(len(lis))\n for j in range(h):\n i... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s129215113', 's567753299', 's832035865'] | [14528.0, 3064.0, 3188.0] | [2108.0, 17.0, 1778.0] | [988, 2344, 1066] |
p02733 | u474423089 | 2,000 | 1,048,576 | We have a chocolate bar partitioned into H horizontal rows and W vertical columns of squares. The square (i, j) at the i-th row from the top and the j-th column from the left is dark if S_{i,j} is `0`, and white if S_{i,j} is `1`. We will cut the bar some number of times to divide it into some number of blocks. In ea... | ["import numpy as np\nfrom itertools import product\n\nH,W,K=map(int,input().split(' '))\narr = np.vstack([list(map(int,list(input()))) for j in range(H)])\nans = H+W-2\ncnt = 0\nd_cnt = 0\nfor p in product([0,1],repeat=H-1):\n cnt += 1\n sp=np.zeros((sum(p)+1,W),int)\n row=0\n sp[0]+=arr[0]\n for j in r... | ['Wrong Answer', 'Accepted'] | ['s264125141', 's206716709'] | [14672.0, 12676.0] | [2108.0, 812.0] | [696, 692] |
p02733 | u486065927 | 2,000 | 1,048,576 | We have a chocolate bar partitioned into H horizontal rows and W vertical columns of squares. The square (i, j) at the i-th row from the top and the j-th column from the left is dark if S_{i,j} is `0`, and white if S_{i,j} is `1`. We will cut the bar some number of times to divide it into some number of blocks. In ea... | ['def add(in1, in2):\n return [a + b for a, b in zip(in1, in2)]\n\ndef split(ar, k, w):\n a = 0\n if max(ar) > k:\n return -1\n tm = ar[0]\n for i in range(1, w):\n tm = add(tm, ar[i])\n if max(tm) > k:\n a += 1\n tm = ar[i]\n return a \n\nh, w, k = map(... | ['Runtime Error', 'Accepted'] | ['s717113043', 's735289908'] | [3188.0, 3364.0] | [21.0, 332.0] | [855, 863] |
p02733 | u550061714 | 2,000 | 1,048,576 | We have a chocolate bar partitioned into H horizontal rows and W vertical columns of squares. The square (i, j) at the i-th row from the top and the j-th column from the left is dark if S_{i,j} is `0`, and white if S_{i,j} is `1`. We will cut the bar some number of times to divide it into some number of blocks. In ea... | ['import numpy as np\nimport itertools\n\nH, W, K = map(int, input().split())\nS = np.array([[int(s) for s in input()] for _ in range(H)])\n\nans = 2000\nfor t in itertools.product([0, 1], repeat=H - 1):\n cut = t.count(1)\n lst = np.zeros((cut + 1, W), dtype=np.int)\n lst[0] += S[0]\n c = 0\n for h in r... | ['Time Limit Exceeded', 'Accepted'] | ['s386924895', 's307582026'] | [14668.0, 3188.0] | [2109.0, 1840.0] | [721, 764] |
p02733 | u614628638 | 2,000 | 1,048,576 | We have a chocolate bar partitioned into H horizontal rows and W vertical columns of squares. The square (i, j) at the i-th row from the top and the j-th column from the left is dark if S_{i,j} is `0`, and white if S_{i,j} is `1`. We will cut the bar some number of times to divide it into some number of blocks. In ea... | ["from collections import defaultdict\nfrom itertools import product\n \nH, W, K = map(int, input().split())\nS = [input() for _ in range(H)]\n \ni = 0\nwhile i < len(S):\n if '1' in S[i]:\n i += 1\n else:\n del S[i]\nH = len(S)\n \nC = [[int(s[i]) for s in S] for i in range(W)]\nprint(C)\ntotal = sum(sum(c) fo... | ['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s353102549', 's450917623', 's594482292', 's663866048', 's848478239', 's186717914'] | [3564.0, 13008.0, 3564.0, 13084.0, 3692.0, 3564.0] | [519.0, 2104.0, 516.0, 2104.0, 2103.0, 513.0] | [1387, 1612, 1470, 1525, 914, 1242] |
p02733 | u651663683 | 2,000 | 1,048,576 | We have a chocolate bar partitioned into H horizontal rows and W vertical columns of squares. The square (i, j) at the i-th row from the top and the j-th column from the left is dark if S_{i,j} is `0`, and white if S_{i,j} is `1`. We will cut the bar some number of times to divide it into some number of blocks. In ea... | ['h,w,kk=list(map(int,input().split()))\ns=[list(map(int,list(input()))) for i in range(h)]\nl=[]\nfor i in range(2**(h-1)):\n ll=[0]\n for j in range(h-1):\n if i & 2**j:\n ll.append(ll[-1]+1)\n else:\n ll.append(ll[-1])\n l.append(ll)\n\nmc=w+h\nfor i in l:\n c=[0 for i in range(h)]\n cc=0\n f=1... | ['Runtime Error', 'Accepted'] | ['s495250510', 's195979166'] | [9296.0, 9268.0] | [28.0, 1486.0] | [711, 776] |
p02733 | u671455949 | 2,000 | 1,048,576 | We have a chocolate bar partitioned into H horizontal rows and W vertical columns of squares. The square (i, j) at the i-th row from the top and the j-th column from the left is dark if S_{i,j} is `0`, and white if S_{i,j} is `1`. We will cut the bar some number of times to divide it into some number of blocks. In ea... | ["import itertools\n\nh, w, k = map(int, input().split())\ns = [['0' for i in range(w)] for j in range(h)]\n\nfor i in range(h):\n s[i] = input()\n\ncnt = [[0 for i in range(w)] for j in range(h)]\nfor i in range(h):\n cnt[i][0] = int(s[i][0]) + (0 if i == 0 else cnt[i - 1][0])\n\nfor i in range(w):\n cnt[0][i] = in... | ['Wrong Answer', 'Accepted'] | ['s938867599', 's462825475'] | [3440.0, 3440.0] | [1812.0, 1688.0] | [973, 1066] |
p02733 | u678167152 | 2,000 | 1,048,576 | We have a chocolate bar partitioned into H horizontal rows and W vertical columns of squares. The square (i, j) at the i-th row from the top and the j-th column from the left is dark if S_{i,j} is `0`, and white if S_{i,j} is `1`. We will cut the bar some number of times to divide it into some number of blocks. In ea... | ["import itertools\nH, W, K = map(int, input().split())\n\nS = [0]*H\nfor i in range(H):\n S[i] = input()\nSdivs = []\nmcnt = 1100\nfor b in itertools.product([0, 1], repeat=H-1):\n start = 0\n end = 1\n Sdivs=[]\n for a in b:\n if a==1:\n Sdivs.append(S[start:end])\n start = end\n end += 1\n Sdiv... | ['Wrong Answer', 'Accepted'] | ['s135090065', 's884581741'] | [3064.0, 9408.0] | [2104.0, 815.0] | [988, 1223] |
p02733 | u686230543 | 2,000 | 1,048,576 | We have a chocolate bar partitioned into H horizontal rows and W vertical columns of squares. The square (i, j) at the i-th row from the top and the j-th column from the left is dark if S_{i,j} is `0`, and white if S_{i,j} is `1`. We will cut the bar some number of times to divide it into some number of blocks. In ea... | ['import numpy as np\n\nh, w, k = map(int, input().split())\ns = np.array(\n [[int(s_ij) for s_ij in input()] for _ in range(h)],\n dtype=np.int)\n\nminimum = (h - 1) * (w - 1)\nfor div_h in range(1 << (h - 1)):\n h_index = np.zeros(h, dtype=np.int)\n cur_index = 0\n for i in range(1, h):\n if div_h & 1:\n ... | ['Time Limit Exceeded', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s133221314', 's188450752', 's275261403', 's439110948', 's985947830'] | [14552.0, 12488.0, 3064.0, 3188.0, 3192.0] | [2108.0, 149.0, 2061.0, 2104.0, 1632.0] | [740, 747, 666, 706, 721] |
p02733 | u704284486 | 2,000 | 1,048,576 | We have a chocolate bar partitioned into H horizontal rows and W vertical columns of squares. The square (i, j) at the i-th row from the top and the j-th column from the left is dark if S_{i,j} is `0`, and white if S_{i,j} is `1`. We will cut the bar some number of times to divide it into some number of blocks. In ea... | ['from collections import deque\ndef main():\n H,W,K = map(int,input().split())\n S = [[int(s) for s in input()]for _ in range(H)]\n ans = 2**60\n for i in range(2**(H-1)):\n aa = 0\n for j in range(H-1):\n if (i>>j)&1 == 1:\n aa+=1\n c = aa\n b = [0 for... | ['Runtime Error', 'Accepted'] | ['s821889724', 's691423601'] | [3436.0, 3064.0] | [976.0, 1567.0] | [1020, 1007] |
p02733 | u711693740 | 2,000 | 1,048,576 | We have a chocolate bar partitioned into H horizontal rows and W vertical columns of squares. The square (i, j) at the i-th row from the top and the j-th column from the left is dark if S_{i,j} is `0`, and white if S_{i,j} is `1`. We will cut the bar some number of times to divide it into some number of blocks. In ea... | ["def main():\n from itertools import product\n \n H, W, K = map(int, input().split())\n S = [input() for _ in range(H)]\n S_T = [[int(s[w]) for s in S] for w in range(W)]\n sumS = sum(map(sum, S_T))\n ans = (H - 1) * (W - 1)\n \n if sumS <= K:\n print(0)\n else:\n for i in p... | ['Runtime Error', 'Accepted'] | ['s338264343', 's383524023'] | [3064.0, 3188.0] | [17.0, 360.0] | [1115, 1108] |
p02733 | u726285999 | 2,000 | 1,048,576 | We have a chocolate bar partitioned into H horizontal rows and W vertical columns of squares. The square (i, j) at the i-th row from the top and the j-th column from the left is dark if S_{i,j} is `0`, and white if S_{i,j} is `1`. We will cut the bar some number of times to divide it into some number of blocks. In ea... | ['import numpy as np\nimport itertools\n\nH, W, K = map(int, input().split())\nchoco = []\nfor i in range(H):\n choco.append([int(x) for x in list(input())])\n\narr = np.array(choco)\n\n\ncount = (H-1) + (W-1)\n\nfor k in range(H):\n \n \n if count <= k:\n break\n\n \n for comb in itertools.com... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s051317299', 's472824255', 's812048118', 's857377418'] | [14596.0, 16080.0, 12548.0, 14580.0] | [705.0, 1068.0, 709.0, 707.0] | [1298, 1504, 1313, 1402] |
p02733 | u727057618 | 2,000 | 1,048,576 | We have a chocolate bar partitioned into H horizontal rows and W vertical columns of squares. The square (i, j) at the i-th row from the top and the j-th column from the left is dark if S_{i,j} is `0`, and white if S_{i,j} is `1`. We will cut the bar some number of times to divide it into some number of blocks. In ea... | ['import itertools\nimport numpy as np\n\nres = 999999999999999999\n\nH, W, K = [int(i) for i in input().split()]\narr = []\nfor h in range(H):\n arr.append([int(v) for v in input()])\n\narr = np.vstack(arr)\nprint(arr)\n \nfor p in itertools.product([0, 1], repeat = H-1):\n sp = np.zeros((sum(p)+1, W), int)\n row ... | ['Wrong Answer', 'Accepted'] | ['s248622333', 's769952487'] | [14700.0, 12696.0] | [2108.0, 838.0] | [653, 710] |
p02733 | u735891571 | 2,000 | 1,048,576 | We have a chocolate bar partitioned into H horizontal rows and W vertical columns of squares. The square (i, j) at the i-th row from the top and the j-th column from the left is dark if S_{i,j} is `0`, and white if S_{i,j} is `1`. We will cut the bar some number of times to divide it into some number of blocks. In ea... | ['import itertools\nH, W, K = map(int,input().split())\nS = [list(map(int,list(input()))) for _ in range(H)]\ndef check(k):\n if k <= K:\n return(True)\n else:\n return(False)\n \nnoans = 0\ndef make_lst(i):\n global noans, lst, havelst\n temp = S[0][i]\n for h in range(H-1):\n ... | ['Runtime Error', 'Accepted'] | ['s144872077', 's199958531'] | [3064.0, 3188.0] | [18.0, 1937.0] | [1322, 1660] |
p02733 | u798316285 | 2,000 | 1,048,576 | We have a chocolate bar partitioned into H horizontal rows and W vertical columns of squares. The square (i, j) at the i-th row from the top and the j-th column from the left is dark if S_{i,j} is `0`, and white if S_{i,j} is `1`. We will cut the bar some number of times to divide it into some number of blocks. In ea... | ["def main():\n import sys\n input=sys.stdin.readline\n h,w,k=map(int,input().split())\n S=[]\n for _ in range(h):\n s=list(map(int,list(input().rstrip())))\n S.append(s)\n ans=10**5\n for i in range(2**(h-1)):\n l=[0]\n for j in range(h-1):\n if i&1<<j:\n ... | ['Wrong Answer', 'Accepted'] | ['s996094081', 's390726995'] | [3188.0, 3188.0] | [1560.0, 1182.0] | [680, 872] |
p02733 | u844789719 | 2,000 | 1,048,576 | We have a chocolate bar partitioned into H horizontal rows and W vertical columns of squares. The square (i, j) at the i-th row from the top and the j-th column from the left is dark if S_{i,j} is `0`, and white if S_{i,j} is `1`. We will cut the bar some number of times to divide it into some number of blocks. In ea... | ["import numpy as np\nimport itertools\nH, W, K = [int(_) for _ in input().split()]\nS = np.zeros((H + 1, W + 1), dtype=int)\nS[1:, 1:] = [[int(_) for _ in input()] for _ in range(H)]\ncum = S.cumsum(axis=0).cumsum(axis=1)\n#sum(a,b -> x,y) (1-indexed)\n#cum[x][y]+cum[a-1][b-1]-cum[a-1][y]-cum[x][b-1]\nans = 10**10\nfo... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s741170264', 's936150760', 's947308170'] | [27368.0, 91948.0, 27504.0] | [2206.0, 2207.0, 214.0] | [734, 1001, 835] |
p02733 | u871980676 | 2,000 | 1,048,576 | We have a chocolate bar partitioned into H horizontal rows and W vertical columns of squares. The square (i, j) at the i-th row from the top and the j-th column from the left is dark if S_{i,j} is `0`, and white if S_{i,j} is `1`. We will cut the bar some number of times to divide it into some number of blocks. In ea... | ['from itertools import product\nimport numpy as np\nimport time\nimport random\n\nH, W, K = map(int, input().split())\ns = [np.array(list(input()), dtype=np.int32) for _ in range(H)]\n\nstart = time.time()\n\n\n\ns2 = [np.cumsum(row, dtype=np.int32) for row in s]\n\nrate = H*W//5\nmi = 10 ** 9\nseed = [0, 1]\ntgt = pr... | ['Runtime Error', 'Accepted'] | ['s752829014', 's018814381'] | [15220.0, 20024.0] | [160.0, 1984.0] | [1205, 2064] |
p02733 | u899308536 | 2,000 | 1,048,576 | We have a chocolate bar partitioned into H horizontal rows and W vertical columns of squares. The square (i, j) at the i-th row from the top and the j-th column from the left is dark if S_{i,j} is `0`, and white if S_{i,j} is `1`. We will cut the bar some number of times to divide it into some number of blocks. In ea... | ['import numpy as np\nH,W,K = list(map(int,input().split()))\n\n\nS = [0]*H\nfor i in range(H):\n S[i] = list(map(int,list(input())))\n# print(S)\nS = np.array(S)\n# print(S)\n# print(np.sum(S[0:3,0:3]))\n\n# n=0\nif np.sum(S) <= K:\n print(0)\n exit()\n\n# n=1\nfor i in range(1,H):\n # print("i:",i)\n #... | ['Wrong Answer', 'Accepted'] | ['s978656990', 's321165156'] | [12632.0, 3188.0] | [188.0, 1877.0] | [596, 1192] |
p02733 | u968649733 | 2,000 | 1,048,576 | We have a chocolate bar partitioned into H horizontal rows and W vertical columns of squares. The square (i, j) at the i-th row from the top and the j-th column from the left is dark if S_{i,j} is `0`, and white if S_{i,j} is `1`. We will cut the bar some number of times to divide it into some number of blocks. In ea... | ['import sys\nread = sys.stdin.read\nreadline = sys.stdin.readline\nreadlines = sys.stdin.readlines\n\ndef main():\n H,W,K = map(int, readline().split())\n S = [list(map(int, readline().strip())) for j in range(H)]\n \n print(H,W,S)\n \n white = 0\n for line in S:\n white += sum(line)\n \n ... | ['Wrong Answer', 'Accepted'] | ['s826771527', 's240369461'] | [3064.0, 3192.0] | [17.0, 394.0] | [2067, 2034] |
p02733 | u987164499 | 2,000 | 1,048,576 | We have a chocolate bar partitioned into H horizontal rows and W vertical columns of squares. The square (i, j) at the i-th row from the top and the j-th column from the left is dark if S_{i,j} is `0`, and white if S_{i,j} is `1`. We will cut the bar some number of times to divide it into some number of blocks. In ea... | ['from itertools import accumulate\n\nh,w,k = map(int,input().split())\ns = [list(map(int,"".join(input()))) for _ in range(h)]\n\nmin_split = 10**10\n\nfor i in range(2**(h-1)):\n li = []\n for j in range(h-1):\n if (i >> j)&1:\n li.append(j)\n li.append(h-1)\n lin = [0]*w\n total = []... | ['Wrong Answer', 'Accepted'] | ['s752467090', 's593099431'] | [9544.0, 9436.0] | [1373.0, 1644.0] | [798, 917] |
p02734 | u044220565 | 2,000 | 1,048,576 | Given are a sequence of N integers A_1, A_2, \ldots, A_N and a positive integer S. For a pair of integers (L, R) such that 1\leq L \leq R \leq N, let us define f(L, R) as follows: * f(L, R) is the number of sequences of integers (x_1, x_2, \ldots , x_k) such that L \leq x_1 < x_2 < \cdots < x_k \leq R and A_{x_1... | ['# coding: utf-8\nimport itertools\nA = [0]\nN, S = list(map(int, input().split()))\nA = A + list(map(int, input().split())) \nprint(N,S,A)\nval = 0\nfor L in range(1, N+1):\n for R in range(L, N+1):\n A_ = A[L:R+1]\n lists = []\n for n in range(len(A_)):\n for comb in itertools.combinations(A_, n+1):... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s471741052', 's713798478', 's086256682'] | [223312.0, 223312.0, 161044.0] | [2118.0, 2122.0, 1628.0] | [443, 474, 424] |
p02734 | u102461423 | 2,000 | 1,048,576 | Given are a sequence of N integers A_1, A_2, \ldots, A_N and a positive integer S. For a pair of integers (L, R) such that 1\leq L \leq R \leq N, let us define f(L, R) as follows: * f(L, R) is the number of sequences of integers (x_1, x_2, \ldots , x_k) such that L \leq x_1 < x_2 < \cdots < x_k \leq R and A_{x_1... | ['from numpy import *\nM=998244353\nN,S,*A=map(int,open(0).read().split())\na=0\nf = np.zeros(S+1, np.int64)\nfor b in As:\n f[0]+=1\n f[b:] += f[:-b].copy()\n f%=M\n a+=f[S]\nprint(a%M)', 'from numpy import *\nM=998244353\nN,S,*A=map(int,open(0).read().split())\na=0\nf=zeros(S+1,int)\nfor b in A:\n f[0]+=1\n f[b... | ['Runtime Error', 'Accepted'] | ['s646479404', 's339757507'] | [12508.0, 20500.0] | [152.0, 343.0] | [178, 166] |
p02734 | u111473084 | 2,000 | 1,048,576 | Given are a sequence of N integers A_1, A_2, \ldots, A_N and a positive integer S. For a pair of integers (L, R) such that 1\leq L \leq R \leq N, let us define f(L, R) as follows: * f(L, R) is the number of sequences of integers (x_1, x_2, \ldots , x_k) such that L \leq x_1 < x_2 < \cdots < x_k \leq R and A_{x_1... | ['def main():\n import sys\n sys.setrecursionlimit(10**9)\n input = sys.stdin.readline\n import numpy as np\n\n mod = 998244353\n\n N, S = map(int, input().split())\n A = list(map(int, input().split()))\n\n \n polynomial = np.zeros(S+1, int)\n ans = 0\n for i in A:\n polynomial[0... | ['Wrong Answer', 'Accepted'] | ['s473343473', 's121414346'] | [12492.0, 12500.0] | [296.0, 300.0] | [432, 454] |
p02734 | u266014018 | 2,000 | 1,048,576 | Given are a sequence of N integers A_1, A_2, \ldots, A_N and a positive integer S. For a pair of integers (L, R) such that 1\leq L \leq R \leq N, let us define f(L, R) as follows: * f(L, R) is the number of sequences of integers (x_1, x_2, \ldots , x_k) such that L \leq x_1 < x_2 < \cdots < x_k \leq R and A_{x_1... | ["def main():\n import sys\n def input(): return sys.stdin.readline().rstrip()\n n, s = map(int, input().split())\n a = list(map(int, input().split()))\n import numpy as np\n dp = np.zeros(s+1, dtype=int)\n dp[0] = 1\n mod = 998244353\n ans = 0\n for i in range(n):\n dp[0] += 1\n ... | ['Wrong Answer', 'Accepted'] | ['s526150924', 's217827076'] | [27376.0, 26664.0] | [284.0, 221.0] | [448, 434] |
p02734 | u340781749 | 2,000 | 1,048,576 | Given are a sequence of N integers A_1, A_2, \ldots, A_N and a positive integer S. For a pair of integers (L, R) such that 1\leq L \leq R \leq N, let us define f(L, R) as follows: * f(L, R) is the number of sequences of integers (x_1, x_2, \ldots , x_k) such that L \leq x_1 < x_2 < \cdots < x_k \leq R and A_{x_1... | ['import numpy as np\n\nn, s = map(int, input().split())\naaa = list(map(int, input().split()))\n\nfwd_acc = np.zeros((n + 1, s + 1), dtype=np.int64)\nfwd_acc[0][0] = 1\n\nans = 0\nMOD = 998244353\nfor i, a in enumerate(aaa, start=1):\n fwd_acc[i] = fwd_acc[i - 1]\n fwd_acc[i][0] = i\n if a <= s:\n fwd_... | ['Runtime Error', 'Accepted'] | ['s057376987', 's973225796'] | [82768.0, 82764.0] | [216.0, 331.0] | [405, 459] |
p02734 | u561231954 | 2,000 | 1,048,576 | Given are a sequence of N integers A_1, A_2, \ldots, A_N and a positive integer S. For a pair of integers (L, R) such that 1\leq L \leq R \leq N, let us define f(L, R) as follows: * f(L, R) is the number of sequences of integers (x_1, x_2, \ldots , x_k) such that L \leq x_1 < x_2 < \cdots < x_k \leq R and A_{x_1... | ["import sys \nMOD = 10**9 +7\nINF = 10**5\n\ndef main():\n n,s = map(int,input().split())\n a = list(map(int,input().split()))\n\n dp = [[0] * (s + 1) for _ in range(n + 1)]\n for i in range(n):\n num = a[i]\n for j in range(1,s + 1):\n dp[i + 1][j] = dp[i][j] + dp[i][j - a[i]]\n ... | ['Runtime Error', 'Accepted'] | ['s014008013', 's828065140'] | [75892.0, 14412.0] | [2109.0, 323.0] | [365, 527] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.