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 |
|---|---|---|---|---|---|---|---|---|---|---|
p02572 | u818213347 | 2,000 | 1,048,576 | Given are N integers A_1,\ldots,A_N. Find the sum of A_i \times A_j over all pairs (i,j) such that 1\leq i < j \leq N, modulo (10^9+7). | ['n = int(input())\nl = list(map(int,input().split()))\nans = 0\nfor i in range(n):\n ans += ((l[i]*sum(l[i+1:n]))%1000000007\nprint(ans%1000000007)', 'n = int(input())\nl = list(map(int,input().split()))\nans = 0\nsum_n = [0]*n\nsum_n[0] = l[0]\nsumall = sum(l)\nfor i in range(1,n):\n sum_n[i] = sum_n[i-1] + l[i... | ['Runtime Error', 'Accepted'] | ['s428341828', 's073612168'] | [9000.0, 31356.0] | [28.0, 181.0] | [144, 249] |
p02572 | u820685137 | 2,000 | 1,048,576 | Given are N integers A_1,\ldots,A_N. Find the sum of A_i \times A_j over all pairs (i,j) such that 1\leq i < j \leq N, modulo (10^9+7). | ['"""C."""\n\nimport sys\n\ninput = sys.stdin.readline \n\nn = int(input())\na = list(map(int, input()[:-1].split(\' \')))\n\nresult = 0\n\nfor i, v1 in enumerate(a):\n for j in range(i + 1, n + 1):\n result += v1 * a[j]\nprint(result)\n', '"""C."""\n\nimport sys\n\ninput = sys.stdin.readline \n\nn = int(in... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s368649406', 's646510548', 's610493383'] | [31412.0, 31352.0, 31708.0] | [102.0, 98.0, 121.0] | [241, 236, 311] |
p02572 | u825186577 | 2,000 | 1,048,576 | Given are N integers A_1,\ldots,A_N. Find the sum of A_i \times A_j over all pairs (i,j) such that 1\leq i < j \leq N, modulo (10^9+7). | ['N = int(input())\nA = map(int, input().split())\n\nans = 0\nmod = 10**9+7\n\nS = sum(A)\nS2 = sum(map(lambda x: x*x, A))\n\nprint((S*S-S2)//2 % mod)\n', 'n = int(input())\nA = list(map(int, input().split()))\n\nS = sum(A)\nS2 = sum(map(lambda x: x * x, A))\n\nprint((S*S-S2)//2 % 1000000007)'] | ['Wrong Answer', 'Accepted'] | ['s254723324', 's256821859'] | [25132.0, 31268.0] | [74.0, 100.0] | [140, 131] |
p02572 | u825343780 | 2,000 | 1,048,576 | Given are N integers A_1,\ldots,A_N. Find the sum of A_i \times A_j over all pairs (i,j) such that 1\leq i < j \leq N, modulo (10^9+7). | ['n = int(input())\na = list(map(int,input().split()))\n\nsums = 0\nfor i in range(n):\n sums += a[i]\n\nsums *= sums;\nans = sums;\n\nfor i in range(n):\n ans -= a[i]*a[i]\nans /= 2\n\nans %= 1000000007\nprint(ans)\n', '\n#include <string>\n\n#include <algorithm>\n#include <cmath>\n#include <iomanip>\n#include <... | ['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s583569381', 's680075858', 's726487358', 's792485878'] | [31428.0, 8940.0, 8936.0, 31556.0] | [140.0, 24.0, 22.0, 140.0] | [205, 1565, 770, 210] |
p02572 | u848097937 | 2,000 | 1,048,576 | Given are N integers A_1,\ldots,A_N. Find the sum of A_i \times A_j over all pairs (i,j) such that 1\leq i < j \leq N, modulo (10^9+7). | ['//g++ -std=gnu++14 a.cpp\n\n#include <algorithm>\n#include <bitset>\n#include <complex>\n#include <deque>\n\n#include <istream>\n#include <iterator>\n#include <map>\n\n#include <set>\n#include <stack>\n#include <string>\n\n#include <tuple>\n#include <iomanip>\n#include <random>\n#include <math.h>\n#include <stdio.h>\... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s196641244', 's990227349', 's728699439'] | [8768.0, 8896.0, 25056.0] | [25.0, 26.0, 160.0] | [1469, 1469, 179] |
p02572 | u848312584 | 2,000 | 1,048,576 | Given are N integers A_1,\ldots,A_N. Find the sum of A_i \times A_j over all pairs (i,j) such that 1\leq i < j \leq N, modulo (10^9+7). | ['N = int(input())\nA = list(map(int, input().split()))\nans = 0\nmod = 1e9 + 7\ns = sum(A) % mod\n\nfor i in range(N):\n s -= A[i]\n ans += (A[i] * s) % mod\n ans = ans % mod\nprint(ans)', 'N = int(input())\nA = list(map(int, input().split()))\n\nans = 0\nmod = int(1e9 + 7)\ns = sum(A) % mod\n\nfor a in A:\n ... | ['Wrong Answer', 'Accepted'] | ['s268974614', 's063216514'] | [31412.0, 31536.0] | [172.0, 149.0] | [184, 178] |
p02572 | u849559474 | 2,000 | 1,048,576 | Given are N integers A_1,\ldots,A_N. Find the sum of A_i \times A_j over all pairs (i,j) such that 1\leq i < j \leq N, modulo (10^9+7). | ['n = int(input())\nmod = 10 ** 9 + 7\nimport numpy as np\na = np.array(map(int, input().split())\ns=0\nss=0\nfor i in range(n):\n ss += a[i]%mod\n s += ss * a[i] % mod\nprint(s)', 'n = int(input())\nmod = 10 ** 9 + 7\nimport numpy as np\na = np.array(map(int, input().split())\ns=0\nss=0\nfor i in range(n):\n ss +... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s291732569', 's298496334', 's379822705', 's617450151', 's999542040'] | [8908.0, 9000.0, 8916.0, 49992.0, 49812.0] | [21.0, 27.0, 26.0, 235.0, 249.0] | [169, 173, 170, 171, 195] |
p02572 | u852790844 | 2,000 | 1,048,576 | Given are N integers A_1,\ldots,A_N. Find the sum of A_i \times A_j over all pairs (i,j) such that 1\leq i < j \leq N, modulo (10^9+7). | ['import sys\nimport numpy as np\n\nreadline = sys.stdin.readline\nread = sys.stdin.read\nMOD = 10**9 + 7\n\nn = int(input())\na = np.array(readline().split(), dtype=np.uint64)\nr = np.cumsum(a[::-1])[::-1]\nr &= MOD\nx = a[:-1] * r[1:]\nx %= MOD\nans = np.sum(x) % MOD\nprint(ans)', 'import sys\nimport numpy as np\n\nr... | ['Wrong Answer', 'Accepted'] | ['s040278510', 's163561847'] | [52632.0, 52772.0] | [169.0, 184.0] | [265, 270] |
p02572 | u854931881 | 2,000 | 1,048,576 | Given are N integers A_1,\ldots,A_N. Find the sum of A_i \times A_j over all pairs (i,j) such that 1\leq i < j \leq N, modulo (10^9+7). | ['n=int(input())\na=list(map(int,input().split()))\nx=0\nfor i in range(0,n-1):\n x+=a[i]\ny=0\nfor j in range(1,n):\n y+=a[j]\nz=x+y\nprint(z%(10**9+7))', 'n=int(input())\na=list(map(int,input().split()))\nx=0\nfor i in range(n):\n x+=a[i]\nx=x**2\ny=0\nfor j in range(n):\n y=a[j]**2\nz=(x-y)//2\nprint(z%(10**9+7)... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s028332297', 's035092210', 's040693642', 's355715748', 's755061576', 's882687054', 's891634191', 's911034543', 's605629606'] | [31392.0, 31600.0, 31304.0, 31512.0, 31488.0, 31716.0, 31488.0, 9112.0, 31544.0] | [124.0, 152.0, 157.0, 76.0, 2206.0, 184.0, 2206.0, 22.0, 134.0] | [144, 152, 153, 98, 145, 191, 179, 143, 144] |
p02572 | u856636328 | 2,000 | 1,048,576 | Given are N integers A_1,\ldots,A_N. Find the sum of A_i \times A_j over all pairs (i,j) such that 1\leq i < j \leq N, modulo (10^9+7). | ['n = int(input())\nl = list(map(int,input().split()))\ns = 0\ns1 = sum(l)\nfor x in range(n-1):\n s+=l[x]*(s1-l[x])\nprint(s%1000000007)\n', 'n = int(input())\nl = list(map(int,input().split()))\ns = 0\ns1 = sum(l)\na = 0\nfor x in range(n-1):\n s+=(l[x]*(s1-l[x]-a))\n a+=l[x]\nprint(s%1000000007)\n'] | ['Wrong Answer', 'Accepted'] | ['s923419282', 's710168281'] | [31368.0, 31588.0] | [124.0, 147.0] | [131, 151] |
p02572 | u857605629 | 2,000 | 1,048,576 | Given are N integers A_1,\ldots,A_N. Find the sum of A_i \times A_j over all pairs (i,j) such that 1\leq i < j \leq N, modulo (10^9+7). | ['n = int(input())\na = map(int,input().split())\ntemp = sum(a)**2\nfor x in a:\n temp -= x**2\nprint(temp//2)', 'n = int(input())\na = map(int,input().split())\nmod = 10**9 + 7\ntemp = sum(a)**2\nfor x in a:\n temp -= x**2\nprint((temp//2)%mod)', 'n = int(input())\na = list(map(int,input().split()))\nmod = 10**9 + 7... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s317763096', 's611016872', 's055863240'] | [25140.0, 25316.0, 31500.0] | [72.0, 69.0, 142.0] | [104, 126, 131] |
p02572 | u857673087 | 2,000 | 1,048,576 | Given are N integers A_1,\ldots,A_N. Find the sum of A_i \times A_j over all pairs (i,j) such that 1\leq i < j \leq N, modulo (10^9+7). | ['n = int(input())\na = list(map(int,input().split()))\n\nmod= 10**9+7\n\nA = sum(a)\n\nans=0\n\nfor i in a:\n A -= i\n A%=mod\n ans += A*x\n ans%=mod\nprint(ans)\n \n', 'n = int(input())\na = list(map(int,input().split()))\n\nmod= 10**9+7\n\nA = sum(a)\n\nans=0\n\nfor i in a:\n A -= i\n A%=mod\n ans += A*i\n ... | ['Runtime Error', 'Accepted'] | ['s363870643', 's043084410'] | [31436.0, 31616.0] | [74.0, 142.0] | [154, 154] |
p02572 | u860002137 | 2,000 | 1,048,576 | Given are N integers A_1,\ldots,A_N. Find the sum of A_i \times A_j over all pairs (i,j) such that 1\leq i < j \leq N, modulo (10^9+7). | ['n = int(input())\narr = list(map(int, input().split()))\n\nans = 0\nsum_arr = sum(arr)\n\nfor x in arr:\n ans += x * (sum_arr - x) // 2\n ans %= MOD\n\nprint(ans)', 'n = int(input())\narr = list(map(int, input().split()))\n\nMOD = 10**9 + 7\n\nans = 0\nsum_arr = sum(arr)\n\nfor x in arr:\n ans += x * (sum_ar... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s386924365', 's789613022', 's313866111'] | [31440.0, 31620.0, 31616.0] | [80.0, 146.0, 148.0] | [158, 175, 181] |
p02572 | u861886710 | 2,000 | 1,048,576 | Given are N integers A_1,\ldots,A_N. Find the sum of A_i \times A_j over all pairs (i,j) such that 1\leq i < j \leq N, modulo (10^9+7). | ['N = int(input())\nA = list(map(int, input().split()))\nsum_A = sum(A)\nans = 0\n\nfor i in range(N):\n sum_A = sum_A - A[i]\n ans += A[i] * sum_A\n \nprint(ans//(10^9 + 7))\n ', 'import numpy as np\n\nN = int(input())\nA = list(map(int, input().split()))\n\nB = np.array(A)\n\na = 0\nfor i in range(N):\n a += A... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s257324538', 's394409251', 's577727020'] | [31524.0, 49996.0, 31664.0] | [129.0, 219.0, 125.0] | [169, 174, 181] |
p02572 | u864090097 | 2,000 | 1,048,576 | Given are N integers A_1,\ldots,A_N. Find the sum of A_i \times A_j over all pairs (i,j) such that 1\leq i < j \leq N, modulo (10^9+7). | ['N = int(input())\nA = list(map(int ,input().split()))\nMOD = 1e9+7\n\nsum = 0\nfor i in range (N):\n sum += A[i]\n\nans = 0\nfor i in range(N):\n sum -= A[i]\n ans += (A[i] * sum) % MOD\n\nans = ans % MOD\nprint(ans)', 'import math\n\nN = int(input())\nA = list(map(int ,input().split()))\nMOD = math.floor(1e... | ['Wrong Answer', 'Accepted'] | ['s034449639', 's193047893'] | [31472.0, 32848.0] | [188.0, 168.0] | [211, 242] |
p02572 | u865343871 | 2,000 | 1,048,576 | Given are N integers A_1,\ldots,A_N. Find the sum of A_i \times A_j over all pairs (i,j) such that 1\leq i < j \leq N, modulo (10^9+7). | ['from numpy.core import double\n\nN = int(input())\nA = list(map(int,input().split()))\nMOD = 1000000007\nSUM = 0\nfor i in range(N-1):\n j=i+1\n for j in range(N):\n SUM += A[i] * A[j] % MOD\nprint(SUM)', 'N = int(input())\nA = list(map(int,input().split()))\nMOD = 1000000007\nSUM = 0\nfor i in range(N-1... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s718994630', 's751313225', 's825609252'] | [49744.0, 31588.0, 31520.0] | [2207.0, 2206.0, 138.0] | [205, 174, 184] |
p02572 | u866949333 | 2,000 | 1,048,576 | Given are N integers A_1,\ldots,A_N. Find the sum of A_i \times A_j over all pairs (i,j) such that 1\leq i < j \leq N, modulo (10^9+7). | ["def main():\n N = int(input())\n A = list(map(int, input().split()))\n\n mod = 10**9 + 7\n\n tmp = [0] * N\n\n s = 0\n for i in range(N):\n tmp[- i - 1] = s\n s += A[-i - 1]\n\n print(tmp)\n\n ans = 0\n for i in range(N):\n ans += A[i] * tmp[i]\n\n print(ans % mod)\n... | ['Wrong Answer', 'Accepted'] | ['s391158779', 's499132369'] | [35888.0, 31688.0] | [159.0, 131.0] | [338, 340] |
p02572 | u869820398 | 2,000 | 1,048,576 | Given are N integers A_1,\ldots,A_N. Find the sum of A_i \times A_j over all pairs (i,j) such that 1\leq i < j \leq N, modulo (10^9+7). | ['n = int(input())\na = [int(i) for i in input().split()]\n\nsum1 = 0\nsum2 = 0\n\nfor _ in a:\n sum1 += _\n sum2 += (_*_)\nsum1 = (sum1 * sum1)\nprint(sum1 - sum2)\n', 'n = int(input())\na = [int(i) for i in input().split()]\n\nsum1 = 0\nsum2 = 0\n\nfor _ in a:\n sum1 += _\n sum2 += (a*a)\nsum1 = (sum1 * sum1)\npr... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s246269029', 's735555054', 's906123581'] | [31408.0, 31744.0, 31436.0] | [123.0, 81.0, 125.0] | [155, 154, 173] |
p02572 | u872271866 | 2,000 | 1,048,576 | Given are N integers A_1,\ldots,A_N. Find the sum of A_i \times A_j over all pairs (i,j) such that 1\leq i < j \leq N, modulo (10^9+7). | ['#include <bits/stdc++.h>\nusing namespace std;\n\nint main(){\n int N;\n long long ans = 0, sum =0;\n int mod = 1000000000+7;\n cin >> N;\n vector<int> a(N);\n for (int i = 0; i < N; i++) {\n cin >> a.at(i);\n sum += a.at(i);\n sum %= mod;\n }\n for (int i = 0; i < N; i++)... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s451075963', 's725881041', 's098389602'] | [9008.0, 8932.0, 30956.0] | [28.0, 23.0, 137.0] | [444, 433, 493] |
p02572 | u887152994 | 2,000 | 1,048,576 | Given are N integers A_1,\ldots,A_N. Find the sum of A_i \times A_j over all pairs (i,j) such that 1\leq i < j \leq N, modulo (10^9+7). | ['N=int(input())\nList = list(map(int, input().split()))\nS=0\nfor i in range(len(List)):\n S+=List[i]\nmod=10**9+7\nS=S%mod\nT=0\nfor i in range(len(List)):\n T+=List[i]*(S-List[i])\n T=T%mod\nprint(T/2)', 'N=int(input())\nList = list(map(int, input().split()))\nS=0\nfor i in range(len(List)):\n S+=List[i]... | ['Wrong Answer', 'Accepted'] | ['s432991820', 's684485142'] | [31532.0, 31600.0] | [161.0, 191.0] | [200, 223] |
p02572 | u893962649 | 2,000 | 1,048,576 | Given are N integers A_1,\ldots,A_N. Find the sum of A_i \times A_j over all pairs (i,j) such that 1\leq i < j \leq N, modulo (10^9+7). | ['N = int(input())\nA = list(map(int, input().split()))\n\nans = 0\nx = 0\n\nfor a in A:\n ans = (ans + a * x) % (1e9+7)\n x = (x + a) % (10e9+7)\n\nprint(ans)\n', 'N = int(input())\nA = list(map(int, input().split()))\n\nans = 0\nx = 0\n\nfor a in A:\n ans = (ans + a * x) % (1e9+7)\n x = (x + a) % (1e9+7)\... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s394102708', 's743826292', 's693859715'] | [31420.0, 31744.0, 31632.0] | [143.0, 148.0, 118.0] | [154, 153, 182] |
p02572 | u903005414 | 2,000 | 1,048,576 | Given are N integers A_1,\ldots,A_N. Find the sum of A_i \times A_j over all pairs (i,j) such that 1\leq i < j \leq N, modulo (10^9+7). | ['import sys\n\ninput = sys.stdin.buffer.readline\n\nN = int(input())\nA = list(map(int, input().split()))\nMOD = 10**9 + 7\n\ncumsum = [0]\nfor i in range(1, N):\n v = (A[0] * A[i]) % MOD\n cumsum.append((cumsum[-1] + v) % MOD)\nprint(cumsum)\n\nans = 0\nfor i in range(N):\n ans += (A[i] * (cumsum[-1] - cumsu... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s668045797', 's704646704', 's663995793'] | [30292.0, 354296.0, 29312.0] | [241.0, 2214.0, 129.0] | [341, 291, 266] |
p02572 | u904537833 | 2,000 | 1,048,576 | Given are N integers A_1,\ldots,A_N. Find the sum of A_i \times A_j over all pairs (i,j) such that 1\leq i < j \leq N, modulo (10^9+7). | ['import sys\nfrom itertools import combinations\n\ninput = sys.stdin.readline\n\nN = int(input())\nA = list(map(int,input().split()))\nB = list(combinations(A,2))\nsum = 0\nfor i in range(len(B)):\n sum += B[i][0]*B[i][1]\n\n\n\n', 'import sys\ninput = sys.stdin.readline\n\ndef multipleSum(A, n):\n sum = 0\n ... | ['Wrong Answer', 'Accepted'] | ['s875046264', 's738173585'] | [2002936.0, 31304.0] | [2278.0, 109.0] | [217, 331] |
p02572 | u904811150 | 2,000 | 1,048,576 | Given are N integers A_1,\ldots,A_N. Find the sum of A_i \times A_j over all pairs (i,j) such that 1\leq i < j \leq N, modulo (10^9+7). | ['ans = 0\n\nfor i in range(N-1):\n for j in range(i+1, N):\n print(i, j)\n ans += ((A[i]% (10**9 + 7))*(A[j]% (10**9 + 7))) % (10**9 + 7)\n \nprint(ans % (10**9 + 7))', 'N = int(input())\nA = [int(i) for i in input().split()]\nS = []\ne = 0\nfor i in A:\n e += i\n S.append(e)\n \nans =... | ['Runtime Error', 'Accepted'] | ['s966061756', 's162849634'] | [9116.0, 31492.0] | [26.0, 179.0] | [182, 220] |
p02572 | u907865484 | 2,000 | 1,048,576 | Given are N integers A_1,\ldots,A_N. Find the sum of A_i \times A_j over all pairs (i,j) such that 1\leq i < j \leq N, modulo (10^9+7). | ['MOD = 1000000007\n\nN = input()\nn_list = list(map(int,input().split()))\n\nprint(n_list)\n\nresult = 0\n\nfor i in range(n):\n for j in range(n-i-1)\n result += n_list[i] * n_list[j+1] % MOD\n result = result % MOD\n\nprint(result)\n', '\nN = int(input())\nn_list = list(map(int,input().split()))\n\n... | ['Runtime Error', 'Accepted'] | ['s222152804', 's452329977'] | [8644.0, 31548.0] | [24.0, 143.0] | [236, 189] |
p02572 | u909224749 | 2,000 | 1,048,576 | Given are N integers A_1,\ldots,A_N. Find the sum of A_i \times A_j over all pairs (i,j) such that 1\leq i < j \leq N, modulo (10^9+7). | ['import numpy as np\n \nN = int(input())\nA = np.array(map(int, input().split()))\n \nA %= (1000000000+7)\n_sum = 0\n \nfor n in range(N-1):\n for i in range(n+1):\n _sum += A[n+1] * A[i]\n _sum %= (1000000000+7)\n \nprint(_sum)', '\nN = int(input())\nA = list(map(int, input().split()))\n \n\nS = [0]*N\nfor ... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s105677981', 's381277308', 's444512003', 's549552930', 's803683852', 's916522971', 's010024338'] | [44008.0, 31576.0, 31384.0, 8960.0, 31600.0, 31644.0, 31760.0] | [130.0, 110.0, 117.0, 22.0, 114.0, 117.0, 168.0] | [224, 258, 251, 223, 248, 266, 259] |
p02572 | u910358825 | 2,000 | 1,048,576 | Given are N integers A_1,\ldots,A_N. Find the sum of A_i \times A_j over all pairs (i,j) such that 1\leq i < j \leq N, modulo (10^9+7). | ['import numpy\nn=input()\nl=list(map(int, input().split()))\nres=0\n#print(f"le{len(l)}")\nl.append(0)\nl.reverse()\nfor i in range(len(l)): \n print(l[len(l)-1-i],numpy.cumsum(l)[len(l)-i-2])\n res+=l[len(l)-1-i]*numpy.cumsum(l)[len(l)-i-2]\n print(f"{res}レス")\nprint(res%(10**9+7))\n#print(res)', 'import num... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s309051117', 's664897348', 's146024294'] | [49752.0, 50244.0, 49820.0] | [2207.0, 2207.0, 328.0] | [296, 297, 200] |
p02572 | u910536093 | 2,000 | 1,048,576 | Given are N integers A_1,\ldots,A_N. Find the sum of A_i \times A_j over all pairs (i,j) such that 1\leq i < j \leq N, modulo (10^9+7). | ['n = int(input())\n\na = (list(map(int, input().split())))\n\nans = 0\n\nfor i in range(n):\n for j in range(i+1, n):\n ans += a[i] * a[j]\n print("i, j, a[i], a[j] = {}, {}, {}, {}".format(i, j, a[i], a[j]))\n\nprint(ans % (10 ** 9 + 7))\n', 'n = int(input())\n\na = list(map(int, input().split()))\n\... | ['Wrong Answer', 'Accepted'] | ['s973506402', 's053419177'] | [129340.0, 31464.0] | [5910.0, 89.0] | [244, 152] |
p02572 | u914693053 | 2,000 | 1,048,576 | Given are N integers A_1,\ldots,A_N. Find the sum of A_i \times A_j over all pairs (i,j) such that 1\leq i < j \leq N, modulo (10^9+7). | ['n=int(input())\na=list(map(int,input().split()))\nl=list(map(lambda z:z**2,a))\nx=sum(a)\ny=sum(l)\nt=(x-y)//2\nprint(t)\n', 'n=int(input())\na=list(map(int,input().split()))\nif n==1:\nprint(a[0])\nelse:\nl=list(map(lambda z:z**2,a)\nx=sum(a)\ny=sum(l)\nt=(x-y)//2\nprint(t)', 'n=int(input())\na=list(map(int,input().... | ['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s057984226', 's553906763', 's634282369', 's646523687', 's753347907', 's922011393', 's254831510'] | [31764.0, 8896.0, 8956.0, 31648.0, 9016.0, 31596.0, 31520.0] | [129.0, 27.0, 25.0, 129.0, 29.0, 137.0, 128.0] | [115, 140, 114, 154, 196, 170, 173] |
p02572 | u917678406 | 2,000 | 1,048,576 | Given are N integers A_1,\ldots,A_N. Find the sum of A_i \times A_j over all pairs (i,j) such that 1\leq i < j \leq N, modulo (10^9+7). | ['N = int(input())\nNUM = 1000000007\nA = [list(map(int, input().split())) for _ in range(N)]\nMASS = 0\nfor i in range (N):\n I = A[i] % NUM\n I = (I * (N - 1)) % NUM\n MASS += I\nprint(MASS % NUM)', 'N = int(input())\nNUM = 1000000007\nA = [int(input()) for _ in range(N)]\nMASS = 0\nfor i in range (N):\n ... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s131677751', 's311152729', 's415298548', 's440047873'] | [31384.0, 13228.0, 8976.0, 31588.0] | [75.0, 42.0, 25.0, 112.0] | [197, 178, 198, 168] |
p02572 | u917872021 | 2,000 | 1,048,576 | Given are N integers A_1,\ldots,A_N. Find the sum of A_i \times A_j over all pairs (i,j) such that 1\leq i < j \leq N, modulo (10^9+7). | ['n = int(input())\na_list = list(map(int, input().split()))\n\nMOD = (10**9)+7\na_sum = 0\nans = 0\nfor i in range(n-1):\n a_sum += a_list[n-i-1]\n print(a_sum)\n ans += a_sum * a_list[n-i-2]\n ans = ans % MOD\n\nprint(ans)\n', 'n = int(input())\na_list = list(map(int, input().split()))\n\nMOD = (10**9)+7\... | ['Wrong Answer', 'Accepted'] | ['s133117243', 's632472189'] | [31744.0, 31552.0] | [235.0, 172.0] | [223, 206] |
p02572 | u922299074 | 2,000 | 1,048,576 | Given are N integers A_1,\ldots,A_N. Find the sum of A_i \times A_j over all pairs (i,j) such that 1\leq i < j \leq N, modulo (10^9+7). | ['N=input()\nA=list(map(int,input().split()))\ncount1=0\ncount2=0\nfor a in A[0:]:\n count1=count1+a\n count2=count2+a**2\n\nB=(count1**2-count2)/2\nC=B%(10**9+7)\nprint(C)', 'N=input()\nA=list(map(int,input().split()))\ncount1=0\ncount2=0\nfor a in A[0:]:\n count1=count1+a\n count2=count2+a**2\n\nB=(count1... | ['Wrong Answer', 'Accepted'] | ['s547795021', 's325836653'] | [31756.0, 31540.0] | [149.0, 140.0] | [166, 167] |
p02572 | u923279197 | 2,000 | 1,048,576 | Given are N integers A_1,\ldots,A_N. Find the sum of A_i \times A_j over all pairs (i,j) such that 1\leq i < j \leq N, modulo (10^9+7). | ['n = int(input())\nmod = 10**9+ 7\na = list(map(int,input().split()))\nans = (sum(a)%mod)**2 - (sum[x**2 for x in a]%mod)\nans *= 5*10**8+4\nans %= mod\nprint(ans)', 'n = int(input())\nmod = 10**9+ 7\na = list(map(int,input().split()))\nans = (sum(a)%mod)**2 - sum([x**2%mod for x in a])\nans *= 5*10**8+4\nans %= mod\n... | ['Runtime Error', 'Accepted'] | ['s802456829', 's797192279'] | [9028.0, 31628.0] | [24.0, 134.0] | [156, 156] |
p02572 | u924828749 | 2,000 | 1,048,576 | Given are N integers A_1,\ldots,A_N. Find the sum of A_i \times A_j over all pairs (i,j) such that 1\leq i < j \leq N, modulo (10^9+7). | ['n = int(input())\na = [int(x) for x in input().split()]\n\nb = [0]\nfor i in range(1,n+1):\n b.append((a[i-1] + b[i-1]) % ((10 ** 9) + 7))\nprint(b)\n\nans = 0\nfor i in range(n):\n p = b[n] - b[i+1]\n p = a[i] * p % (10**9 + 7)\n ans += p\n print(ans,p)\nprint(ans)', 'n = int(input())\na = [int(x) for x in inpu... | ['Wrong Answer', 'Accepted'] | ['s828493745', 's837769571'] | [31360.0, 31492.0] | [350.0, 248.0] | [257, 263] |
p02572 | u926266624 | 2,000 | 1,048,576 | Given are N integers A_1,\ldots,A_N. Find the sum of A_i \times A_j over all pairs (i,j) such that 1\leq i < j \leq N, modulo (10^9+7). | ['N = int(input())\nA = list(map(int, input().split()))\n\nM = 0\nsum = 0\nfor i in range(N):\n sum += A[i]\n\nfor i in range(N-1):\n JM =0\n for j in range(i+1,N):\n sum = sum - A[i]\n M += A[i] * sum\n if M > 10 ** 9 + 7:\n M = M % (10 ** 9 + 7)\nprint(M)', 'N = int(input())\nA = list(map(int, input(... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s365659040', 's824272022', 's142752644'] | [31432.0, 31544.0, 31612.0] | [2206.0, 2206.0, 174.0] | [257, 186, 216] |
p02572 | u928758473 | 2,000 | 1,048,576 | Given are N integers A_1,\ldots,A_N. Find the sum of A_i \times A_j over all pairs (i,j) such that 1\leq i < j \leq N, modulo (10^9+7). | ['import os\nimport sys\nfrom collections import defaultdict, Counter\nfrom itertools import product, permutations,combinations, accumulate\nfrom operator import itemgetter\nfrom bisect import bisect_left,bisect\nfrom heapq import heappop,heappush,heapify\nfrom math import ceil, floor, sqrt\nfrom copy import deepcopy\n... | ['Runtime Error', 'Accepted'] | ['s800057376', 's939728093'] | [50068.0, 32052.0] | [158.0, 111.0] | [564, 635] |
p02572 | u934868410 | 2,000 | 1,048,576 | Given are N integers A_1,\ldots,A_N. Find the sum of A_i \times A_j over all pairs (i,j) such that 1\leq i < j \leq N, modulo (10^9+7). | ['n = int(input())\na = list(map(int,input().split()))\nmod = 10**9 + 7\ns = sum(a)\nans = 0\nfor x in a:\n ans += (s-x) * x\n ans %= mod\nprint(ans)', 'n = int(input())\na = list(map(int,input().split()))\nmod = 10**9 * 7\ns = sum(a)\nans = 0\nfor x in a:\n ans += (s-x) * x\n ans %= mod\nprint(ans)', 'n = int(inpu... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s363514438', 's645341142', 's852977570'] | [31420.0, 31588.0, 31444.0] | [125.0, 140.0, 122.0] | [141, 141, 192] |
p02572 | u938785734 | 2,000 | 1,048,576 | Given are N integers A_1,\ldots,A_N. Find the sum of A_i \times A_j over all pairs (i,j) such that 1\leq i < j \leq N, modulo (10^9+7). | ['import numpy as np\nans=0\nn=int(input())\nli=list(map(int,input().split()))\nfor i in range(1,n):\n L=li\n k=np.cumsum(L[:i])\n ans+=k*li[i]\nprint(ans%(10**9+7))', 'import itertools\nans=0\nn=int(input())\nli=list(map(int,input().split()))\nL=list(itertools.accumulate(li))\nfor i in range(1,n):\n ans+=L... | ['Runtime Error', 'Accepted'] | ['s707745598', 's264415715'] | [50024.0, 31096.0] | [163.0, 131.0] | [164, 168] |
p02572 | u939790872 | 2,000 | 1,048,576 | Given are N integers A_1,\ldots,A_N. Find the sum of A_i \times A_j over all pairs (i,j) such that 1\leq i < j \leq N, modulo (10^9+7). | ['N = int(input())\nA = list(map(int, input().split()))\nans=0\nfor i in range(N):\n ans+=(sum(A)-A[i])*A[i]\nprint((ans/2)%(10**9+7))', 'N = int(input())\nA = list(map(int, input().split()))\n\nmod = 10 ** 9 + 7\nans = 0\n\nA_sum = [A[0] for i in range(N)]\nfor i in range(1, N):\n A_sum[i] = A_sum[i-1] + A[i]\n\... | ['Wrong Answer', 'Accepted'] | ['s867800165', 's687544941'] | [31412.0, 31756.0] | [2206.0, 180.0] | [130, 248] |
p02572 | u942388574 | 2,000 | 1,048,576 | Given are N integers A_1,\ldots,A_N. Find the sum of A_i \times A_j over all pairs (i,j) such that 1\leq i < j \leq N, modulo (10^9+7). | ['# -*- coding: utf-8 -*-\n"""\nCreated on Sat Aug 29 22:19:15 2020\n\n@author: naoki\n"""\n\nN = int(input())\n\nA = list(map(int,input().split()))\n\ncount1 = 0\ncount2 = 0\ncount = 10**9 +7\nfor i in A:\n count1+=i\n\tcount1=count1%count\nfor j in A:\n count2 = j*(count1-j)%count + count2\n count1 = count1 ... | ['Runtime Error', 'Accepted'] | ['s856722163', 's913413663'] | [8884.0, 31452.0] | [24.0, 157.0] | [341, 323] |
p02572 | u944396627 | 2,000 | 1,048,576 | Given are N integers A_1,\ldots,A_N. Find the sum of A_i \times A_j over all pairs (i,j) such that 1\leq i < j \leq N, modulo (10^9+7). | ['def main():\n N=input()\n A=list(map(float, input().split()))\n\n mod_value = 10**9 + 7\n sum = 0\n for i in range(len(A)-1):\n for j in range(i+1,len(A)):\n sum = sum + A[i]*A[j] % mod_value\n print(sum % mod_value)\nmain()\n', '4\n141421356 17320508 22360679 244949', 'def main():\... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s536653443', 's785415477', 's737950772'] | [31440.0, 9004.0, 31464.0] | [2206.0, 26.0, 162.0] | [250, 36, 277] |
p02572 | u945065638 | 2,000 | 1,048,576 | Given are N integers A_1,\ldots,A_N. Find the sum of A_i \times A_j over all pairs (i,j) such that 1\leq i < j \leq N, modulo (10^9+7). | ['import itertools\nimport numpy as np\n\nMOD = 1000000007\nn = int(input())\nai = list(map(int,input().split()))\nans = 0\n\nfor v in itertools.permutations(ai, 2):\n print(v)\n ans += np.prod(v)\n \nprint(ans % MOD)', 'n = int(input())\na = list(map(int,input().split()))\n\nMOD = 10 ** 9 + 7\ns =sum(a) % MOD... | ['Wrong Answer', 'Accepted'] | ['s637840213', 's636254150'] | [49840.0, 31368.0] | [2222.0, 141.0] | [212, 180] |
p02572 | u947664173 | 2,000 | 1,048,576 | Given are N integers A_1,\ldots,A_N. Find the sum of A_i \times A_j over all pairs (i,j) such that 1\leq i < j \leq N, modulo (10^9+7). | ['n=int(input())\na=list(map(int,input().split()))\nans=0\nfor i in range(n):\n b=a[i]*sum(a[i+1:n])\n print(b)\n ans=ans+b\nprint(ans)', 'n=int(input())\na=list(map(int,input().split()))\nans=0\nfor i in range(n):\n b=a[i]*sum(a[i+1:n])\n print(b)\n ans=ans+b\nd=ans%(10**9+7)\nprint(d)', 'n=int(input... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s270672011', 's343794923', 's475964720'] | [31404.0, 31432.0, 31508.0] | [2206.0, 2206.0, 137.0] | [135, 149, 152] |
p02572 | u949327459 | 2,000 | 1,048,576 | Given are N integers A_1,\ldots,A_N. Find the sum of A_i \times A_j over all pairs (i,j) such that 1\leq i < j \leq N, modulo (10^9+7). | ['N = int(input())\nA = list(map(int,input().split()))\n\nA = A % (1*10**9 + 7)\nvalue = 0\nplus = 0\nans = 0\n\nfor i in range(N-1):\n for j in range(N-i-1):\n value = (A[i]*A[i+j+1]+value) % (1*10**9 + 7)\n \n\nprint(value)\n', 'N = int(input())\nA = list(map(int,input().split()))\n\nA_sum = sum(A)\n... | ['Runtime Error', 'Accepted'] | ['s716046544', 's001764970'] | [31652.0, 31552.0] | [70.0, 131.0] | [228, 189] |
p02572 | u952708174 | 2,000 | 1,048,576 | Given are N integers A_1,\ldots,A_N. Find the sum of A_i \times A_j over all pairs (i,j) such that 1\leq i < j \leq N, modulo (10^9+7). | ["def c_sum_of_product_of_pairs(MOD=10**9 + 7):\n import numpy\n N = int(input())\n A = [int(i) for i in input().split()]\n\n total = sum(A)\n cumsum = [0] + list(numpy.cumsum(A, dtype='int64'))\n return sum([(total - cumsum[i]) * A[i] for i in range(N)]) % MOD\n\nprint(c_sum_of_product_of_pairs())", ... | ['Wrong Answer', 'Accepted'] | ['s828217284', 's502204689'] | [51932.0, 39440.0] | [918.0, 140.0] | [306, 293] |
p02572 | u953020348 | 2,000 | 1,048,576 | Given are N integers A_1,\ldots,A_N. Find the sum of A_i \times A_j over all pairs (i,j) such that 1\leq i < j \leq N, modulo (10^9+7). | ['for i in range(N-1):\n tmp+=A[i]\n ans+=tmp*A[i+1]\nprint(ans%((10**9)+7))', 'import math\n\nN=int(input())\nA=list(map(int,input().split()))\nans=0\ntmp=0\n\nfor i in range(N-1):\n tmp+=A[i]\n ans+=tmp*A[i+1]\nprint(ans%((10**9)+7))'] | ['Runtime Error', 'Accepted'] | ['s424451849', 's734804504'] | [9068.0, 32744.0] | [28.0, 135.0] | [77, 151] |
p02572 | u953655640 | 2,000 | 1,048,576 | Given are N integers A_1,\ldots,A_N. Find the sum of A_i \times A_j over all pairs (i,j) such that 1\leq i < j \leq N, modulo (10^9+7). | ['N = int(input())\nA=list(map(int, input().split()))\nB=[A[N-1]]\n#print(B[0])\nfor i in range(len(A)-2):\n #print(i)\n b=B[i]+A[N-2-i]\n B.append(b)\nprint(B)\ntotal=0\nfor i in range(len(B)):\n total += A[i]*B[len(B)-1-i]\n\nprint(total%(10**9+7))\n #print(v)', 'N = int(input())\nA=list(map(int, input... | ['Wrong Answer', 'Accepted'] | ['s593573479', 's526340547'] | [35864.0, 31440.0] | [216.0, 193.0] | [261, 248] |
p02572 | u956318161 | 2,000 | 1,048,576 | Given are N integers A_1,\ldots,A_N. Find the sum of A_i \times A_j over all pairs (i,j) such that 1\leq i < j \leq N, modulo (10^9+7). | ['n = int(input())\na = list(map(int,input().split()))\nb=sum(a)\nscore=0\nfor i in range(len(a)):\n b -= a[i]\n score=a[i]*b\n \nprint(score%(10**9+7))', 'n = int(input())\na = list(map(int,input().split()))\nb=sum(a)\nscore=0\nfor i in range(len(a)):\n b -= a[i]\n score=a[i]*b\n \nprint(score)', 'n=int(input())... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s418161054', 's636022516', 's009861706'] | [31372.0, 31296.0, 31684.0] | [119.0, 117.0, 129.0] | [145, 135, 143] |
p02572 | u958103790 | 2,000 | 1,048,576 | Given are N integers A_1,\ldots,A_N. Find the sum of A_i \times A_j over all pairs (i,j) such that 1\leq i < j \leq N, modulo (10^9+7). | ['def square(list):\n return [i ** 2 for i in list]\nm = 1000000007\nn = int(input())\nA = list(map(int, input().split()))\nsq = square(A)\ns1 = sum(A)\ns2 = sum(sq)\n\nresult = (s1**2-s2)/2\nprint(result%m)', 'def square(list):\n return [i ** 2 for i in list]\nm = 1000000007\nn = int(input())\nA = list(map(int, ... | ['Wrong Answer', 'Accepted'] | ['s455089729', 's437755983'] | [31740.0, 31580.0] | [122.0, 121.0] | [198, 200] |
p02572 | u960080897 | 2,000 | 1,048,576 | Given are N integers A_1,\ldots,A_N. Find the sum of A_i \times A_j over all pairs (i,j) such that 1\leq i < j \leq N, modulo (10^9+7). | ["# Date [ 2020-08-29 21:10:46 ]\n\n# Author Koki_tkg\n\nimport sys\n# import math\n\n# import numpy as np\n# from decimal import Decimal\n# from numba import njit, i8, u1, b1 #JIT compiler\n# from itertools import combinations, product\n# from collections import Counter, deque, defaultdict\n\n\nMOD = 10 ** 9 + 7\nINF ... | ['Wrong Answer', 'Accepted'] | ['s953456398', 's769242804'] | [31300.0, 33036.0] | [162.0, 132.0] | [1215, 1253] |
p02572 | u961945062 | 2,000 | 1,048,576 | Given are N integers A_1,\ldots,A_N. Find the sum of A_i \times A_j over all pairs (i,j) such that 1\leq i < j \leq N, modulo (10^9+7). | ['N = int(input())\nA = list(map(int, input().split()))\n\nans = 0\nS = sum(A)\nfor i in range(N):\n S -= A[i]\n ans += A[i] * S\n\nans = ans % 10**9+7\n\nprint(int(ans))', 'N = int(input())\nA = list(map(int, input().split()))\n\nans = 0\nS = sum(A)\nfor i in range(N):\n S -= A[i]\n ans += A[i] * S\n\nans ... | ['Wrong Answer', 'Accepted'] | ['s932747743', 's929660857'] | [31512.0, 31536.0] | [141.0, 127.0] | [163, 165] |
p02572 | u966207392 | 2,000 | 1,048,576 | Given are N integers A_1,\ldots,A_N. Find the sum of A_i \times A_j over all pairs (i,j) such that 1\leq i < j \leq N, modulo (10^9+7). | ['N = int(input())\nA = list(map(int, input().split()))\ncnt=0\nfor i in range(1,N):\n cnt += i*(sum(A[i-1:]))\nprint(cnt%((10**9)+7))', 'N = int(input())\nA = list(map(int, input().split()))\nsum = sum(A)\ncnt = 0\nfor i in range(N-1):\n sum -= A[i]\n cnt += A[i]*sum\nprint(cnt%((10**9)+7))'] | ['Wrong Answer', 'Accepted'] | ['s563560332', 's415656176'] | [31668.0, 31612.0] | [2206.0, 131.0] | [130, 153] |
p02572 | u969081133 | 2,000 | 1,048,576 | Given are N integers A_1,\ldots,A_N. Find the sum of A_i \times A_j over all pairs (i,j) such that 1\leq i < j \leq N, modulo (10^9+7). | ['MOD = 10**9+7\nn = int(input())\na = list(map(int, input().split()))\n \nans = sum(a)**2\nfor i in range(n):\n ans -= a[i]*a[i]\nans /= 2\nans %= MOD\nprint(ans)', 'n=int(input())\na=list(map(int,input().split()))\nans=sum(a)*sum(a)\nfor i in range(n):\n ans-=a[i]*a[i]\nans/=2\nmod=10**9+7\nans//=mod\nprint(ans)'... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s322782460', 's366518322', 's464924017', 's512917672', 's537174039', 's581122215', 's726470895', 's787146100', 's839760183', 's978343792', 's297498019'] | [31444.0, 31424.0, 31608.0, 31388.0, 31340.0, 549156.0, 31616.0, 31752.0, 550972.0, 550192.0, 31612.0] | [108.0, 110.0, 113.0, 113.0, 113.0, 2223.0, 2206.0, 2206.0, 2227.0, 2223.0, 111.0] | [155, 141, 141, 151, 140, 248, 163, 162, 252, 250, 141] |
p02572 | u970082363 | 2,000 | 1,048,576 | Given are N integers A_1,\ldots,A_N. Find the sum of A_i \times A_j over all pairs (i,j) such that 1\leq i < j \leq N, modulo (10^9+7). | ['n,m = (int(x) for x in input().split())\nfriendlist = [0]*n\nclasses = 1\nfor i in range(m):\n a,b = (int(x)-1 for x in input().split())\n if friendlist[a]!=0 and friendlist[b]!=0:\n continue\n elif friendlist[a]!=0:\n friendlist[b] = friendlist[a]\n elif friendlist[b]!=0:\n friendlis... | ['Runtime Error', 'Accepted'] | ['s565546941', 's846163202'] | [9220.0, 31364.0] | [22.0, 133.0] | [559, 160] |
p02572 | u974918235 | 2,000 | 1,048,576 | Given are N integers A_1,\ldots,A_N. Find the sum of A_i \times A_j over all pairs (i,j) such that 1\leq i < j \leq N, modulo (10^9+7). | ['N = int(input())\nA = list(map(int, input().split()))\nS = [A[0]]\nfor i in range(1, N):\n S.append(S[i-1] + A[i])\nprint(S)\nx = 0\nfor i in range(N):\n x += (A[i] * (S[-1] - S[i])) % 1000000007\nx = x % 1000000007\nprint(x)', 'N = int(input())\nA = list(map(int, input().split()))\nS = [A[0]]\nfor i in range(1, N)... | ['Wrong Answer', 'Accepted'] | ['s463287951', 's209432753'] | [35788.0, 31576.0] | [206.0, 189.0] | [217, 208] |
p02572 | u981931040 | 2,000 | 1,048,576 | Given are N integers A_1,\ldots,A_N. Find the sum of A_i \times A_j over all pairs (i,j) such that 1\leq i < j \leq N, modulo (10^9+7). | ['N = int(input())\n# N = 2 * 10 ** 5\nA = tuple(map(int, input().split()))\n# A = [10 ** 9] * N\nMOD = 10 ** 9 + 7\nrev_sum_list = [0] * N\nrev_sum_list[-1] = A[-1]\nfor i in range(N - 2, -1, -1):\n rev_sum_list[i] = (rev_sum_list[i + 1] + A[i]) % MOD\nprint(rev_sum_list)\nans = 0\nfor i in range(1, N):\n ans +=... | ['Wrong Answer', 'Accepted'] | ['s793061662', 's750277912'] | [31952.0, 31904.0] | [212.0, 194.0] | [359, 361] |
p02572 | u987637902 | 2,000 | 1,048,576 | Given are N integers A_1,\ldots,A_N. Find the sum of A_i \times A_j over all pairs (i,j) such that 1\leq i < j \leq N, modulo (10^9+7). | ['N = int(input())\nA = list(map(int, input().split()))\nmod = 10 ** 9 + 7\nct = 0\nn = N - 1\nfor i in range(n):\n for j in range(i+1, N):\n print(A[i])\n print(A[j])\n x = A[i] * A[j]\n ct += x\nprint((ct % mod))\n', '# C\u3000Sum of product of pairs\nN = int(input())\nA = list(map(int,... | ['Wrong Answer', 'Accepted'] | ['s486136064', 's977261245'] | [68516.0, 31692.0] | [2293.0, 134.0] | [233, 226] |
p02572 | u999327182 | 2,000 | 1,048,576 | Given are N integers A_1,\ldots,A_N. Find the sum of A_i \times A_j over all pairs (i,j) such that 1\leq i < j \leq N, modulo (10^9+7). | ['ans = 0\nN = int(input())\narray = list(map(int, input().split()))\nx = sum(array)\nfor i in range(N):\n ans += array[i] * (x -arrau[i])\nprint(int(ans/2)%(10**9+7))', 'N = int(input())\nA = list(map(int, input().split()))\n \nans = 0\nx = sum(A)\n \nfor i in range(N - 1):\n x -= A[i]\n ans += A[i] * x\n ... | ['Runtime Error', 'Accepted'] | ['s705268501', 's966728076'] | [31476.0, 31596.0] | [78.0, 127.0] | [162, 176] |
p02573 | u015767468 | 2,000 | 1,048,576 | There are N persons called Person 1 through Person N. You are given M facts that "Person A_i and Person B_i are friends." The same fact may be given multiple times. If X and Y are friends, and Y and Z are friends, then X and Z are also friends. There is no friendship that cannot be derived from the M given facts. Ta... | ['N,M=list(map(int,input().split()))\nX=[]\nfor i in range(M):\n X.append(list(map(int,input().split())))\ndic={i:[i] for i in range(1,N+1)}\nfor i in range(M):\n if X[i][1] not in dic[X[i][0]]:\n dic[X[i][0]].append(X[i][1])\n if X[i][0] not in dic[X[i][1]]:\n dic[X[i][1]].append(X[i][0])\nc=1\n... | ['Wrong Answer', 'Accepted'] | ['s348280196', 's650187312'] | [104680.0, 50060.0] | [2208.0, 876.0] | [374, 780] |
p02573 | u061140245 | 2,000 | 1,048,576 | There are N persons called Person 1 through Person N. You are given M facts that "Person A_i and Person B_i are friends." The same fact may be given multiple times. If X and Y are friends, and Y and Z are friends, then X and Z are also friends. There is no friendship that cannot be derived from the M given facts. Ta... | ['import sys\nn, m = map(int, input().split())\ninfo = [tuple(map(int, s.split())) for s in sys.stdin.readlines()]\n\npars = [-1]*n\n\ndef get_root(x):\n if pars[x] < 0:\n return x\n else:\n pars[x] = get_root(pars[x])\n return pars[x]\n\ndef combine(x, y):\n if x == y:\n return\n ... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s024194035', 's374973957', 's550106561'] | [50156.0, 9096.0, 50264.0] | [322.0, 26.0, 429.0] | [609, 573, 746] |
p02573 | u085717502 | 2,000 | 1,048,576 | There are N persons called Person 1 through Person N. You are given M facts that "Person A_i and Person B_i are friends." The same fact may be given multiple times. If X and Y are friends, and Y and Z are friends, then X and Z are also friends. There is no friendship that cannot be derived from the M given facts. Ta... | ['#!/usr/bin/env python\n# coding: utf-8\n\n# In[140]:\n\n\ndef find(x):\n if par[x] < 0:\n return x\n else:\n par[x] = find(par[x])\n return par[x]\n\ndef unite(x,y):\n x = find(x)\n y = find(y)\n if x == y:\n return False\n if par[x] > par[y]:\n x,y = y,x\n par[... | ['Runtime Error', 'Accepted'] | ['s488708981', 's032147402'] | [9088.0, 14628.0] | [24.0, 741.0] | [611, 607] |
p02573 | u092650292 | 2,000 | 1,048,576 | There are N persons called Person 1 through Person N. You are given M facts that "Person A_i and Person B_i are friends." The same fact may be given multiple times. If X and Y are friends, and Y and Z are friends, then X and Z are also friends. There is no friendship that cannot be derived from the M given facts. Ta... | ['\nn, m = map(int, input().split()) \npar = [i for i in range(1, n + 1)] \n\n\n\n\ndef find(x):\n if par[x - 1] == x:\n return x\n else:\n par[x - 1] = find(par[x - 1])\n return par[x - 1]\n\n\n\ndef union(x, y):\n x = find(x)\n y = find(y)\n if x == y:\n return 0\n par[... | ['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s465245585', 's800387414', 's903383791', 's613363660'] | [24900.0, 17140.0, 17064.0, 40200.0] | [824.0, 735.0, 719.0, 653.0] | [1039, 1027, 1039, 819] |
p02573 | u100858029 | 2,000 | 1,048,576 | There are N persons called Person 1 through Person N. You are given M facts that "Person A_i and Person B_i are friends." The same fact may be given multiple times. If X and Y are friends, and Y and Z are friends, then X and Z are also friends. There is no friendship that cannot be derived from the M given facts. Ta... | ["'''\n \tWe can show that if u and v belong to the same connected component, then they are friends w/ each other\n \tSo everyone in a given connected component is friends with one another\n \tSo everyone in a given connected component must be separated into different groups\n\n \tIf we have a CC of with sz... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s263634011', 's637505266', 's285458456'] | [26532.0, 9012.0, 210860.0] | [2206.0, 28.0, 693.0] | [910, 823, 829] |
p02573 | u102655885 | 2,000 | 1,048,576 | There are N persons called Person 1 through Person N. You are given M facts that "Person A_i and Person B_i are friends." The same fact may be given multiple times. If X and Y are friends, and Y and Z are friends, then X and Z are also friends. There is no friendship that cannot be derived from the M given facts. Ta... | ['# from collections import defaultdict\nfrom collections import deque\nn, m = map(lambda x: int(x), input().split())\n\nuf = UnionFind(n)\n\nfor _ in range(m):\n a, b = map(lambda x: int(x), input().split())\n uf.union(a-1, b-1)\n \nprint(-min(uf.parent_indexes))', "# UnionFind\n\n\n\nclass UnionFind:\n de... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s094214977', 's224088982', 's907064176', 's175121785'] | [9416.0, 9076.0, 12216.0, 14872.0] | [27.0, 30.0, 885.0, 898.0] | [261, 2842, 1682, 1617] |
p02573 | u112007848 | 2,000 | 1,048,576 | There are N persons called Person 1 through Person N. You are given M facts that "Person A_i and Person B_i are friends." The same fact may be given multiple times. If X and Y are friends, and Y and Z are friends, then X and Z are also friends. There is no friendship that cannot be derived from the M given facts. Ta... | ['def root(x):\n if par[x] == x:\n return x\n par[x] = 1\n return par[x]\n\ndef union(x, y):\n rx = root(x)\n ry = root(y)\n if rx != ry:\n par[rx] = ry\n return 0\n \nn, m=map(int, input().split(" "))\npar = list(range(n + 1))\nfor i in range(m):\n a, b = map(int, input().split(" "))\n union(a, b)\n#... | ['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s043037704', 's087318715', 's091102342', 's218253999', 's359847025', 's555917095', 's616826728', 's704293034', 's326980072'] | [18508.0, 45420.0, 19084.0, 45336.0, 18520.0, 18692.0, 18492.0, 45180.0, 176024.0] | [550.0, 399.0, 585.0, 396.0, 632.0, 666.0, 449.0, 397.0, 706.0] | [456, 528, 462, 532, 456, 448, 478, 532, 576] |
p02573 | u113255362 | 2,000 | 1,048,576 | There are N persons called Person 1 through Person N. You are given M facts that "Person A_i and Person B_i are friends." The same fact may be given multiple times. If X and Y are friends, and Y and Z are friends, then X and Z are also friends. There is no friendship that cannot be derived from the M given facts. Ta... | ["N,M=map(int,input().split())\nList = []\nfor i in range (M):\n List.append(list(map(int, input().split())))\n\nclass UnionFind():\n def __init__(self, n):\n self.n = n\n self.parents = [-1] * n\n\n def find(self, x):\n if self.parents[x] < 0:\n return x\n else:\n ... | ['Runtime Error', 'Accepted'] | ['s953123381', 's687592857'] | [46968.0, 49972.0] | [628.0, 878.0] | [1267, 1403] |
p02573 | u124864167 | 2,000 | 1,048,576 | There are N persons called Person 1 through Person N. You are given M facts that "Person A_i and Person B_i are friends." The same fact may be given multiple times. If X and Y are friends, and Y and Z are friends, then X and Z are also friends. There is no friendship that cannot be derived from the M given facts. Ta... | ['from networkx import*;_,*n=map(str.split,open(0));print(max(map(len,[*connected_components(Graph(n))]),1,1))', 'from networkx import*;_,*n=map(str.split,open(0));print(max(map(len,[*connected_components(Graph(n))]),1,1))', 'l=lambda:map(int, input().split())\nn,m=l()\np=[-1]*n\ndef root(x):\n if p[x]<0:return x\n p... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s121363456', 's277352767', 's879596687'] | [309624.0, 309708.0, 13276.0] | [1705.0, 1726.0, 612.0] | [108, 108, 327] |
p02573 | u127499732 | 2,000 | 1,048,576 | There are N persons called Person 1 through Person N. You are given M facts that "Person A_i and Person B_i are friends." The same fact may be given multiple times. If X and Y are friends, and Y and Z are friends, then X and Z are also friends. There is no friendship that cannot be derived from the M given facts. Ta... | ["def main():\n from collections import defaultdict\n n, m, *ab, = map(int, open(0).read().split())\n f = defaultdict(lambda: set())\n for i, j in zip(ab[::2], ab[1::2]):\n f[i].add(j)\n f[j].add(i)\n\n group = []\n i = 1\n g = {i}\n nx = {i}\n checked = set()\n ans = 0\n ... | ['Wrong Answer', 'Accepted'] | ['s236332124', 's381280531'] | [108668.0, 57256.0] | [2209.0, 495.0] | [864, 879] |
p02573 | u137226361 | 2,000 | 1,048,576 | There are N persons called Person 1 through Person N. You are given M facts that "Person A_i and Person B_i are friends." The same fact may be given multiple times. If X and Y are friends, and Y and Z are friends, then X and Z are also friends. There is no friendship that cannot be derived from the M given facts. Ta... | ["import sys\n\ndef main():\n stdin = sys.stdin\n n, m = map(int, stdin.readline().split())\n\n par = [i for i in range(i)]\n size = [1] * n\n rank = [1] * n\n\n def find(x, par):\n if par[x] == x:\n return x\n else:\n return find(par[x], par)\n\n def unite(x, y)... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s509849890', 's968375264', 's253640398'] | [8864.0, 9192.0, 20192.0] | [31.0, 25.0, 354.0] | [815, 837, 840] |
p02573 | u153047519 | 2,000 | 1,048,576 | There are N persons called Person 1 through Person N. You are given M facts that "Person A_i and Person B_i are friends." The same fact may be given multiple times. If X and Y are friends, and Y and Z are friends, then X and Z are also friends. There is no friendship that cannot be derived from the M given facts. Ta... | ['class union:\n def __init__(self, box):\n self.r = []\n for i in range(box):\n self.r.append(-1)\n \n def root(self, x):\n if self.r[x] < 0:\n return x\n return self.r[x] = root(self.r[x])\n\n def add(self, a, b):\n a = root(a)\n b = root(b)\n if a == b:\n return False\n i... | ['Runtime Error', 'Accepted'] | ['s881904823', 's902792316'] | [9024.0, 14908.0] | [26.0, 740.0] | [621, 731] |
p02573 | u157232135 | 2,000 | 1,048,576 | There are N persons called Person 1 through Person N. You are given M facts that "Person A_i and Person B_i are friends." The same fact may be given multiple times. If X and Y are friends, and Y and Z are friends, then X and Z are also friends. There is no friendship that cannot be derived from the M given facts. Ta... | ['def main():\n n,m=map(int,input().split())\n uf=UnionFind(n)\n for a,b in (map(lambda x: int(x)-1, input().split()) for _ in range(m)):\n uf.union(a,b)\n print(max((uf.size(x) for x in uf.roots())))\n \nif __name__ == "__main__":\n main()', 'def main():\n n,m=map(int,input().split())\n ... | ['Runtime Error', 'Accepted'] | ['s460853859', 's550134633'] | [9020.0, 18420.0] | [27.0, 620.0] | [255, 1434] |
p02573 | u161693347 | 2,000 | 1,048,576 | There are N persons called Person 1 through Person N. You are given M facts that "Person A_i and Person B_i are friends." The same fact may be given multiple times. If X and Y are friends, and Y and Z are friends, then X and Z are also friends. There is no friendship that cannot be derived from the M given facts. Ta... | ["import sys, re, os\nfrom collections import deque, defaultdict, Counter\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd\nfrom itertools import permutations, combinations, product, accumulate\nfrom operator import itemgetter, mul\nfrom copy import deepcopy\nfrom string import ascii_lowercase... | ['Runtime Error', 'Accepted'] | ['s346585620', 's561982916'] | [9096.0, 15540.0] | [24.0, 564.0] | [2719, 2705] |
p02573 | u170839742 | 2,000 | 1,048,576 | There are N persons called Person 1 through Person N. You are given M facts that "Person A_i and Person B_i are friends." The same fact may be given multiple times. If X and Y are friends, and Y and Z are friends, then X and Z are also friends. There is no friendship that cannot be derived from the M given facts. Ta... | ['from collections import Counter\n\n\nN, M = map(int, input().split())\nparent = [-1] * N\n\n\ndef union(x, y):\n x = find(x)\n y = find(y)\n if x == y:\n return\n parent[x] = y\n\n\ndef find(x):\n if parent[x] == -1:\n return x\n res = parent[x] = find(parent[x])\n return res\n\nfor... | ['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s005150677', 's523458846', 's760636120', 's957865222'] | [17096.0, 31364.0, 19024.0, 174328.0] | [580.0, 647.0, 628.0, 691.0] | [389, 539, 402, 496] |
p02573 | u183509493 | 2,000 | 1,048,576 | There are N persons called Person 1 through Person N. You are given M facts that "Person A_i and Person B_i are friends." The same fact may be given multiple times. If X and Y are friends, and Y and Z are friends, then X and Z are also friends. There is no friendship that cannot be derived from the M given facts. Ta... | ['n,m=map(int,input().split())\n# Union-Find\na=list(range(n))\ndef find(x):\n while a[x] != x:\n a[x] = a[a[x]]\n return a[x]\n\nfor _ in range(m):\n x,y=map(int,input().split())\n x,y=find(x-1),find(y-1)\n if x == y: continue\n a[y]=x\n\ncount=[0]*n\nfor i in range(n):\n count[find(i)] += 1\nprint(max(count... | ['Time Limit Exceeded', 'Accepted'] | ['s384171662', 's097889959'] | [18400.0, 18476.0] | [2206.0, 1833.0] | [304, 310] |
p02573 | u196455939 | 2,000 | 1,048,576 | There are N persons called Person 1 through Person N. You are given M facts that "Person A_i and Person B_i are friends." The same fact may be given multiple times. If X and Y are friends, and Y and Z are friends, then X and Z are also friends. There is no friendship that cannot be derived from the M given facts. Ta... | ['#D - Friends\nN,M = map(int,input().split())\npar = [i for i in range(N+1)]\n\ndef find(x):\n if par[x] == x:\n return x\n else:\n par[x] = find(par[x]) \n return par[x]\n\ndef size(x):\n return par.count(find(x))\n\ndef unite(x,y):\n x = find(x)\n y = find(y)\n if x == y:\n ... | ['Runtime Error', 'Accepted'] | ['s077447492', 's257253037'] | [149472.0, 24588.0] | [2365.0, 638.0] | [648, 706] |
p02573 | u199830845 | 2,000 | 1,048,576 | There are N persons called Person 1 through Person N. You are given M facts that "Person A_i and Person B_i are friends." The same fact may be given multiple times. If X and Y are friends, and Y and Z are friends, then X and Z are also friends. There is no friendship that cannot be derived from the M given facts. Ta... | ['\ndef resolve():\n import sys\n sys.setrecursionlimit(10 ** 6) \n to_index = lambda x: int(x) - 1 \n print_list_in_2D = lambda x: print(*x, sep="\\n") \n\n \n def input_int():\n return int(input())\n\n def map_int_input():\n return map(int, input())\n\n MII = map_int_input\n\n... | ['Runtime Error', 'Accepted'] | ['s843614089', 's010020269'] | [9036.0, 18424.0] | [30.0, 580.0] | [1733, 3228] |
p02573 | u200243669 | 2,000 | 1,048,576 | There are N persons called Person 1 through Person N. You are given M facts that "Person A_i and Person B_i are friends." The same fact may be given multiple times. If X and Y are friends, and Y and Z are friends, then X and Z are also friends. There is no friendship that cannot be derived from the M given facts. Ta... | ['class UnionFind():\n def __init__(self,n):\n self.parents = [-1]*n\n\n def find(self,x):\n if self.parents[x] < 0:\n return x\n else:\n self.parents[x] = self.find(self.parents[x])\n return self.parents[x]\n \n def union(self,x,y):\n x = self.fi... | ['Runtime Error', 'Accepted'] | ['s954933300', 's860668428'] | [14444.0, 14524.0] | [537.0, 618.0] | [722, 736] |
p02573 | u201387466 | 2,000 | 1,048,576 | There are N persons called Person 1 through Person N. You are given M facts that "Person A_i and Person B_i are friends." The same fact may be given multiple times. If X and Y are friends, and Y and Z are friends, then X and Z are also friends. There is no friendship that cannot be derived from the M given facts. Ta... | ['import sys\ninput=sys.stdin.readline\nsys.setrecursionlimit(10 ** 8)\nfrom itertools import accumulate\nfrom itertools import permutations\nfrom itertools import combinations\nfrom collections import defaultdict\nfrom collections import Counter\nimport fractions\nimport math\nfrom collections import deque\nfrom bisec... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s347762031', 's813390547', 's018614465'] | [2691004.0, 2691472.0, 262892.0] | [2279.0, 2287.0, 1261.0] | [816, 998, 979] |
p02573 | u216015528 | 2,000 | 1,048,576 | There are N persons called Person 1 through Person N. You are given M facts that "Person A_i and Person B_i are friends." The same fact may be given multiple times. If X and Y are friends, and Y and Z are friends, then X and Z are also friends. There is no friendship that cannot be derived from the M given facts. Ta... | ["#!/usr/bin/env python3\ndef main():\n from collections import deque\n\n N, M = map(int, input().split())\n friends_input = [set() for _ in range(N)]\n for _ in range(M):\n a, b = map(int, input().split())\n friends_input[a - 1].add(b - 1)\n friends_input[b - 1].add(a - 1)\n\n seen ... | ['Wrong Answer', 'Accepted'] | ['s714116787', 's936209069'] | [84472.0, 14904.0] | [706.0, 686.0] | [918, 2364] |
p02573 | u229950162 | 2,000 | 1,048,576 | There are N persons called Person 1 through Person N. You are given M facts that "Person A_i and Person B_i are friends." The same fact may be given multiple times. If X and Y are friends, and Y and Z are friends, then X and Z are also friends. There is no friendship that cannot be derived from the M given facts. Ta... | ['n, m = list(map(int, input().rstrip().split(" ")))\nmembers = [1 for i in range(n)]\nmax_idx = 0\nfor mm in range(m):\n print(members)\n a0, b0 = list(map(int, input().rstrip().split(" ")))\n a = a0\n b = b0\n while members[a-1] < 0:\n a = -members[a-1]\n members[a0-1] = -a\n while members[b-1] < 0:\n ... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s153169054', 's271805546', 's123183707'] | [147528.0, 10828.0, 21196.0] | [2373.0, 2206.0, 634.0] | [543, 478, 496] |
p02573 | u238786149 | 2,000 | 1,048,576 | There are N persons called Person 1 through Person N. You are given M facts that "Person A_i and Person B_i are friends." The same fact may be given multiple times. If X and Y are friends, and Y and Z are friends, then X and Z are also friends. There is no friendship that cannot be derived from the M given facts. Ta... | ['import networkx as nx\nimport sys\n\nG = nx.Graph()\n\nn, m = map(int, input().split())\nif m == 0:\n print(1)\n sys.exit()\nfor i in range(m):\n a, b = map(int, input().split())\n G.add_edge(a, b)\n\nlargest_cc = max(nx.connected_components(G), key=len)\nprint(largest_cc)\nprint(len(largest_cc))\n', 'imp... | ['Wrong Answer', 'Accepted'] | ['s763456834', 's330090347'] | [263436.0, 255092.0] | [1925.0, 1651.0] | [295, 390] |
p02573 | u243312682 | 2,000 | 1,048,576 | There are N persons called Person 1 through Person N. You are given M facts that "Person A_i and Person B_i are friends." The same fact may be given multiple times. If X and Y are friends, and Y and Z are friends, then X and Z are also friends. There is no friendship that cannot be derived from the M given facts. Ta... | ["\ndef main():\n from itertools import chain\n import sys\n input = sys.stdin.readline\n\n def gcd(x, y):\n if y == 0:\n return x\n return gcd(y, x % y)\n \n def prime_set(N):\n \n if N < 4:\n return ({}, {}, {2}, {2, 3})[N]\n Nsq = int(N ** 0.... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s115042610', 's698935508', 's955633778', 's631201950'] | [9364.0, 46144.0, 52304.0, 14412.0] | [24.0, 555.0, 2214.0, 689.0] | [2445, 820, 1396, 904] |
p02573 | u248670337 | 2,000 | 1,048,576 | There are N persons called Person 1 through Person N. You are given M facts that "Person A_i and Person B_i are friends." The same fact may be given multiple times. If X and Y are friends, and Y and Z are friends, then X and Z are also friends. There is no friendship that cannot be derived from the M given facts. Ta... | ['from networkx import *\nprint(max(*map(len,connected_components(Graph([*map(str,open(0))][1:])))))', 'from networkx import *\nprint(max(*map(len,connected_components(Graph([input().split()][1:])))))', 'from networkx import *\nprint(max(*map(len,connected_components(Graph([*map(str.split,open(0))][1:]))),1,0))'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s381482904', 's767289675', 's095428974'] | [70096.0, 53160.0, 300004.0] | [352.0, 332.0, 1635.0] | [97, 95, 107] |
p02573 | u250734103 | 2,000 | 1,048,576 | There are N persons called Person 1 through Person N. You are given M facts that "Person A_i and Person B_i are friends." The same fact may be given multiple times. If X and Y are friends, and Y and Z are friends, then X and Z are also friends. There is no friendship that cannot be derived from the M given facts. Ta... | ['N, M = map(int, input().split())\nA = [0] * M\nB = [0] * M\nfor i in range(M):\n A[i], B[i] = map(int, input().split())\n\nclass UnionFind():\n def __init__(self, n):\n self.n = n\n self.parents = [-1] * n\n\n def find(self, x):\n if self.parents[x] < 0:\n return x\n el... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s035566843', 's328472282', 's658125962', 's699364705'] | [26328.0, 24496.0, 31016.0, 26264.0] | [738.0, 352.0, 1099.0, 744.0] | [947, 1639, 1592, 873] |
p02573 | u260204064 | 2,000 | 1,048,576 | There are N persons called Person 1 through Person N. You are given M facts that "Person A_i and Person B_i are friends." The same fact may be given multiple times. If X and Y are friends, and Y and Z are friends, then X and Z are also friends. There is no friendship that cannot be derived from the M given facts. Ta... | ['n, m = map(int,input().split())\n\nclass unionfind():\n def __init__(self,n):\n self.li = [i for i in range(n+1)]\n self.group = [1]*(n+1)\n\n def find(self, x):\n while self.li[x]!=x:\n x = self.li[x]\n return x\n\n def union(self, x, y):\n x = self.find(x)\n ... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s130507200', 's608220831', 's831712916'] | [19624.0, 43184.0, 16680.0] | [2206.0, 522.0, 547.0] | [609, 491, 593] |
p02573 | u285265363 | 2,000 | 1,048,576 | There are N persons called Person 1 through Person N. You are given M facts that "Person A_i and Person B_i are friends." The same fact may be given multiple times. If X and Y are friends, and Y and Z are friends, then X and Z are also friends. There is no friendship that cannot be derived from the M given facts. Ta... | ['n, m = map(int, input().split())\nA = []*m\nB = []*m\nfor i in range(m):\n a, b = map(int, input().split())\n A.append(a)\n B.append(b)\nS = [set([i+1]) for i in range(n)]\n#print(S)\nfor i in range(m):\n S[A[i]-1] = S[A[i]-1].union(S[B[i]-1])\n S[B[i]-1] = S[B[i]-1].union(S[A[i]-1])\n print(S)\n\na... | ['Wrong Answer', 'Accepted'] | ['s322321610', 's597222008'] | [109172.0, 14472.0] | [2352.0, 785.0] | [377, 837] |
p02573 | u295585689 | 2,000 | 1,048,576 | There are N persons called Person 1 through Person N. You are given M facts that "Person A_i and Person B_i are friends." The same fact may be given multiple times. If X and Y are friends, and Y and Z are friends, then X and Z are also friends. There is no friendship that cannot be derived from the M given facts. Ta... | ['import numpy as np\n\nn,M = [int(i) for i in input().split()]\n\nN = np.ones(n)*-1\nn_group = 0\n\nfor i in range(M):\n a,b = [int(i) for i in input().split()]\n \n if N[a]==-1 and N[b]==-1:\n N[a] = n_group\n N[b] = n_group\n n_group += 1\n \n elif N[a]>-1 and N[b]>-1:\n ne... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s188560904', 's252254859', 's533195565', 's899674498', 's900201041', 's221651247'] | [29000.0, 69792.0, 9184.0, 28732.0, 28508.0, 28496.0] | [2206.0, 631.0, 47.0, 2206.0, 1440.0, 1612.0] | [588, 733, 413, 590, 787, 756] |
p02573 | u314089899 | 2,000 | 1,048,576 | There are N persons called Person 1 through Person N. You are given M facts that "Person A_i and Person B_i are friends." The same fact may be given multiple times. If X and Y are friends, and Y and Z are friends, then X and Z are also friends. There is no friendship that cannot be derived from the M given facts. Ta... | ['N,M = map(int, input().split())\n\nparent_dict = dict() \n\n\ndef add_connect(A,B):\n A_parent = get_parent(A)\n B_parent = get_parent(B)\n \n if A_parent != B_parent:\n parent_dict[B_parent] = A_parent\n\n\ndef judge_connection(A,B):\n A_parent = get_parent(A) \n B_parent = get_parent(B)\n ... | ['Runtime Error', 'Accepted'] | ['s294513598', 's650097426'] | [30028.0, 96620.0] | [780.0, 1013.0] | [1615, 1673] |
p02573 | u314188085 | 2,000 | 1,048,576 | There are N persons called Person 1 through Person N. You are given M facts that "Person A_i and Person B_i are friends." The same fact may be given multiple times. If X and Y are friends, and Y and Z are friends, then X and Z are also friends. There is no friendship that cannot be derived from the M given facts. Ta... | ['from sys import setrecursionlimit\n\ndef find(par,i):\n if par[i]<0:\n return i\n par[i] = find(par,par[i])\n return par[i]\n\ndef unite(par,i,j):\n ri = find(par,i)\n rj = find(par, j)\n if ri==rj:\n return\n par[rj] += par[ri]\n par[ri] = rj\n \nsetrecursionlimit(10**6)\nn,m... | ['Runtime Error', 'Accepted'] | ['s233520410', 's697521751'] | [149196.0, 16704.0] | [2345.0, 616.0] | [479, 460] |
p02573 | u319245933 | 2,000 | 1,048,576 | There are N persons called Person 1 through Person N. You are given M facts that "Person A_i and Person B_i are friends." The same fact may be given multiple times. If X and Y are friends, and Y and Z are friends, then X and Z are also friends. There is no friendship that cannot be derived from the M given facts. Ta... | ['from collections import Counter\n\nclass UnionFindBasic():\n """via https://note.nkmk.me/python-union-find/#_3\n """\n def __init__(self, n):\n self.parents = list(range(n))\n\n def find(self, x: int) -> int:\n if self.parents[x] == x: return x\n return self.find(self.parents[x])\n\n ... | ['Runtime Error', 'Accepted'] | ['s914405836', 's067989371'] | [9120.0, 14880.0] | [24.0, 767.0] | [773, 1330] |
p02573 | u335599768 | 2,000 | 1,048,576 | There are N persons called Person 1 through Person N. You are given M facts that "Person A_i and Person B_i are friends." The same fact may be given multiple times. If X and Y are friends, and Y and Z are friends, then X and Z are also friends. There is no friendship that cannot be derived from the M given facts. Ta... | ['import sys\nsys.setrecursionlimit(10 ** 9)\n\nN, M = map(int, input().split())\nroot = [-1] * N\n\ndef parent(x):\n if root[x] < 0:\n return x\n return parent(root[x])\n\n\ndef union(x, y):\n x_parent = parent(x)\n y_parent = parent(y)\n if x_parent == y_parent:\n return\n root[x_paren... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s208652288', 's636001513', 's699930892'] | [149328.0, 149336.0, 16452.0] | [2313.0, 2335.0, 670.0] | [584, 584, 590] |
p02573 | u337626942 | 2,000 | 1,048,576 | There are N persons called Person 1 through Person N. You are given M facts that "Person A_i and Person B_i are friends." The same fact may be given multiple times. If X and Y are friends, and Y and Z are friends, then X and Z are also friends. There is no friendship that cannot be derived from the M given facts. Ta... | ['class Union_Find:\n def __init__(self, n):\n self.root = [-1]*n\n \n def find(self, x):\n if self.root[x] < -1:\n return x\n else:\n self.root[x] = self.find(self.root[x])\n return root[x]\n\n def unite(self, x, y):\n x = find(x)\n y = fi... | ['Runtime Error', 'Accepted'] | ['s466351377', 's061950862'] | [10656.0, 13380.0] | [82.0, 649.0] | [747, 618] |
p02573 | u339199690 | 2,000 | 1,048,576 | There are N persons called Person 1 through Person N. You are given M facts that "Person A_i and Person B_i are friends." The same fact may be given multiple times. If X and Y are friends, and Y and Z are friends, then X and Z are also friends. There is no friendship that cannot be derived from the M given facts. Ta... | ['from collections import deque\nfrom numba import jit\n \nN, M = map(int, input().split())\nS = [set() for i in range(N)]\nvisited = [-1] * N\ncolorcount = [-1] * N\n \nfor i in range(M):\n a, b = map(int, input().split())\n a -= 1\n b -= 1\n S[a].add(b)\n S[b].add(a)\n\n@jit\ndef solve():\n q = dequ... | ['Wrong Answer', 'Accepted'] | ['s576704631', 's676377197'] | [156940.0, 74352.0] | [1220.0, 1037.0] | [634, 539] |
p02573 | u345621867 | 2,000 | 1,048,576 | There are N persons called Person 1 through Person N. You are given M facts that "Person A_i and Person B_i are friends." The same fact may be given multiple times. If X and Y are friends, and Y and Z are friends, then X and Z are also friends. There is no friendship that cannot be derived from the M given facts. Ta... | ['class UnionFind:\n def __init__(self, n):\n self.par = [i for i in range(n+1)]\n self.rank = [0] * (n+1)\n self.sum = [1] * (n+1)\n\n \n def find(self, x):\n if self.par[x] == x:\n return x\n else:\n self.par[x] = self.find(self.par[x])\n re... | ['Wrong Answer', 'Accepted'] | ['s709081401', 's821848360'] | [32420.0, 29684.0] | [768.0, 733.0] | [1076, 1548] |
p02573 | u347064383 | 2,000 | 1,048,576 | There are N persons called Person 1 through Person N. You are given M facts that "Person A_i and Person B_i are friends." The same fact may be given multiple times. If X and Y are friends, and Y and Z are friends, then X and Z are also friends. There is no friendship that cannot be derived from the M given facts. Ta... | ["\n\nN, M = [int(x) for x in input().split(' ')]\n\nfrom collections import defaultdict\nd = defaultdict(set)\n\nfor i in range(M):\n a, b = [int(x) for x in input().split(' ')]\n d[a].add(b)\n d[b].add(a)\n\ndef bfs(i):\n obs = {i}\n passed = {i}\n\n \n before = {i}\n while True:\n afte... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s189733379', 's417105055', 's621755716'] | [313244.0, 12784.0, 13468.0] | [2214.0, 524.0, 591.0] | [602, 954, 984] |
p02573 | u351480677 | 2,000 | 1,048,576 | There are N persons called Person 1 through Person N. You are given M facts that "Person A_i and Person B_i are friends." The same fact may be given multiple times. If X and Y are friends, and Y and Z are friends, then X and Z are also friends. There is no friendship that cannot be derived from the M given facts. Ta... | ['import sys\nclass UnionFind():\n def __init__(self, n):\n self.parents = [-1] * n\n\n def find(self, x):\n if self.parents[x] < 0:\n return x\n else:\n self.parents[x] = self.find(self.parents[x])\n return self.parents[x]\n\n def union(self, x, y):\n ... | ['Runtime Error', 'Accepted'] | ['s888148773', 's381760979'] | [50208.0, 50232.0] | [441.0, 430.0] | [759, 758] |
p02573 | u356983865 | 2,000 | 1,048,576 | There are N persons called Person 1 through Person N. You are given M facts that "Person A_i and Person B_i are friends." The same fact may be given multiple times. If X and Y are friends, and Y and Z are friends, then X and Z are also friends. There is no friendship that cannot be derived from the M given facts. Ta... | ['N,M = map(int,input().split())\nhint_list = [list(map(int,input().split())) for i in range(M)]\nfriend_list = []\n\ndef get_unique_list(seq):\n seen = []\n return [x for x in seq if x not in seen and not seen.append(x)]\n\nhint_list = get_unique_list(hint_list)\n\nif M == 0:\n print(N)\nelse:\n friend_lis... | ['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s076211246', 's129619084', 's361194206', 's362649597', 's999449321', 's071614108'] | [45728.0, 92056.0, 46040.0, 45880.0, 172944.0, 50444.0] | [2207.0, 2354.0, 2207.0, 2207.0, 2358.0, 694.0] | [1012, 1096, 1092, 1008, 654, 822] |
p02573 | u358859892 | 2,000 | 1,048,576 | There are N persons called Person 1 through Person N. You are given M facts that "Person A_i and Person B_i are friends." The same fact may be given multiple times. If X and Y are friends, and Y and Z are friends, then X and Z are also friends. There is no friendship that cannot be derived from the M given facts. Ta... | ['class UnionFind():\n def __init__(self, n):\n self.n = n\n self.parents = [-1] * n\n\n def union(self, x, y):\n x = self.find(x)\n y = self.find(y)\n\n if x == y:\n return\n\n if self.parents[x] > self.parents[y]:\n x, y = y, x\n\n self.pare... | ['Runtime Error', 'Accepted'] | ['s432156833', 's002626106'] | [10420.0, 14792.0] | [30.0, 723.0] | [632, 815] |
p02573 | u392441504 | 2,000 | 1,048,576 | There are N persons called Person 1 through Person N. You are given M facts that "Person A_i and Person B_i are friends." The same fact may be given multiple times. If X and Y are friends, and Y and Z are friends, then X and Z are also friends. There is no friendship that cannot be derived from the M given facts. Ta... | ['n,m=input().split()\nab = [map(int, input().split()) for _ in range(m)]\na, b = [list(i) for i in zip(*xy)]\nfriendnum = [0]*n\nfor i in range(n):\n for k in range(m):\n if a[k] == i:\n friendnum[i].append(b[i])\n if b[k] == i:\n friendnum[i].append(a[i])\nans = max(ans,len(frin... | ['Runtime Error', 'Accepted'] | ['s853285269', 's026490921'] | [9140.0, 14500.0] | [26.0, 678.0] | [328, 946] |
p02573 | u395816772 | 2,000 | 1,048,576 | There are N persons called Person 1 through Person N. You are given M facts that "Person A_i and Person B_i are friends." The same fact may be given multiple times. If X and Y are friends, and Y and Z are friends, then X and Z are also friends. There is no friendship that cannot be derived from the M given facts. Ta... | ['n,m = map(int,input().split())\ncon = []\nans = 0\nfor i in range(m):\n check = True\n b,c = map(int,input().split())\n if i == 0:\n con.append([b,c])\n else:\n for i in range(len(con)):\n if b in con[i]:\n check = False\n if c in con[i]:\n ... | ['Wrong Answer', 'Accepted'] | ['s885216645', 's798750372'] | [9592.0, 20056.0] | [2206.0, 599.0] | [618, 1406] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.