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 |
|---|---|---|---|---|---|---|---|---|---|---|
p03308 | u898421873 | 2,000 | 1,048,576 | You are given an integer sequence A of length N. Find the maximum absolute difference of two elements (with different indices) in A. | ['value = []\nfor part in input().split():\n value.append(int(part))\n\nprint(max(value) - min(value))', 'N = int(input())\n \nvalue = []\nfor part in input().split():\n value.append(int(part))\n \nprint(max(value) - min(value))'] | ['Wrong Answer', 'Accepted'] | ['s868151009', 's520230339'] | [3064.0, 2940.0] | [17.0, 17.0] | [99, 125] |
p03308 | u901687869 | 2,000 | 1,048,576 | You are given an integer sequence A of length N. Find the maximum absolute difference of two elements (with different indices) in A. | ['N = int(input())\nNlist = input().split()\n\nwMax = Nlist(0)\nwMin = Nlist(0)\nfor value in Nlist:\n if int(value) > wMax:\n wMax = int(value)\n if int(value) < wMin:\n wMin = int(value)\n\nprint(abs(wMax - wMin))', 'N = int(input())\nNlist = input().split()\n\nwMax = int(Nlist[0])\nwMin = int(Nli... | ['Runtime Error', 'Accepted'] | ['s566215650', 's258763054'] | [3060.0, 3060.0] | [17.0, 17.0] | [222, 232] |
p03308 | u903596281 | 2,000 | 1,048,576 | You are given an integer sequence A of length N. Find the maximum absolute difference of two elements (with different indices) in A. | ['N=int(input())\nA=[int(x) for x in input().split()]\nans=0\nfor i in range(N):\n for j in range(i+1,N):\n ans=max(ans,abs(A[i]-A[j])\nprint(ans)', 'N=int(input())\nA=[int(x) for x in input().split()]\nans=0\nfor i in range(N):\n for j in range(i+1,N):\n ans=max(ans,abs(A[i]-A[j]))\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s777246857', 's146744064'] | [2940.0, 3060.0] | [17.0, 19.0] | [142, 143] |
p03308 | u908763441 | 2,000 | 1,048,576 | You are given an integer sequence A of length N. Find the maximum absolute difference of two elements (with different indices) in A. | ['N = int(input())\nA = list(map(int,input().split())\nprint(max(A)-min(A))', 'N = int(input())\nA = list(map(int,input().split()))\nprint(max(A)-min(A))'] | ['Runtime Error', 'Accepted'] | ['s129708632', 's756496701'] | [2940.0, 2940.0] | [17.0, 17.0] | [71, 72] |
p03308 | u911516631 | 2,000 | 1,048,576 | You are given an integer sequence A of length N. Find the maximum absolute difference of two elements (with different indices) in A. | ['N = int(input())\nA = input().split()\nprint(max(A)-min(A))', 'N = int(input())\nA = list(map(int, input().split()))\nprint(max(A)-min(A))\n'] | ['Runtime Error', 'Accepted'] | ['s545619712', 's101512492'] | [9060.0, 9104.0] | [26.0, 30.0] | [57, 74] |
p03308 | u914762730 | 2,000 | 1,048,576 | You are given an integer sequence A of length N. Find the maximum absolute difference of two elements (with different indices) in A. | ['input()\na=map(int,input().split())\nprint(max(a)-min(a))\n', 'input()\na=list(map(int,input().split()))\nprint(max(a)-min(a))\n'] | ['Runtime Error', 'Accepted'] | ['s170496977', 's903880467'] | [2940.0, 2940.0] | [17.0, 17.0] | [56, 62] |
p03308 | u935264791 | 2,000 | 1,048,576 | You are given an integer sequence A of length N. Find the maximum absolute difference of two elements (with different indices) in A. | ['#! /usr/bin/env python\n# coding: UTF-8\n\nn = (int)(input())\nlist = list(int(i) for i in input().split())\nprint(list)\nmx = max(list)\nmn = min(list)\nprint(mx - mn)', '#! /usr/bin/env python\n# coding: UTF-8\n\nn = (int)(input())\nlist = list(int(i) for i in input().split())\nmx = max(list)\nmn = min(list)\nprint... | ['Wrong Answer', 'Accepted'] | ['s967062100', 's714272881'] | [2940.0, 2940.0] | [19.0, 17.0] | [160, 148] |
p03308 | u941753895 | 2,000 | 1,048,576 | You are given an integer sequence A of length N. Find the maximum absolute difference of two elements (with different indices) in A. | ['n=int(input())\na=[]\nfor i in range(n):\n a.append(int(input()))\nprint(max(a)-min(a))', '\nN=input()\nl=list(map(int,input().split()))\n\nmx=0\nfor x in l:\n for y in l:\n mx=max(mx,abs(x-y))\n\n\nprint(mx)'] | ['Runtime Error', 'Accepted'] | ['s362965675', 's215421272'] | [2940.0, 2940.0] | [18.0, 20.0] | [84, 127] |
p03308 | u944015274 | 2,000 | 1,048,576 | You are given an integer sequence A of length N. Find the maximum absolute difference of two elements (with different indices) in A. | ['import math\ninput()\nx = list(map(int, input().split()))\nprint(math.max(x) - math.min(x))', 'input()\nx = list(map(int, input().split()))\nprint(max(x) - min(x))'] | ['Runtime Error', 'Accepted'] | ['s871986901', 's231677372'] | [3060.0, 2940.0] | [17.0, 17.0] | [88, 66] |
p03308 | u944600619 | 2,000 | 1,048,576 | You are given an integer sequence A of length N. Find the maximum absolute difference of two elements (with different indices) in A. | ['input;n=list(map(int,input().split()))\nprint(max(n) - min(n))', 'input;n=list(map(itn,input().split()))\nprint(max(n) - min(n))', 'input();n=list(map(int,input().split()))\nprint(max(n) - min(n))'] | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s632941216', 's661438960', 's376903707'] | [2940.0, 2940.0, 2940.0] | [17.0, 17.0, 17.0] | [61, 61, 63] |
p03308 | u952968889 | 2,000 | 1,048,576 | You are given an integer sequence A of length N. Find the maximum absolute difference of two elements (with different indices) in A. | ['N = int(input())\n\nnum = 1\n\nwhile(N >= num*2):\n num *= 2\n\nprint(num)', 'N = int(input())\nlis = [int(i) for i in input().split()]\n\nlis.sort()\n\nprint(lis[len(lis)-1] - lis[0])'] | ['Wrong Answer', 'Accepted'] | ['s913043992', 's929603964'] | [2940.0, 2940.0] | [17.0, 17.0] | [70, 101] |
p03308 | u955251526 | 2,000 | 1,048,576 | You are given an integer sequence A of length N. Find the maximum absolute difference of two elements (with different indices) in A. | ['n = int(input())\na = list(map(int, input().split()))\nreturn max(a) - min(a)', 'n = int(input())\na = list(map(int, input().split()))\nprint(max(a) - min(a))'] | ['Runtime Error', 'Accepted'] | ['s291203273', 's415958951'] | [2940.0, 2940.0] | [17.0, 18.0] | [75, 75] |
p03308 | u960570220 | 2,000 | 1,048,576 | You are given an integer sequence A of length N. Find the maximum absolute difference of two elements (with different indices) in A. | ['N = int(input())\nA = list(map(int, input()).split())\n\nprint(max(A) - min(N))', 'N = int(input())\nA = list(map(int, input().split()))\n\nprint(max(N) - min(N))', 'N = int(input())\nA = list(map(int, input().split()))\n\nprint(max(A) - min(A))'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s610151027', 's632692978', 's876847435'] | [9016.0, 9040.0, 8944.0] | [26.0, 24.0, 29.0] | [76, 76, 76] |
p03308 | u961288441 | 2,000 | 1,048,576 | You are given an integer sequence A of length N. Find the maximum absolute difference of two elements (with different indices) in A. | ['N =int(input()) \nA =list(map(int, input(\n \nprint(max(A)-min(A))', 'N =int(input())\nA =list(map(int, input().split()))\nprint(max(A)-min(A))'] | ['Runtime Error', 'Accepted'] | ['s085173182', 's364360942'] | [2940.0, 2940.0] | [17.0, 17.0] | [92, 71] |
p03308 | u962415921 | 2,000 | 1,048,576 | You are given an integer sequence A of length N. Find the maximum absolute difference of two elements (with different indices) in A. | ['N=int(input())\nA=map(int, input().split())\nmaxnum=max(A)\nminnum=min(A)\nprint(maxnum-minnum)', 'N=int(input())\nA=map(int, input().split())\nmaxnum=max(A)\nminnum=min(A)\nprint(maxnum-minnum)\n', 'N=int(input())\nA=list(map(int, input().split()))\nprint(max(A)-min(A))\n'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s150866829', 's264134535', 's783244306'] | [2940.0, 2940.0, 2940.0] | [18.0, 17.0, 17.0] | [91, 92, 70] |
p03308 | u963903527 | 2,000 | 1,048,576 | You are given an integer sequence A of length N. Find the maximum absolute difference of two elements (with different indices) in A. | ['\nn = input()\nl = input()\nprint(abs(max(l) - min(l)))', '\nn = input()\na = input().split(" ")\n\nl = list()\nfor x in a:\n\tl.append(int(x))\n\nprint(abs(max(l) - min(l)))'] | ['Runtime Error', 'Accepted'] | ['s918676309', 's289934045'] | [2940.0, 2940.0] | [17.0, 17.0] | [52, 106] |
p03308 | u970738863 | 2,000 | 1,048,576 | You are given an integer sequence A of length N. Find the maximum absolute difference of two elements (with different indices) in A. | ['N = int(input())\nA = list(map(int,input().split()))\n\nasorted = sorted(A)\nprint(asorted[N+1]-asorted[0])', 'N = int(input())\nA = list(map(int,input().split()))\n\nasorted = sorted(A)\nprint(asorted[N]-asorted[0])\n', 'N = int(input())\nA = list(map(int,input().split()))\n\nasorted = sorted(A)\nprint(asorted[N-1]-... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s847538714', 's928893484', 's590894378'] | [2940.0, 2940.0, 2940.0] | [18.0, 17.0, 17.0] | [103, 102, 104] |
p03308 | u972892985 | 2,000 | 1,048,576 | You are given an integer sequence A of length N. Find the maximum absolute difference of two elements (with different indices) in A. | ['n = int(input())\na = list(map(int,input().split()))\nprint(abs(min(a)-max(a))', 'n = int(input())\na = list(map(int,input().split()))\nprint(abs(min(a)-max(a)))'] | ['Runtime Error', 'Accepted'] | ['s741506736', 's161858498'] | [2940.0, 2940.0] | [17.0, 17.0] | [76, 77] |
p03308 | u977642052 | 2,000 | 1,048,576 | You are given an integer sequence A of length N. Find the maximum absolute difference of two elements (with different indices) in A. | ['def main(n, a):\n ans = 0\n for i, j in permutations(a, 2):\n ans = max(ans, i - j)\n\n print(ans)\n\n\nif __name__ == "__main__":\n n = int(input())\n a = list(map(int, input().split()))\n\n main(n, a)\n', 'from itertools import permutations\n\n\ndef main(n, a):\n ans = 0\n for i, j in... | ['Runtime Error', 'Accepted'] | ['s080989760', 's452432765'] | [2940.0, 3060.0] | [17.0, 19.0] | [216, 253] |
p03308 | u993268357 | 2,000 | 1,048,576 | You are given an integer sequence A of length N. Find the maximum absolute difference of two elements (with different indices) in A. | ['list = [int(i) for i in input()]\nprint(max(max(list)-min(list)))', 'n = input()\nlist = [int(i) for i in input().split()]\nprint(abs(max(list)-min(list)))'] | ['Runtime Error', 'Accepted'] | ['s641910661', 's947567479'] | [2940.0, 2940.0] | [18.0, 17.0] | [64, 84] |
p03308 | u994521204 | 2,000 | 1,048,576 | You are given an integer sequence A of length N. Find the maximum absolute difference of two elements (with different indices) in A. | ['n=int(input())\nA=list(map(int,input().split()))\nprint(abs((max(A)-min(A))', 'n=int(input())\nA=list(map(int,input().split()))\nprint(abs(max(A)-min(A)))'] | ['Runtime Error', 'Accepted'] | ['s830020890', 's023892838'] | [2940.0, 2940.0] | [17.0, 17.0] | [73, 73] |
p03309 | u006657459 | 2,000 | 1,048,576 | Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns t... | ["import math\nN = int(input())\nA = [int(x) for x in input().split(' ')]\ndef score(A, b):\n s = 0\n for i, Ai in enumerate(A):\n s = math.abs(Ai - i - b)\n return s\ns = math.inf\nfor b in range(min(A), max(A)):\n si = score(A, b)\n if si < s:\n s = si\nprint(s)", "import statistics\nN = ... | ['Runtime Error', 'Accepted'] | ['s849768125', 's484890889'] | [26832.0, 27236.0] | [73.0, 255.0] | [278, 328] |
p03309 | u013408661 | 2,000 | 1,048,576 | Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns t... | ['n=int(input())\na=list(map(int,input().split()))\nfor i in range(n):\n a[n]-=i\nx=sum(a)//n\nans=0\nfor i in a:\n ans+=abs(i-x)\nprint(ans)', 'n=int(input())\na=list(map(int,input().split()))\nfor i in range(n):\n a[n]-=i\nx=sum(a)//n\nans=0\nfor i in a:\n ans+=abs(i-b)\nprint(ans)', 'n=int(input())\na=list(map(i... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s014703586', 's164469533', 's317546045', 's606332390', 's915201274', 's049756215'] | [26708.0, 26832.0, 26180.0, 27372.0, 28800.0, 25200.0] | [67.0, 67.0, 67.0, 333.0, 332.0, 182.0] | [133, 133, 133, 296, 302, 191] |
p03309 | u017624958 | 2,000 | 1,048,576 | Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns t... | ['import math\n\nN = int(input())\nA = list(map(int, input().split()))\n# print(N, A)\n\nfor i in range(len(A)):\n A[i] -= (i + 1)\n# print(A)\n\n# _A = list(map(abs, A))\n\naverage = math.floor(sum(A) / len(A)) - 1\n\nfor i in range(len(A)):\n A[i] = abs(A[i] - average)\n\nsadness = sum(A)\n\nprint(sadness)\n', ... | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s291495901', 's356264600', 's385720916', 's528765971', 's552571422', 's564983387', 's675373001', 's827172208', 's811185350'] | [26832.0, 26832.0, 26832.0, 25964.0, 26832.0, 26832.0, 26832.0, 26832.0, 26832.0] | [149.0, 74.0, 2105.0, 147.0, 154.0, 152.0, 159.0, 228.0, 234.0] | [295, 274, 355, 264, 295, 297, 290, 268, 269] |
p03309 | u023229441 | 2,000 | 1,048,576 | Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns t... | ['n=int(input())\nA=list(map(int,input().split()))\nq=0\nZ=[]\nfor b in range(len(A)):\n q=0\n for j in A:\n q+=abs(j-b-1)\n Z.append(q)\nprint(min(Z))\n', 'n=int(input())\nA=list(map(int,input().split()))\nq=0\nZ=[]\nfor b in range(len(A)):\n for j in A:\n q+=abs(j-b-1)\n Z.append(q)\nprint(min(Z))', 'n=int... | ['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s208161419', 's444229759', 's607462916', 's697200688', 's956780950', 's486033661'] | [26832.0, 26180.0, 26836.0, 127112.0, 26020.0, 26892.0] | [2104.0, 2104.0, 74.0, 2111.0, 2104.0, 271.0] | [147, 140, 173, 167, 187, 666] |
p03309 | u038027079 | 2,000 | 1,048,576 | Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns t... | ['n = int(input())\nan = list(map(int, input().split()))\na = []\nsu = 0\nfor i in range(n):\n a.append(an[i] - i+1) \na.sort()\nb = a[n//2]\nfor i in range(n):\n su += abs(an[i] - (int(b) + i))\nprint(su)', 'import statistics as s\nn = int(input())\nan = list(map(int, input().split()))\na = []\nsum = 0\nfor i in ran... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s082795372', 's608146425', 's740715508'] | [26128.0, 27236.0, 26708.0] | [277.0, 278.0, 254.0] | [195, 218, 185] |
p03309 | u044952145 | 2,000 | 1,048,576 | Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns t... | ['import statistics\n\nN = int(input())\nA = [int(c) for c in input().split()]\nA = [abs(n - (b+i+1)) for i, n in enumerate(A)]\n\nb = int(statistics.median(A))\nprint(sum([abs(n - b) for n in A]))', 'import statistics\n\nN = int(input())\nA = [int(c) for c in input().split()]\nA = [n - (i+1) for i, n in enumerate(A)]\... | ['Runtime Error', 'Accepted'] | ['s770488426', 's003750521'] | [27256.0, 27256.0] | [93.0, 212.0] | [188, 181] |
p03309 | u057429331 | 2,000 | 1,048,576 | Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns t... | ['N = int(input())\nA = list(map(int, input().split()))\nmax = max(A)\nlist = []\nx = 0\nfor i in range(N):\n A[i] = A[i] -i\nsum = 0\nfor i in range(N):\n sum = sum + A[i]\nave = int(sum/N)\nfor i in range(N):\n x = x + abs(A[i]-ave-1)\nprint(x)\n', 'N = int(input())\nA = list(map(int, input().split()))\nfor ... | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s278108469', 's808034324', 's917194468', 's575688886'] | [26836.0, 26708.0, 26836.0, 25200.0] | [186.0, 190.0, 191.0, 247.0] | [241, 190, 241, 188] |
p03309 | u065079240 | 2,000 | 1,048,576 | Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns t... | ['import math\nN = int(input())\nA = [int(x) for x in input().split()]\nsum = 0\nA_prime = [0]*N\nfor i in range(N):\n A_prime[i] = A[i] - i - 1\n sum += A_prime[i]\n\n# print(sum)\nave = math.ceil(sum / N)\n# print(ave)\nans = 0\nfor k in range(N):\n ans += abs(A[k] - (ave + k + 1))\nprint(ans)\n', '\n\nN = i... | ['Wrong Answer', 'Accepted'] | ['s373895610', 's617860750'] | [26832.0, 25200.0] | [207.0, 253.0] | [305, 277] |
p03309 | u068400994 | 2,000 | 1,048,576 | Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns t... | ['# coding: utf-8\n# Your code here!\n\nN = int(input())\nA = list(map(int, input().split(" ")))\nA_i = [0]*N\nK = [0] * 101\n\nfor i in range(N):\n A_i[i] = A[i] - i - 1\n\nb_0 = sum(A_i) / len(A_i)\nb = [0] * 101\nb[0] = int(b_0)\nfor i in range(1,101):\n b[i] = b[0] + int(i - 50.5)\nprint(b)\n\nfor i in range(... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s296219033', 's321980519', 's650766117', 's690900006', 's760743179'] | [25708.0, 26180.0, 25708.0, 26180.0, 49260.0] | [901.0, 904.0, 897.0, 2105.0, 609.0] | [383, 375, 359, 392, 465] |
p03309 | u074445770 | 2,000 | 1,048,576 | Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns t... | ['N=int(input())\na=list (map(int,input().split()))\nabs_list=[]\nfor b in range(-max(a),max(a)):\n\tc=0\n\tfor i in range(N):\n\t\tc=abs(a[i]-(b+i+1))+c\t\n\tabs_list.append(c)\t\nprint(abs_list)\t\nprint(min(abs_list))\t', 'N=int(input())\na=list (map(int,input().split()))\nabs_list=[]\nfor b in range(-max(a),max(a))... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s160808597', 's904228282', 's041296871'] | [144920.0, 137112.0, 26836.0] | [2113.0, 2112.0, 252.0] | [202, 202, 216] |
p03309 | u078349616 | 2,000 | 1,048,576 | Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns t... | ['\nN = int(input())\nA = list(map(int, input().split()))\nave = sum(A) / N\n\np = []\nfor i in range(N):\n p.append(i+1)\np_ave = sum(p) / N\n\nb = round(ave - p_ave)\n\nans = 0\nfor i in range(N):\n ans += abs(A[i] - (b + i))\nprint(ans)', '\nN = int(input())\nA = list(map(int, input().split()))\n\nbl = []\nfor... | ['Wrong Answer', 'Accepted'] | ['s679203457', 's930981295'] | [26836.0, 25200.0] | [157.0, 247.0] | [261, 301] |
p03309 | u079656139 | 2,000 | 1,048,576 | Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns t... | ['from statistics import median\nN = int(input())\nA = list(map(int, input().split()))\nB = list()\nsad = 0\n\nfor i in range(N):\n B.append(A[i]-i)\n\nb = median(B)\n\nfor i in range(N):\n sad = sad + abs(A[i] - (b+i))\n\nprint(int(sad))\nprint(median(A))', 'from statistics import median\nN = int(input())\nA = list(... | ['Wrong Answer', 'Accepted'] | ['s488833892', 's148079889'] | [27236.0, 27260.0] | [359.0, 276.0] | [241, 224] |
p03309 | u083960235 | 2,000 | 1,048,576 | Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns t... | ['#from collections import Counter\nimport math\nN=int(input())\nA=list(map(int,input().split()))\nl=[]\nn=1\nfor i in A:\n l.append(i-n)\n n+=1\nl.sort()\n\n\nc=int(math.floor(N/2))\nb=A[c]\nans_l=[]\nans=0\nfor j in l:\n ans+=abs(j-l[b])\n\nprint(ans)', '#from collections import Counter\nimport math\nN=int(i... | ['Runtime Error', 'Accepted'] | ['s484176347', 's675365479'] | [26832.0, 26832.0] | [183.0, 230.0] | [264, 258] |
p03309 | u106297876 | 2,000 | 1,048,576 | Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns t... | ['import statistics\nN = int(input())\nA = list(map(int, input().split()))\n\nfor i in range(N):\n\tA[i] = A[i] - (i+1)\nA.sort()\n\nb = statistics.median(A)\n\nans = 0\n\nfor i in range(N):\n\tans += abs(A[i] - b)\nprint(ans', 'import statistics\nN = int(input())\nA = list(map(int, input().split()))\n\nfor i in range(... | ['Runtime Error', 'Accepted'] | ['s571552275', 's200521267'] | [3060.0, 27244.0] | [17.0, 251.0] | [207, 327] |
p03309 | u107091170 | 2,000 | 1,048,576 | Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns t... | ['N=int(input())\nA=list(map(int,input().split()))\nfor i in range(N):\n A[i] = A[i] - i - 1\nprint( A.sum() // N )\n', 'N=int(input())\nA=list(map(int,input().split()))\nfor i in range(N):\n A[i] = A[i] - i - 1\nA.sort()\nb = A[N//2]\nans = 0\nfor i in range(N):\n ans += abs(A[i] - b)\nprint(ans)\n \n'] | ['Runtime Error', 'Accepted'] | ['s162142909', 's809991798'] | [25196.0, 26708.0] | [108.0, 225.0] | [111, 174] |
p03309 | u131411061 | 2,000 | 1,048,576 | Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns t... | ['N = int(input())\nA = list(map(int,input().split()))\n\nres = 0\nb = A[N//2 - 1] - (N//2)\nprint(b)\nfor i in range(N):\n res += abs((i+b+1) - A[i])\nprint(res)', 'N = int(input())\nA = list(map(int,input().split()))\n\n\nfor i in range(N):\n A[i] = A[i]-i-1\nA.sort()\nb = A[N//2]\nprint(sum(list(map(lambda x:a... | ['Wrong Answer', 'Accepted'] | ['s249201572', 's566177770'] | [26832.0, 26708.0] | [130.0, 231.0] | [155, 252] |
p03309 | u136090046 | 2,000 | 1,048,576 | Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns t... | ['import math\n\nn = int(input())\narray = [int(x) for x in input().split()]\narray2 = [array[x]-(x+1) for x in range(n)]\n\nb_ = array2[n//2]\nb_1 = array2[n//2+1]\nb_2 = array2[n//2-1]\n\nres = [abs(array[x]-(b_+x+1)) for x in range(n)]\nres1 = [abs(array[x]-(b_1+x+1)) for x in range(n)]\nres2 = [abs(array[x]-(b_2+x+... | ['Runtime Error', 'Accepted'] | ['s559542871', 's697253628'] | [43976.0, 27616.0] | [218.0, 213.0] | [373, 201] |
p03309 | u140251125 | 2,000 | 1,048,576 | Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns t... | ['import statistics\n\n# input\nN = int(input())\nA = list(map(int, input().split()))\n\nfor i in range(N):\n A[i] = A[i] - (i + 1)\n\nb = median_low(A)\nans = 0\n\nfor i in range(N):\n ans += abs(A[i] - b)\n\nprint(ans)\n\n', 'from statistics import median_low\n\n# input\nN = int(input())\nA = list(map(int, inpu... | ['Runtime Error', 'Accepted'] | ['s191698231', 's473577459'] | [27244.0, 27236.0] | [129.0, 242.0] | [211, 227] |
p03309 | u161537170 | 2,000 | 1,048,576 | Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns t... | ['import math\nimport statistics\nimport numpy as np\nsize = int(input())\nA = np.array(list(map(int,input().split())))\ni = np.array(list(range(1,size+1)))\n\nremain_list = A-i\nmedian = statistics.median(remain_list)\nprint(sum(remain_list - median))A', 'import math\nimport statistics\nimport numpy as np\nsize = int(... | ['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s412077395', 's465335133', 's726147859', 's628051433'] | [2940.0, 2940.0, 40152.0, 35168.0] | [17.0, 17.0, 2106.0, 424.0] | [242, 243, 746, 252] |
p03309 | u170183831 | 2,000 | 1,048,576 | Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns t... | ['from math import floor\n\ndef solve(n, A):\n A.sort()\n b = A[n // 2 + 1]\n return sum(abs(a - (b + i + 1)) for i, a in enumerate(A))\n\n_n = int(input())\n_A = list(map(int, input().split()))\nprint(solve(_n, _A))\n', 'from math import floor\n\ndef solve(n, A):\n B = sorted([a - (i + 1) for i, a in enume... | ['Runtime Error', 'Accepted'] | ['s938508762', 's481923318'] | [26832.0, 26608.0] | [186.0, 249.0] | [215, 421] |
p03309 | u177040005 | 2,000 | 1,048,576 | Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns t... | ['import numpy as np\nimport collections as col\nimport math\nN = int(input())\nA = list(map(int, input().split()))\n\nnpA = np.array(A)\nnpi = np.arange(1,N+1)\ndiff = npA - npi\n\nave = np.sum(diff) // (N+1)\ndiff2 = diff - ave\nans1 = np.sum(abs(diff2))\n\nans2 = 0\ntmp = 0\ntmp_befor = ans1\nb_tmp = ave\nwhile True... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s019853946', 's513773907', 's763137350', 's712148053'] | [34236.0, 34176.0, 60500.0, 34224.0] | [2112.0, 225.0, 605.0, 226.0] | [565, 251, 396, 321] |
p03309 | u177411511 | 2,000 | 1,048,576 | Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns t... | ['import sys\nfrom collections import deque\nfrom collections import Counter\nimport statistics\nimport math\nstdin = sys.stdin\n\nni = lambda: int(ns())\nna = lambda: list(map(int, stdin.readline().split()))\nns = lambda: stdin.readline()\n\nn = ni()\na_li = na()\nfor i in range(n):\n a_li[i] = a_li[i] - (i + 1)\n... | ['Runtime Error', 'Accepted'] | ['s944918872', 's783348285'] | [27272.0, 27252.0] | [243.0, 243.0] | [487, 483] |
p03309 | u193264896 | 2,000 | 1,048,576 | Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns t... | ["\nfrom scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson, minimum_spanning_tree\nfrom scipy.sparse import csr_matrix, coo_matrix, lil_matrix\nimport numpy as np\nfrom functools import reduce\n\nfrom collections import deque, Counter, defaultdict\nfrom itertools import product,... | ['Wrong Answer', 'Accepted'] | ['s152865549', 's001036748'] | [27800.0, 40104.0] | [476.0, 146.0] | [1014, 393] |
p03309 | u199295501 | 2,000 | 1,048,576 | Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns t... | ['# -*- coding: utf-8 -*-\n\nN = int(input())\nAn = list(map(int, input().split()))\n\nsubA = []\nsub_dic = {}\nfor i in range(N):\n tmp = An[i]-(i+1)\n subA.append(tmp)\n if tmp in sub_dic:\n sub_dic[tmp] += 1\n else:\n sub_dic[tmp] = 1\n\n\nprint(subA)\nprint(sub_dic)\n\nif max(sub_dic.value... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s594023328', 's843973591', 's705507092'] | [57916.0, 74904.0, 25744.0] | [340.0, 388.0, 280.0] | [558, 619, 610] |
p03309 | u201234972 | 2,000 | 1,048,576 | Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns t... | ['from statistics import mean\nimport math\nN = int(input())\n*A, = map(int, input().split())\nB = [A[i]-i for i in range(N)]\nbm = math.median(B)\nK = [x - bm for x in B]\nKZ = [abs(x) for x in K]\nZ = sum(KZ)\nfor i in range(200):\n C = [abs(x-i+100) for x in K]\n Z = min([sum(C),Z])\nprint(int(Z))', 'from stat... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s444311948', 's669303456', 's036016346'] | [27236.0, 27236.0, 36780.0] | [131.0, 107.0, 229.0] | [293, 288, 279] |
p03309 | u210827208 | 2,000 | 1,048,576 | Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns t... | ['a,b,c=map(int,input().split())\n\nX=[a,b,c]\nX.sort()\nx=X[2]\ny=X[1]\nz=X[0]\n\n\nsabun1=x-y\nsabun2=x-z\n\nif sabun1%2==0 and sabun2%2==0:\n res=(sabun1+sabun2)/2\nelif sabun1%2==1 and sabun2%2==1:\n res=(sabun1//2+sabun2//2)+1\nelif sabun1%2==0 and sabun2%2==1:\n res=(sabun1/2)+(sabun2//2)+2\nelse:\n r... | ['Runtime Error', 'Accepted'] | ['s952677162', 's163674795'] | [3064.0, 26180.0] | [18.0, 237.0] | [343, 324] |
p03309 | u220345792 | 2,000 | 1,048,576 | Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns t... | ['N = int(input())\nA = list(map(int, input().split()))\n\nfor i in range(N):\n A[i] -= i+1\n\nA.sort()\nprint(A)\nif N % 2 == 0:\n median = A[N//2]\nelse:\n median = A[(N + 1)//2]\n\nfor i in range(N):\n A[i] -= median\nprint(sum(A))', 'N = int(input())\nA = list(map(int, input().split()))\n\nfor i in rang... | ['Runtime Error', 'Accepted'] | ['s142975102', 's584784190'] | [26836.0, 26708.0] | [279.0, 271.0] | [229, 190] |
p03309 | u220843654 | 2,000 | 1,048,576 | Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns t... | ['# -*- coding: utf-8 -*-\n\ndata = list(map(int, input().split()))\n\n\nlis = [data[i-1]-i for i in range(1, len(data)+1)]\n\n\nlis.sort()\nmed = lis[len(lis)//2]\n\n\nreslis = [abs(i - med) for i in lis]\n\n\nprint(sum(reslis))\n', '# -*- coding: utf-8 -*-\n\ninput()\ndata = list(map(int, input().split()))\n\n\nlis =... | ['Wrong Answer', 'Accepted'] | ['s607612673', 's379249903'] | [3060.0, 26860.0] | [17.0, 194.0] | [312, 320] |
p03309 | u223646582 | 2,000 | 1,048,576 | Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns t... | ['N=int(input())\nA=sorted([int(i) for i in input().split()])\n\ndef median(seq):\n s = sorted(seq)\n if len(s) % 2 == 0: \n return (s[len(s) // 2] + s[(len(s) // 2) - 1]) / 2\n else:\n return s[len(s) // 2] \n\nb=median(A)\n\nans=0\nfor i in range(len(A)):\n ans+=abs(A[i]-(b+i+1))... | ['Wrong Answer', 'Accepted'] | ['s153239934', 's416736824'] | [26180.0, 26180.0] | [251.0, 274.0] | [393, 424] |
p03309 | u224554402 | 2,000 | 1,048,576 | Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns t... | ['import math\nn = int(input())\nls = list(map(int,input().split()))\nbs = [ls[i]-i-1 for i in range(n)]\nbs.sort()\nprint(bs)\nif n %2 ==0:\n a = round(n/2)\n #print(a)\n can = [bs[a],bs[a-1]]\nelif n ==1:\n can = [bs[0],bs[0]]\nelse:\n a = math.floor(n/2)\n #print(a)\n can = [bs[a+1],bs[a-1]]\n\n... | ['Wrong Answer', 'Accepted'] | ['s564075637', 's324300890'] | [33388.0, 32080.0] | [2208.0, 277.0] | [471, 532] |
p03309 | u225642513 | 2,000 | 1,048,576 | Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns t... | ['N = int(input())\na_list = [int(i) for i in input().split()]\na_list.sort()\nb1,b2 = a_list[N//2-1], a_list[N//2]\nc1,c2 = 0,0\nfor i in range(N):\n c1 += abs(a_list[i] - (b1 + i + 1))\nfor i in range(N):\n c2 += abs(a_list[i] - (b2 + i + 1))\nprint(min(c1,c2))', 'N = int(input())\na_list = [int(i) for i in inp... | ['Wrong Answer', 'Accepted'] | ['s804468809', 's267523800'] | [25196.0, 26180.0] | [300.0, 328.0] | [258, 344] |
p03309 | u228223940 | 2,000 | 1,048,576 | Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns t... | ['n = int(input())\na = [int(i) for i in input().split()]\n\nval = []\n\nfor i in range(n):\n val.append(a[i]-i)\n\nval.sort()\nprint(val)\n\n#idx = [(val[0],0)]\nidx = []\ncnt = 1\nfor i in range(n-1):\n if val[i] == val[i+1]:\n #cnt += 1\n if i == n-2:\n idx.append((val[i],i+2))\n ... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s471400975', 's810124016', 's683481539'] | [42248.0, 42948.0, 39620.0] | [411.0, 495.0, 408.0] | [949, 636, 1190] |
p03309 | u235084192 | 2,000 | 1,048,576 | Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns t... | ['N = int(input())\nA = list(map(int, input().split()))\n\nA = sorted([a - i for a, i in enumerate(A)])\n\nprint(sum(abs(x-y) for x,y in zip(A, A[::-1]))/2)', 'N = int(input())\nA = list(map(int, input().split()))\n\nA = sorted([a - i for a, i in enumerate(A)])\n\nprint(sum(abs(x-y) for x,y in zip(A, A[::-1]))//2)'] | ['Wrong Answer', 'Accepted'] | ['s316318448', 's090715666'] | [26128.0, 26132.0] | [201.0, 201.0] | [149, 150] |
p03309 | u239528020 | 2,000 | 1,048,576 | Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns t... | ['#!/usr/bin/env python3\n\nn = int(input())\na = list(map(int, input().split()))\n\nprint(a)\na = [j-(i+1) for i, j in enumerate(a)]\n\na.sort()\n\nprint(a)\n', '#!/usr/bin/env python3\n\nn = int(input())\na = list(map(int, input().split()))\n\na = [j-(i+1) for i, j in enumerate(a)]\n\na.sort()\n\nb = a[n//2]\n\nans =... | ['Wrong Answer', 'Accepted'] | ['s502923663', 's531221733'] | [30984.0, 30836.0] | [163.0, 161.0] | [146, 193] |
p03309 | u248670337 | 2,000 | 1,048,576 | Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns t... | ['from statistics import median as m\nn=int(input())\nA=list(map(int,input().split()))\nB=sorted([A[i]-i-1 for i in range(n)])\nm(B)=mb\nprint(int(sum([abs(b-mb) for b in B])))', 'from statistics import median as m\nn=int(input())\nA=list(map(int,input().split()))\nB=sorted([A[i]-i-1 for i in range(n)])\nmb=m(B)\nprint... | ['Runtime Error', 'Accepted'] | ['s254778882', 's709365815'] | [2940.0, 28824.0] | [17.0, 230.0] | [169, 169] |
p03309 | u265939044 | 2,000 | 1,048,576 | Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns t... | ['import sys\nimport math\nN = input()\nAList = list(map(int, input().split()))\nlistnum = 1000000000\n\nlow = -1000000000\nhigh = 1000000000\n\nmode = 1\na1 = 0\na2 = 0\nwhile(True):\n p1 = math.floor((abs(low) + abs(high))/3) + low\n p2 = math.floor((abs(low) + abs(high))*2/3) + low\n\n for j in range(1,int(... | ['Wrong Answer', 'Accepted'] | ['s978435449', 's467790910'] | [26608.0, 27248.0] | [2104.0, 264.0] | [602, 249] |
p03309 | u271044469 | 2,000 | 1,048,576 | Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns t... | ['n = int(input())\na = list(map(int, input().split()))\n\nb = []\n\nfor i in range(n):\n b.append(a[i]-(i+1))\n\n# print(b)\nb.sort()\n# print(b)\n\nmin_b=b[n//2]\nprint(min_b)\n\nans = 0\nfor i in range(n):\n ans+=abs(a[i]-(min_b+(i+1)))\n # print(ans)\nprint(ans)', 'n = int(input())\na = list(map(int, input().spl... | ['Wrong Answer', 'Accepted'] | ['s997769377', 's660686228'] | [26836.0, 25196.0] | [258.0, 247.0] | [248, 250] |
p03309 | u273201018 | 2,000 | 1,048,576 | Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns t... | ['import statistics\n\n\nN = int(input())\nA = list(map(int, input().split()))\n\nA = [a - i for i, a in enumerate(A)]\n\nM = int(statistics.median(A_b))\nR = []\n\nfor m in [M-2. M-1, M, M+1, M+2]:\n R.append(sum([abs(a - m) for a in A]))\n\nprint(min(R))\n', 'import statistics\n\n\nN = int(input())\nA = list(map(i... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s412825029', 's695396335', 's862866166'] | [2940.0, 27244.0, 27240.0] | [18.0, 105.0, 277.0] | [244, 244, 242] |
p03309 | u278670845 | 2,000 | 1,048,576 | Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns t... | ['import math\nn = int(input())\na = [0]*n\nfor i,x in enumerate(map(int, input().split())):\n a[i]=x-i-1\n\ndef my_round2(val, digit=0):\n p = 10 ** digit\n s = math.copysign(1, val)\n return (s * val * p * 2 + 1) // 2 / p * s\nave = my_round2(sum(a)/n)\nans = sum(abs(x-ave) for x in a)\nprint(ans)', 'import... | ['Wrong Answer', 'Accepted'] | ['s667882447', 's921182570'] | [26832.0, 28464.0] | [141.0, 223.0] | [296, 180] |
p03309 | u278864208 | 2,000 | 1,048,576 | Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns t... | ['N = int(input())\nAS = input().split()\nfor i in AS:\n i = int(i)\nb = 0\na = int(max(AS))\nc = -int(max(AS))\nold_list = []\nwhile(not ( b in old_list)): \n result_a = 0\n result_c = 0\n for j in range (1, N+1):\n result_a += abs(int(AS[j-1]) - a - j)\n for j in range (1, N+1):\n result... | ['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s144280204', 's748774760', 's974963379', 's806516665'] | [20304.0, 27248.0, 27244.0, 26016.0] | [2105.0, 96.0, 93.0, 439.0] | [576, 483, 478, 432] |
p03309 | u284854859 | 2,000 | 1,048,576 | Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns t... | ['1.\tn = int(input())\n2.\ta = list(map(int, input().split()))\n3.\ttmp = [a[x] - (x+1) for x in range(0,n)]\n4.\ttmp.sort()\n5.\tb = tmp[n // 2]\n6.\tprint(sum((abs(tmp[i] - b) for i in range(0,n))))\n', 'import copy\nN=int(input())\nli = list(map(int,input().split()))\nfor i in range(0,N):\n\tli[i] = li[i] - i -1\na... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s080443755', 's458545891', 's611857914', 's664017943'] | [2940.0, 26528.0, 27216.0, 25196.0] | [17.0, 120.0, 120.0, 256.0] | [189, 280, 284, 259] |
p03309 | u288948615 | 2,000 | 1,048,576 | Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns t... | ['N = int(input())\nAn = list(map(int, input().split()))\n\nsum = 0\nfor n in range(N):\n sum += An[n] - (n+1)\n \na, b, c = sum//N -1, sum//N, sum//N + 1\n\nans = [0]*3\nfor n in range(N):\n ans[0] += abs(An[n] - (a+n+1))\n ans[0] += abs(An[n] - (b+n+1))\n ans[1] += abs(An[n] - (c+n+1))\n\nprint(min(ans... | ['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s334048806', 's404131304', 's575973126', 's248394767'] | [26180.0, 25744.0, 25748.0, 26020.0] | [296.0, 177.0, 112.0, 183.0] | [306, 269, 295, 261] |
p03309 | u299869545 | 2,000 | 1,048,576 | Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns t... | ['n = int(input())\na = list(map(int, input().split()))\nfor i in range(n):\n a[i] -= i + 1\n\na.sort()\n\nb = a[n/2]\n\nfor i in range(n):\n a[i] = abs(a[i]-b)\nprint(sum(a))\n', 'n = int(input())\na = list(map(int, input().split()))\nfor i in range(n):\n a[i] -= i + 1\n\na.sort()\n\nb = a[n//2]\n\nfor i in r... | ['Runtime Error', 'Accepted'] | ['s924381457', 's798143494'] | [26708.0, 26180.0] | [173.0, 229.0] | [169, 170] |
p03309 | u303037478 | 2,000 | 1,048,576 | Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns t... | ['import numpy as np\n\nn = int(input())\na_list = list(map(int, input().split()))\n\n\na_nparray=np.array(a_list)\ni_nparray=np.array(range(1,len(a_list)+1))\n\nbi_nparray=a_nparray-i_nparray\n\nb=np.median(bi_nparray)\n\nans=0\nfor i in range(len(a_list)):\n ans += abs(a_list[i]-(b+(i+1)))\n\nprint(ans)', 'import nu... | ['Wrong Answer', 'Accepted'] | ['s585807930', 's388042531'] | [34164.0, 34192.0] | [1364.0, 1583.0] | [288, 295] |
p03309 | u306142032 | 2,000 | 1,048,576 | Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns t... | ['def absnuke(a, b, n):\n sum = 0\n for i in range(n):\n sum += abs(a[i]-(b+i+1))\n return sum\n\nn = int(input())\na = list(map(int, input().split()))\n\nb = round(sum(a)/n)\nprint(b)\nprint(absnuke(a, 0, n))\n', 'def match_num(a, match):\n match_lst = []\n match = [j-len(match) for j in match]\n... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s108749711', 's297834960', 's995924403'] | [26708.0, 119608.0, 34184.0] | [104.0, 2106.0, 371.0] | [213, 697, 274] |
p03309 | u309108510 | 2,000 | 1,048,576 | Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns t... | ['\nfrom statistics import median\n\n\nN = int(input())\nlistNumsAs = list(map(int,input().split()))\n\n\nlistNumsBs = []\n\n\nfor index in range(len(listNumsAs)):\n listNumsBs.append(listNumsAs[index] - index - 1)\n\n\nlistNumsBs.sort()\n\n\nmed = int(median(listNumsBs))\nprint("med: " + str(med))\n\nlistSadnessA1 ... | ['Wrong Answer', 'Accepted'] | ['s908084551', 's843580053'] | [46984.0, 52672.0] | [2108.0, 734.0] | [1114, 1091] |
p03309 | u310431893 | 2,000 | 1,048,576 | Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns t... | ['def median(l):\n n = len(l)\n ls = sorted(l)\n if n == 1: return ls[0]\n if n%2 == 0:\n m1 = ls[int(n/2)-1]\n m2 = ls[int(n/2)]\n return (m1+m2)/2\n \n return ls[int(n/2)-1]\n\nN = int(input())\nA = [int(i) for i in input().split()]\n\nA_ = [A[i] - i - 1 for i in range(N)]\n\nA_... | ['Runtime Error', 'Accepted'] | ['s759182985', 's160301266'] | [25836.0, 28272.0] | [182.0, 214.0] | [439, 422] |
p03309 | u318029285 | 2,000 | 1,048,576 | Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns t... | ['N = int(input())\nA = list(map(int, input().split()))\nB = [A[i] - (i+1) for i in range(len(A))]\nB.sort()\n\nif N % 2 != 0:\n b = B[(N+1)//2 - 1]\n print(b)\n ans = 0\n for i in range(len(B)):\n ans += abs(B[i] - b)\nelse:\n b1 = B[N//2 - 1]\n ans1 = 0\n for i in range(len(B)):\n a... | ['Wrong Answer', 'Accepted'] | ['s622757460', 's199574230'] | [26020.0, 25744.0] | [267.0, 253.0] | [450, 438] |
p03309 | u329709276 | 2,000 | 1,048,576 | Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns t... | ['import numpy as np\nfrom scipy.optimize import minimize\nN = int(input())\nA = list(map(int,input().split()))\n\ndef func(x):\n return sum([abs(v - (x + i + 1)) for i,v in enumerate(A)])\n\ndef cons(x):\n return -10^9 <= x <= 10^9\n\ncons = (\n {\n \'type\': \'ineq\', \'fun\': cons\n }\n)\nresult =... | ['Wrong Answer', 'Accepted'] | ['s930601859', 's696135352'] | [57384.0, 26228.0] | [2114.0, 252.0] | [388, 177] |
p03309 | u337851472 | 2,000 | 1,048,576 | Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns t... | ['import math\nimport statistics\n\n\nN = int(input())\nA = [int(i) for i in input().split()]\nb = math.ceil(statistics.median([a-n for a,n in zip(A,range(1,N+1))]))\nprint(b)\nans = [abs(a - b - n) for a,n in zip(A,range(1, N+1))]\nprint(sum(ans))\n', 'import math\nimport statistics\n\n\nN = int(input())\nA = [int(i) ... | ['Wrong Answer', 'Accepted'] | ['s157439403', 's422743968'] | [27236.0, 27204.0] | [223.0, 252.0] | [238, 229] |
p03309 | u346308892 | 2,000 | 1,048,576 | Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns t... | ['\nimport numpy as np\nimport sys\nsys.setrecursionlimit(100000)\n\n\n\ndef acinput():\n return list(map(int, input().split(" ")))\n\n\n\ndirections=np.array([[1,0],[0,1],[-1,0],[0,-1]])\ndirections = list(map(np.array, directions))\n\nmod = 10**9+7\n\n\ndef factorial(n):\n fact = 1\n for integer in range(1, ... | ['Wrong Answer', 'Accepted'] | ['s597173020', 's360938714'] | [34184.0, 34188.0] | [1922.0, 1974.0] | [1023, 1034] |
p03309 | u351568944 | 2,000 | 1,048,576 | Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns t... | ['N = int(input())\nA = list(map(int, input().split()))\nA_ = [a-i-1 for i,a in enumerate(A)]\nprint (A_)\nA_.sort()\nprint (A_)\nb = A_[N//2]\nprint (b)\nprint(sum([abs(ai-b) for ai in A_]))', '5\n2 2 3 5 5', 'N = int(input())\nA = list(map(int, input().split()))\nA_ = [a-i-1 for i,a in enumerate(A)]\n\nA_.sort()\n\nb... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s639189205', 's914860410', 's910828959'] | [31828.0, 2940.0, 26820.0] | [245.0, 17.0, 193.0] | [181, 11, 152] |
p03309 | u357810840 | 2,000 | 1,048,576 | Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns t... | ['n = int(input())\nlist = input().split()\n\nfor i in range(n):\n list[i] = int(list[i]) - (i + 1)\n\nb = int(median(list))\n\nfor i in range(n):\n list[i] = abs(list[i] - b)\n\nprint(sum(list))\n\n', 'from statistics import *\n\n\n\nn = int(input())\nlist = input().split()\n\nfor i in range(n):\n list[i] = i... | ['Runtime Error', 'Accepted'] | ['s895881288', 's052326025'] | [19216.0, 21680.0] | [119.0, 245.0] | [190, 218] |
p03309 | u362560965 | 2,000 | 1,048,576 | Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns t... | ['from statistics import median\nN = int(input())\nA = [int(i) for i in input().split()]\n\nB = [A[i] - (i+1) for i in range(N)]\nb = int(median(B))\n\nC = [abs(B[i] - b) for i in range(N)]\n\nprint(C)\n', 'from statistics import median\nN = int(input())\nA = [int(i) for i in input().split()]\n\nB = [A[i] - (i+1) for i... | ['Wrong Answer', 'Accepted'] | ['s099233395', 's271483291'] | [35256.0, 29696.0] | [242.0, 225.0] | [191, 196] |
p03309 | u366644013 | 2,000 | 1,048,576 | Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns t... | ['from collections import counter\nn = int(input())\na = [int(i) for i in input().split()]\noutput = 0\nb = [abs(elem - i) for i, elem in enumerate(a, 1)]\nc = counter(b)\nd = c.most_common()\n\nsurume = 0\nif len(d) == 1:\n surume = d[0][0]\nelse:\n if d[0][1] == d[1][1]:\n surume = 0\n else:\n ... | ['Runtime Error', 'Accepted'] | ['s071970197', 's983239064'] | [3316.0, 27756.0] | [21.0, 198.0] | [403, 204] |
p03309 | u366964431 | 2,000 | 1,048,576 | Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns t... | ["import numpy as np\n\nN = int(input())\ntmp = input().split(' ')\n\nA = []\nfor i in range(N):\n A.append(int(tmp[i]))\n\nA = np.asarray(A)\n\nz = np.asarray([x for x in range(N)])\nA = A - z\n\nb = np.round(np.median(A)).astype(np.uint32)\nprint(b)\nA = A - b\nA = np.absolute(A)\nprint(A.sum().astype(np.uint32))"... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s319294812', 's787863198', 's381204347'] | [37320.0, 37304.0, 34184.0] | [271.0, 294.0, 235.0] | [299, 298, 280] |
p03309 | u380793800 | 2,000 | 1,048,576 | Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns t... | ['import numpy as np\n\nn = int(input())\na = list(map(int, input().split()))\nb = [0] * n\n\ns1 = 0\ns2 = 0\ns3 = 0\n\nfor i in range(n):\n b[i] = a[i] - i\n\nb1 = np.median(b)//n\nb2 = np.median(b)//n + 1\nb3 = np.median(b)//n - 1\n\nfor i in range(n):\n s1 += abs(a[i] - b1 - i)\n\nfor i in range(n):\n s2 +=... | ['Wrong Answer', 'Accepted'] | ['s028347036', 's982998983'] | [34988.0, 25200.0] | [1798.0, 303.0] | [390, 276] |
p03309 | u382423941 | 2,000 | 1,048,576 | Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns t... | ["n = int(input())\nA = [int(_) for _ in input().split()]\nB = [a - i for i, a in enumerate(A)]\n\nidx = n // 2\nans = sum([abs(b - B[idx]) for b in B])\nprint(ans)\nif n % 2 == 0:\n idx = n // 2\n ans = min(ans, sum([abs(b - B[idx]) for b in B]))\nprint('{:.0f}'.format(ans))\n", 'n = int(input())\nA = [int(_) fo... | ['Wrong Answer', 'Accepted'] | ['s284316540', 's879087169'] | [26948.0, 27532.0] | [142.0, 223.0] | [271, 156] |
p03309 | u386131832 | 2,000 | 1,048,576 | Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns t... | ['n = int(input())\na = list(map(int,input().split()))\nb = [x-i-1 for x,i in zip(a,range(n))]\nans = sum([abs(x) for x in b])\nngo = 0\nval = 0\nfor i in list(set(b)):\n tmp = abs(b.count(i)*i)\n if ngo < tmp:\n ngo = tmp\n val = i\nprint(sum([abs(x-val) for x in b]))', 'n = int(input())\na = list(... | ['Wrong Answer', 'Accepted'] | ['s962004622', 's339367301'] | [34084.0, 27536.0] | [2105.0, 207.0] | [276, 138] |
p03309 | u391066416 | 2,000 | 1,048,576 | Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns t... | ['def absFunc(A_, b):\n result = 0\n for a_ in A_:\n result += abs(a_ - b)\n return result\n \ninput()\nA = list(map(int, input().split()))\nA_ = []\n\nfor i, a in enumerate(A):\n A_.append(a - i - 1)\n\nb = 0\nresult_o = absFunc(A_, b)\nresult_n = 0\n\nwhile True:\n b += 1\n result_n = absF... | ['Wrong Answer', 'Accepted'] | ['s320941057', 's401300079'] | [25904.0, 26180.0] | [2105.0, 219.0] | [621, 202] |
p03309 | u391731808 | 2,000 | 1,048,576 | Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns t... | ['N = int(input())\nA = list(map(int,input().split()))\nb = sorted([b-i for i,b in enumerate(A,1)])\n\nminus = 0\nplus = 0\nfor i,c in enumerate(b,1):\n if c <0:\n minus +=1\n elif c >0:\n plus +=1\n\nm = b[(N-minus+plus)//2]\nout = sum([abs(c-m) for c in b])\nprint(out)', 'N = int(input())\nA = lis... | ['Runtime Error', 'Accepted'] | ['s600074971', 's518809495'] | [27844.0, 27716.0] | [236.0, 275.0] | [275, 315] |
p03309 | u393693918 | 2,000 | 1,048,576 | Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns t... | ['N = int(input())\nA = list(map(int, input().split()))\nB = []\n\nfor i in range(N):\n B.append(A[i] - i)\n\nB = sorted(B)\nM = B[int((N + 1)/2)]\nans = 0\n\nfor i in range(N):\n t = B[i] - M\n if t < 0:\n t = (-1) * t\n ans += t\n\nprint(ans)', 'N = int(input())\nA = sorted(list(map(int, input().sp... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s092345913', 's125380315', 's694417399', 's772267834', 's983039884'] | [26180.0, 26708.0, 25196.0, 26836.0, 25200.0] | [254.0, 227.0, 69.0, 250.0, 281.0] | [244, 188, 241, 249, 249] |
p03309 | u395816772 | 2,000 | 1,048,576 | Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns t... | ["import numpy as np\nn = int(input())\na = [int(i)- k-1 for k,i in enumerate(input().split())]\nans = 10**9\na = np.array(a,dtype = 'int64')\nsum_a = np.sum(a)\nvar= np.round(sum_a / n)\nfor i in range(10**4+1):\n c = a -i + var\n e = a + i + var\n ans = min(ans, min(np.sum(np.abs(c)),np.sum(np.abs(e))))\npri... | ['Wrong Answer', 'Accepted'] | ['s017681657', 's553574306'] | [49444.0, 49288.0] | [2207.0, 181.0] | [314, 195] |
p03309 | u410269178 | 2,000 | 1,048,576 | Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns t... | ['import numpy as np\nn = int(input())\na = np.array(list(map(int, input().split())))\nb = a - np.arange(1, n+1)\nprint(int(np.median(b)))', 'import numpy as np\nn = int(input())\na = np.array(list(map(int, input().split()))) - np.arange(1, n+1)\nb = int(np.median(a))\nprint(int(np.sum(np.abs(a - b))))'] | ['Wrong Answer', 'Accepted'] | ['s940957469', 's979001751'] | [34180.0, 34180.0] | [214.0, 213.0] | [132, 157] |
p03309 | u416011173 | 2,000 | 1,048,576 | Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns t... | ['# -*- coding: utf-8 -*-\n\nimport itertools\n\n\ndef get_input() -> tuple:\n \n N = int(input())\n A = list(map(int, input().split()))\n\n return N, A\n\n\ndef main(A: list) -> None:\n \n \n ans = 0\n for A_i, A_j in itertools.combinations(A, r=2):\n ans = max(ans, abs(A_i - A_j))\n\n ... | ['Wrong Answer', 'Accepted'] | ['s590154748', 's510282714'] | [31168.0, 35416.0] | [2206.0, 163.0] | [673, 765] |
p03309 | u417658545 | 2,000 | 1,048,576 | Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns t... | ['def FindAns(A, b):\n ans = 0\n for a in A:\n ans += abs(a - b)\n return ans\n\nn = int(input())\nA = list(map(int, input().split()))\nfor i in range(n):\n A[i] -= i + 1\n\ncenter = int(sum(A) / len(A))\nans = 100000000000000\nfor i in range(21):\n ans = min(ans, FindAns(center - 50))\nprint(ans)... | ['Runtime Error', 'Accepted'] | ['s359143162', 's687683330'] | [25196.0, 25708.0] | [107.0, 1425.0] | [303, 540] |
p03309 | u426764965 | 2,000 | 1,048,576 | Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns t... | ['\ndef abc102_c():\n N = int(readline())\n A = np.array(read().split(), dtype=np.int64)\n\n \n B = A - np.arange(1, N+1)\n \n B.sort()\n x = B[N//2]\n \n ans = np.abs(B - x).sum()\n print(ans)\n\nabc102_c()', '\n\nimport sys\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readl... | ['Runtime Error', 'Accepted'] | ['s647447680', 's579394005'] | [3060.0, 25072.0] | [17.0, 299.0] | [380, 518] |
p03309 | u430726059 | 2,000 | 1,048,576 | Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns t... | ['n=int(input())\nalist=list(map(int, input().split()))\nblist=[]\nfor i in range(n):\n blist.append(alist[i]-i-1)\nblist.sort()\nif n%2==1:\n cnt=0\n for i in range(n):\n cnt+=abs(blist[i]-blist[(i+1)//2])\n print(cnt)\nelse:\n cnt=0\n num=(blist[i//2]+blist[i//2+1])//2\n for i in range(n):\n cnt+=abs(bli... | ['Runtime Error', 'Accepted'] | ['s467296353', 's019339988'] | [9036.0, 33860.0] | [29.0, 187.0] | [330, 241] |
p03309 | u437215432 | 2,000 | 1,048,576 | Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns t... | ['n = int(input())\na = [int(x) for x in input().split()]\n\na2 = [a[i] - i - 1 for i in range(n)]\nmean = sum(a2) / len(a2)\nb = np.floor(mean)\na3 = sum([abs(a2[i] - b) for i in range(n)])\nb = np.ceil(mean)\na4 = sum([abs(a2[i] - b) for i in range(n)])\nprint(int(min(a3, a4)))\n', 'import numpy as np\n\nn = int(inpu... | ['Runtime Error', 'Accepted'] | ['s162509313', 's733288471'] | [26176.0, 35792.0] | [98.0, 816.0] | [270, 327] |
p03309 | u451017206 | 2,000 | 1,048,576 | Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns t... | ['from statistics import median\nN = int(input())\nA = [int(i) for i in input().split()]\n\ndef k(A, b):\n return sum([abs(a - (b+i+1)) for i,a in enumerate(A)])\n\n\na = [a - i+1 for i,a in enumerate(A)]\nb = median(a)\n\nprint(k(A,b))', "from numpy import cumsum\nfrom bisect import bisect\nN = int(input())\nA = [i... | ['Wrong Answer', 'Accepted'] | ['s566715518', 's063244479'] | [28088.0, 43284.0] | [273.0, 1428.0] | [226, 336] |
p03309 | u455233471 | 2,000 | 1,048,576 | Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns t... | ['N = int(input())\nA = [int(i) for i in input().split()]\n\ndef calc_sadness(points, b):\n return sum([abs(y - (b + x)) for x, y in points])\n\n\n\nb_list = [y - x for x, y in points]\nb_list.sort(reverse=True)\n\n\nmax_b = b_list[0]\nmin_b = b_list[-1]\n\n\ndef search(max_b, min_b):\n\n eval_max = eval_sadness(... | ['Runtime Error', 'Accepted'] | ['s404779680', 's463340500'] | [26016.0, 47424.0] | [75.0, 248.0] | [894, 401] |
p03309 | u455696302 | 2,000 | 1,048,576 | Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns t... | ['N = int(input())\nA = [int(i) for i in input().split()]\n \nsub = [A[i]-(i+1) for i in range(N)]\nres = 0\n\nif N % 2 != 0:\n b = sub[int(N-1/2)+1]\n res = 0\n for i in range(N):\n res += abs(A[i]-(b+i+1))\nelse:\n b1 = sub[int(N-1/2)]\n b2 = sub[int(N-1/2)+1]\n res1 = 0\n for i in range(N... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s037109628', 's320263758', 's883919435', 's310468939'] | [26016.0, 25836.0, 26764.0, 26764.0] | [99.0, 224.0, 242.0, 245.0] | [448, 442, 463, 229] |
p03309 | u466335531 | 2,000 | 1,048,576 | Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns t... | ['N=int(input())\nA=list(map(int, input().split()))\n\nans=9999999999\nn=min(min(A),max(A)-N)\nfor b in range(n,max(A)):\n num=0\n for i,a in enumerate(A):\n num += abs(a-(b+i+1))\n if num<ans: \n ans=num\n print(b)\nprint(ans)', 'N=int(input())\nA=list(map(int,input().split()))\nB=[]\nfor... | ['Wrong Answer', 'Accepted'] | ['s976103140', 's083367920'] | [25200.0, 26360.0] | [2104.0, 225.0] | [243, 207] |
p03309 | u471214054 | 2,000 | 1,048,576 | Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns t... | ['N = int(input())\nA = list(map(int, input().split()))\nAd = [A[i]-(i+1) for i in range(N)]\nmax_Ad = max(abs(Ad))\nmin_total = float("inf")\n\nfor b in range(0, max_Ad+1):\n map(lambda x: x-b, Ad)\n total = sum(abs(Ad))\n if min_total > total:\n min_total = total\nprint(min_total)\n', 'N = int(input()... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s305834006', 's335899867', 's384070662', 's663723126', 's736192857', 's088589686'] | [26708.0, 26836.0, 26360.0, 26708.0, 26020.0, 26016.0] | [100.0, 96.0, 92.0, 91.0, 100.0, 233.0] | [287, 287, 287, 287, 287, 318] |
p03309 | u474270503 | 2,000 | 1,048,576 | Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns t... | ['from collections import Counter\nN=int(input())\nA = list(map(int,input().split()))\n\nfor i in range(1,N+1):\n A[i-1]-=i\n\nave1=sum(A)//len(A)\nave2=-(-sum(A)//len(A))\nmedian=Counter(A).most_common(1)[0][0]\nprint(median)\nB=A[:]\nC=A[:]\nfor i in range(0,N):\n A[i]-=ave1\n B[i]-=ave2\n C[i]-=median\n ... | ['Wrong Answer', 'Accepted'] | ['s823871466', 's366730084'] | [33640.0, 26764.0] | [322.0, 249.0] | [390, 612] |
p03309 | u475503988 | 2,000 | 1,048,576 | Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns t... | ['import numpy as np\nN = int(input())\nA = np.array(list(map(int, input().split())))\n\nb = np.median((A - np.arange(1, N+1)))\nans = np.inf\nfor i in [b-1, b, b+1]:\n ans = min(np.abs(A - i - np.arange(1, N+1)).sum(), ans)\n\nprint(ans)\n', 'import numpy as np\nN = int(input())\nA = np.array(list(map(int, input().... | ['Wrong Answer', 'Accepted'] | ['s096932440', 's520386727'] | [34188.0, 34176.0] | [221.0, 214.0] | [231, 185] |
p03309 | u492532572 | 2,000 | 1,048,576 | Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns t... | ['N = int(input())\nA_list = list(map(int, input().split()))\nmin_sum = 0\nfor b in range(len(A_list)):\n sum = 0\n for i, a in enumerate(A_list):\n sum += abs(a - (b + i))\n min_sum = min(min_sum, sum)\nprint(min_sum)', 'N = int(input())\nA_list = list(map(int, input().split()))\nB_list = [a - (i + 1) ... | ['Wrong Answer', 'Accepted'] | ['s891174135', 's018294002'] | [26708.0, 26860.0] | [2104.0, 195.0] | [224, 204] |
p03309 | u497625442 | 2,000 | 1,048,576 | Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns t... | ['N = int(input())\nA = list(map(int,input().split()))\nC = [A[i] - (i+1) for i in range(N)]\n\ndef SAD(C,b):\n\tS = 0\n\tfor i in range(N):\n\t\tS += abs(C[i] - b)\n\treturn S\n\nMAX, MIN = max(C), min(C)\n\ni = 0\nwhile MIN != MAX:\n\tx1 = (MIN*2+MAX)//3\n\tx2 = (MIN+MAX*2)//3\n\ts1 = SAD(C,x1)\n\ts2 = SAD(C,x2)\n\ti... | ['Wrong Answer', 'Accepted'] | ['s135916264', 's481578119'] | [27712.0, 26096.0] | [2105.0, 1700.0] | [377, 401] |
p03309 | u497952650 | 2,000 | 1,048,576 | Snuke has an integer sequence A of length N. He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the _sadness_ of Snuke is calculated as follows: * abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N)) Here, abs(x) is a function that returns t... | ['N = int(input())\nA = list(map(int,input().split()))\n\nb = 0\nif N%2 == 0:\n b = (A[N//2-1]+A[N//2])//2 - N//2 \nelse:\n b = A[N//2] - N//2 - 1\nprint(b)\nb += 1\nans = 0\nfor i in range(N):\n ans += abs(A[i]-(b+i+1))\n\nprint(ans)', 'N = int(input())\nA = list(map(int,input().split()))\nB = [A[i]-i-1 for i... | ['Wrong Answer', 'Accepted'] | ['s899396228', 's361842585'] | [26832.0, 26848.0] | [131.0, 221.0] | [227, 153] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.