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 |
|---|---|---|---|---|---|---|---|---|---|---|
p03309 | u504562455 | 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\nfor ni in range(N):\n A[ni] = A[ni] - (ni+1)\n\nb = sum(A)//N+1\nans = 0\nfor ni in range(N):\n ans += abs(A[ni]-b)\n\nprint(ans)', 'N = int(input())\nA = [int(i) for i in input().split()]\n\nfor ni in range(N):\n A[ni] = A[ni] - (ni+1)\n\nA.sort()\n... | ['Wrong Answer', 'Accepted'] | ['s620262123', 's368778060'] | [26180.0, 26128.0] | [160.0, 237.0] | [183, 190] |
p03309 | u506086925 | 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 = []\ncnt = 1\nfor num in a:\n num -= cnt\n b.append(num)\n cnt += 1\ntest = [int(mean(b))-1,int(mean(b)),int(mean(b))+1]\nans = []\ns = 9999999999999\nfor i in test:\n cnt = 1\n c = []\n for num in a:\n st = 0\n st = abs(num - (i... | ['Runtime Error', 'Accepted'] | ['s149156889', 's104095601'] | [25284.0, 37492.0] | [120.0, 682.0] | [385, 461] |
p03309 | u513081876 | 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()]\nfor i in range(n):\n a[i] -= (i+1)\nave = sum(a) // n\nfoi i in range(n):\n a[i] = abs(a[i] - ave)\nprint(sum(a))', 'N = int(input())\nA = [int(i) for i in input().split()]\nfor i in range(N):\n A[i] -= (i+1)\n\nA.sort()\n\nif N % 2 != 0:\n num = A[N//2... | ['Runtime Error', 'Accepted'] | ['s775068631', 's541083015'] | [2940.0, 27844.0] | [18.0, 246.0] | [165, 336] |
p03309 | u518042385 | 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())\nl=list(map(int,input().split()))\nfor i in range(n):\n l[i]=l[i]-i-1\nl=sorted(l)\nif n%2==0:\n mid=(l[n/2-1]+l[n/2])\nelse:\n mid=l[n/2]\nsum=0\nfor i in range(n):\n sum+=abs(l[i]-mid)\nprint(sum)\n', 'n=int(input())\nl=list(map(int,input().split()))\nfor i in range(n):\n l[i]=l[i]-i-1\nl=sorted... | ['Runtime Error', 'Accepted'] | ['s882783246', 's844200436'] | [26128.0, 26180.0] | [192.0, 222.0] | [206, 215] |
p03309 | u527261492 | 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=[]\nfor i in range(n):\n A.append(a[i]-i-1)\nA.sort()\nb=0\nc=0\nans=0\nAns=0\nif n%!=0:\n b=n//2\n for i in range(n):\n ans+=abs(A[i]-b)\n print(ans)\nelse:\n b=n//2\n c=(n//2)-1\n for i in range(n):\n ans+=abs(A[i]-b)\n Ans+=abs(A[i]-c)\n print(mi... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s917132718', 's951876613', 's185571599'] | [2940.0, 26020.0, 25748.0] | [17.0, 280.0, 292.0] | [311, 313, 322] |
p03309 | u532806301 | 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())\nl = input().split()\nlst = list(map(int,l))\n\nsum = 0\nj = 1\nfor i in lst:\n sum += (i-j)\n j+=1\n\n//四捨五入\nb = round(sum/n)\n\n#print(b)\n\nj = 1\nsad = 0\nfor a in lst:\n sad += abs(a-(b+j))\n j += 1\nprint(sad)', 'import statistics\n\nn = int(input())\nl = input().split()\nlst = lis... | ['Runtime Error', 'Accepted'] | ['s497310452', 's904905603'] | [2940.0, 39444.0] | [17.0, 287.0] | [233, 322] |
p03309 | u532966492 | 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()))\nfrom statistics import median\nprint(sum([abs(b-int(median(a))) for b in a]))', 'N=int(input())\na=list(map(int,input().split()))\na=[a[i]-i for i in range(N)]\nfrom statistics import median\nm=int(median(a))\nprint(sum([abs(b-m) for b in a]))'] | ['Wrong Answer', 'Accepted'] | ['s880309284', 's718669661'] | [26708.0, 26832.0] | [2104.0, 209.0] | [124, 157] |
p03309 | u536377809 | 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=[int(item) for item in input().split()]\n\ntmp=[a-n-1 for n,a in enumerate(A)]\nprint(tmp)\nprint(sum(tmp)/len(tmp))\nb=sum(tmp)/len(tmp)\nif b>0:\n b=math.floor(b)\nelse:\n b=math.ceil(b)\n\nprint(sum([abs(item-b) for item in tmp]))', 'import math\n\nN=int(input())\nA=[int(item) fo... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s202823673', 's690951613', 's828293333', 's417941391'] | [30980.0, 30844.0, 30844.0, 26708.0] | [143.0, 141.0, 163.0, 282.0] | [254, 216, 304, 281] |
p03309 | u549383771 | 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()))\nimport numpy as np\nprint(int(np.median(a_list)) - (a_list.index(int(np.median(a_list))) + 1))', 'n = int(input())\na_list = list(map(int,input().split()))\nans_list = []\nfor i in range(len(a_list)):\n ans_list.append(a_list[i] - i - 1)\nimport numpy as n... | ['Runtime Error', 'Accepted'] | ['s193664671', 's240896120'] | [37656.0, 44572.0] | [257.0, 299.0] | [150, 570] |
p03309 | u550146922 | 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... | ['li = sorted([a[i]-(i+1) for i in range(n)])\nif n%2==0:\n ave = (li[n//2]+li[n//2-1])//2\nelse:\n ave = li[(n-1)//2]\n\nimport math\nave1 = math.floor(ave)\nave2 = math.ceil(ave)\n\nll = []\nc = 0\nfor i in range(n):\n c += abs(a[i]-(ave1+i+1))\nelse:\n ll += [c]\n\nc =0\nfor i in range(n):\n c += abs(... | ['Runtime Error', 'Accepted'] | ['s078907568', 's775084899'] | [9120.0, 30800.0] | [29.0, 233.0] | [351, 404] |
p03309 | u558242240 | 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(n)]\nprint(b)\nb.sort()\n\nans = 10 ** 10\nfor j in range(3):\n bi = b[((n-1)//2+j)%n]\n s = 0\n for i in range(n):\n s += abs(b[i] - bi)\n print(((n-1)//2+j)%n, s)\n ans = min(ans, s)\nprint(ans)', 'n = int... | ['Wrong Answer', 'Accepted'] | ['s927300931', 's169510725'] | [26180.0, 25200.0] | [314.0, 233.0] | [293, 437] |
p03309 | u558782626 | 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())\nnumbers = map(int, input().split())\nmin_num = min(numbers)\nmax_num = max(numbers)\nabs_= float('inf')\nfor b in range(min_num, max_num):\n abs_pre = sum([abs(a-b-i) for i, a in enumerate(numbers)])\n if abs_pre < abs_:\n abs_ = abs_pre\nprint(abs_)", "N = int(input())\nnumbers = list(... | ['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s089676972', 's239075576', 's365921544', 's916756985'] | [20856.0, 26832.0, 26180.0, 27248.0] | [65.0, 2104.0, 2104.0, 273.0] | [272, 278, 281, 246] |
p03309 | u560072805 | 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.copy()\nB.sort()\nA_max=B[N]+N\nsum_A=[0]*(A_max+1)\nfor i in range(A_max+1):\n for num in range(N):\n sum_A[i]+=abs(A[num]-i)\nsum_A.sort()\nprint(sum_A[0])\n \n \n \n\n\n', 'N=int(input())\nA=list(map(int,input().split()))\nB=A.copy()\nB.sort()\nA_max=B... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s010265684', 's159812350', 's213608370', 's691439193', 's057161654'] | [30800.0, 3436348.0, 30964.0, 30808.0, 30848.0] | [106.0, 2292.0, 2206.0, 140.0, 180.0] | [219, 221, 213, 211, 251] |
p03309 | u571444155 | 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())\n\na = list(map(int, input().split()))\ns = 10000000\n\nfor i in range(2+max(a)):\n s_tmp = 0\n \n for j in range(n):\n s_tmp = s_tmp + abs(a[l] - i - (j+1))\n \n if s_tmp < s:\n s = s_tmp\n\nprint(s)', 'n = int(input())\n\na = list(map(int, input().split()))\ns = 10000000\n\nfor i i... | ['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s023498787', 's096641853', 's866257009', 's395463601'] | [25200.0, 26836.0, 2940.0, 27592.0] | [72.0, 2104.0, 17.0, 198.0] | [220, 221, 157, 189] |
p03309 | u575431498 | 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\nX = [a-(i+1) for i, a in enumerate(A)]\nX.sort()\nprint(X)\nb = X[(N)//2]\nprint(sum([abs(x - b) for x in X]))', 'N = int(input())\nA = [int(i) for i in input().split()]\n\nX = [a-(i+1) for i, a in enumerate(A)]\nX.sort()\nb = X[(N)//2]\nprint(sum([abs(x - b)... | ['Wrong Answer', 'Accepted'] | ['s244038416', 's526888856'] | [30580.0, 27848.0] | [233.0, 212.0] | [162, 153] |
p03309 | u576432509 | 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\n#n=5\n#stra="2 2 3 5 5"\n#ans=2\n\n#n=9\n#stra="1 2 3 4 5 6 7 8 9"\n#ans=0\n\n#n=6\n#stra="6 5 4 3 2 1"\n#ans=18\n\n#n=7\n#stra="1 1 1 1 2 3 4"\n#ans=6\n\n#a=list(map(int,stra.split()))\n\nfor i in range(n):\n a[i]=a[i]-i-1\n#print(a)\na.sort()\n\ns=[a[0]]\nfor i... | ['Runtime Error', 'Accepted'] | ['s722000264', 's439243067'] | [26180.0, 26020.0] | [260.0, 295.0] | [662, 250] |
p03309 | u585265265 | 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 main():\n N = int(input())\n A = []\n for i in range(N):\n A.append(int(input()))\n C = [A[i] - i - 1 for i in range(N)]\n C.sort()\n m = N // 2\n x = C[m]\n left = sum([x - C[i] for i in range(m)])\n right = sum([C[i] - x for i in range(m + 1, N)])\n print(left + right)\n ... | ['Runtime Error', 'Accepted'] | ['s495430257', 's490563250'] | [8028.0, 38752.0] | [31.0, 207.0] | [344, 371] |
p03309 | u585742242 | 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 -*-\nINF = 10**10\nn = int(input())\na = [int(_) - (i + 1) for i, _ in enumerate(input().split())]\na_posi = [ai for ai in a if ai >= 0]\na_posi_num = len(a_posi)\na_posi_sum = sum(a_posi)\na_nega = [ai for ai in a if ai < 0]\na_nega_num = len(a_nega)\na_nega_sum = abs(sum(a_nega))\n\ngrief = INF\... | ['Wrong Answer', 'Accepted'] | ['s335553146', 's468614362'] | [25960.0, 25196.0] | [216.0, 196.0] | [612, 385] |
p03309 | u586594818 | 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 = int(input())\nb = input().split()\nc = []\nfor i in range(a):\n c.append(int(b[i]))\ng = []\nfor i in range(a):\n g.append(c[i] - i-1)\ng.sort()\nd = g[int(a/2)]\nf = 0\nfor i in range(a):\n e = abs(c[i]-(d+i+1))\n f += e\nf', 'a = int(input())\nb = input().split()\nc = []\nfor i in range(a):\n c.append(int(... | ['Wrong Answer', 'Accepted'] | ['s043751866', 's843336087'] | [33864.0, 33864.0] | [302.0, 299.0] | [218, 225] |
p03309 | u589726284 | 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 collections\n\nN = int(input())\nA = list(map(int, input().split()))\nli = []\nb = 0\nif max(A) > (sum(A) - max(A):\n b = -max(A)\n for i in range(N):\n li.append(abs(A[i]-(b+i+1)))\n print(sum(li))\nelse :\n for i in range(N):\n li.append(abs(A[i]-(b+i+1)))\n c = collections.Counter(li)\n b = -c.m... | ['Runtime Error', 'Accepted'] | ['s328747508', 's413376844'] | [2940.0, 29648.0] | [17.0, 277.0] | [405, 227] |
p03309 | u599547273 | 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(n) for n in input().split(" ")]\n\nsub_a = [a_n - i - 1 for i, a_n in enumerate(a)]\nmedian = statistics.median(sub_a)\nprint(sum([abs(sub_a-median) for sub_a_n in sub_a]))', 'import statistics\n\nn = int(input())\na = [int(n) for n in input().split(" ")]\n\nsub_a = [a_... | ['Runtime Error', 'Accepted'] | ['s456020040', 's728200300'] | [27232.0, 28096.0] | [190.0, 220.0] | [213, 220] |
p03309 | u600402037 | 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 = np.array(list(map(int, input().split())))\nR = np.array([x+1 for x in range(N)])\n\nav = int(np.average(A-R))\nprint(abs(A-R-av))', 'import numpy as np\n\nN = int(input())\nA = np.array(list(map(int, input().split())))\nR = np.array([x+1 for x in range(N)])\n\nav = int(np.r... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s503910775', 's638433907', 's935661122', 's226662047'] | [34184.0, 34188.0, 34184.0, 34188.0] | [248.0, 267.0, 290.0, 214.0] | [166, 291, 277, 282] |
p03309 | u606878291 | 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 = np.array(list(map(int, input().split(' '))))\nB = np.arange(1, N + 1)\n\nC = A - B\nmean = int(np.mean(C))\n\nprint(min(np.sum(np.abs(C - mean))), np.sum(np.abs(C + mean)))\n", "import numpy as np\n\nN = int(input())\nA = np.array(list(map(int, input().split(' '))))\n\ndiff... | ['Runtime Error', 'Accepted'] | ['s043636763', 's613134256'] | [49444.0, 49584.0] | [164.0, 174.0] | [208, 267] |
p03309 | u614459338 | 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 scipy import optimize\nN = int(input())\nA = list(map(lambda x:int(x),input().split(" ")))\ndef f(x):\n tmp = 0\n for i in range(0,len(A)):\n tmp += abs(A[i]-(x+i+1))\n return tmp\nprint(int(round(optimize.brent(f))))', 'import numpy as np\nN = int(input())\nA = list(map(lambda x:int(x),input().s... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s549879286', 's578485787', 's112431829'] | [39596.0, 34208.0, 35388.0] | [2110.0, 232.0, 1127.0] | [230, 200, 219] |
p03309 | u619379081 | 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 j in range(n):\n a[j] = a[j] - (j + 1)\na.sort()\nif x % 2 == 0:\n print(sum(a[n / 2:]) - sum(a[:n / 2])\nelse:\n print(sum(a[(n + 1) / 2:]) - sum(a[:(n - 1) / 2])', 'n = int(input())\na = list(map(int, input().split()))\ndef devide2a(x):\n \ndef ... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s152513721', 's414995600', 's862984825'] | [2940.0, 2940.0, 26020.0] | [17.0, 17.0, 192.0] | [223, 349, 245] |
p03309 | u626468554 | 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\nli = []\n\nfor i in range(n):\n memo = a[i]-(i+1)\n li.append(memo)\n\nli.sort()\n\nmemo = len(li)\nmemo2 = li[memo//2]\n\nli2 = [memo2 for i in range(len(li))]\nli = li - li2\n\nttl = 0\nfor i in range(n):\n ttl += abs(li[i])\n\nprint(ttl)\n', 'n = int... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s216839701', 's658333314', 's174883818'] | [25876.0, 36724.0, 26860.0] | [201.0, 357.0, 291.0] | [285, 338, 340] |
p03309 | u626881915 | 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\nb = round(sum(a)/n, 0)\nans = 0\nfor i in range(n):\n ans += abs(a[i]-b)\n\nprint(ans)', 'import math\n\nn = int(input())\na = list(map(int, input().split()))\nfor i in range(n):\n a[i] -= i+1\na = sorted(a)\nb1 = math.floor... | ['Wrong Answer', 'Accepted'] | ['s755002724', 's503486498'] | [26836.0, 26608.0] | [154.0, 440.0] | [169, 447] |
p03309 | u627886394 | 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 fractions\nimport statistics\nimport operator\nfrom functools import reduce\nN = int(input())\na_list = list(map(int, input().split(' ')))\nmedian = statistics.median(a_list)\nbias = (N+1) / 2\nb = median - bias\nprint(sum([abs(a - (b + i)) for i,a in enumerate(a_list, start=1)]))\n", "import fractions\nimport... | ['Wrong Answer', 'Accepted'] | ['s570297517', 's396526926'] | [27212.0, 27208.0] | [212.0, 231.0] | [280, 277] |
p03309 | u629350026 | 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()))\ntemp=[0]*n\nfor i in range(0,n):\n temp[i]=a[i]-(i+1)\ntemp.sort()\nave=temp/n\nprint(ave)', 'n=int(input())\na=list(map(int,input().split()))\ntemp=[0]*n\nfor i in range(0,n):\n temp[i]=a[i]-(i+1)\ntemp.sort()\nave=int(n/2)\nans=0\nfor i in range(0,n):\n ans=ans+a... | ['Runtime Error', 'Accepted'] | ['s530249869', 's550438373'] | [26708.0, 26020.0] | [202.0, 249.0] | [134, 196] |
p03309 | u633105820 | 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 unittest\n\nfrom app.ABC102_C import run\n\n\nclass TestSample(unittest.TestCase):\n def test_run(self):\n self.assertEqual(run(5, [2, 2, 3, 5, 5]), 2)\n self.assertEqual(run(9, [1, 2, 3, 4, 5, 6, 7, 8, 9]), 0)\n self.assertEqual(run(6, [6, 5, 4, 3, 2, 1]), 18)\n self.assertEqual... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s440714122', 's461854326', 's028081839'] | [5964.0, 26708.0, 26836.0] | [121.0, 408.0, 187.0] | [391, 395, 361] |
p03309 | u634208461 | 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] - 1 - i for i in range(N)]\nB.sort()\nif N % 2 == 0:\n med = [int((B[int(N / 2) - 1] + B[int(N / 2)]) / 2)]\nelse:\n med = [B[int((N + 1) / 2) - 1]]\nS = 0\nfor i in range(N):\n S += abs(B[i] - b)\nprint(S)\n', 'N = int(input())\nA = list(map(i... | ['Runtime Error', 'Accepted'] | ['s736291850', 's153307875'] | [25200.0, 26180.0] | [170.0, 215.0] | [270, 268] |
p03309 | u636311816 | 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 as stc\n\nn=int(input())\n \na = list(map(int, input().split()))\n\n#a[i]-(b+1) = a[i]-i-b\na_ = [a[i]-(i+1) for i in range(len(a))]\n\nb=stc.median(a)\n\ndef sad(a,b):\n score=0\n for i in range(1,len(a)+1):\n #score+= abs(a[i]-(b+i))\n score+= abs(a_[i]-b)\n\nres = sad(a,b)\npr... | ['Runtime Error', 'Accepted'] | ['s270394741', 's182974065'] | [27244.0, 27232.0] | [221.0, 214.0] | [308, 302] |
p03309 | u636489589 | 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(n)]\nb = sorted(b)\nif n % 2 == 1:\n print(b[(n-1)//2])\nelse:\n print((b[n//2] + b[n//2+1])//2)\n', 'n = int(input())\na = list(map(int, input().split()))\nb = [a[i] - i - 1 for i in range(n)]\nb = sorted(b)\nif n % 2 == 1:\n ... | ['Wrong Answer', 'Accepted'] | ['s177398870', 's097752989'] | [30908.0, 33320.0] | [122.0, 169.0] | [180, 229] |
p03309 | u648212584 | 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())\nX = list(map(int,input().split()))\n\nfor i in range(N):\n\tX[i] -= (i+1)\n\nX.sort()\nprint(X)\nans = 0\nfor i in range(N):\n\tans += abs(X[i]-X[N//2])\n\nprint(ans)', 'N = int(input())\nX = list(map(int,input().split()))\n\nfor i in range(N):\n\tX[i] -= (i+1)\n\nX.sort()\nans = 0\nfor i in range(N... | ['Wrong Answer', 'Accepted'] | ['s925403378', 's005505269'] | [26708.0, 25196.0] | [268.0, 244.0] | [170, 161] |
p03309 | u648868410 | 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\n\n\n\n\n\ndef calcVal(b):\n\tval = 0\n\tfor n in range(N):\n\t\tval += abs(A[n]-(b+n+1))\n\treturn val\n\nN=int(input())\nA=list(map(int,input().split()))\n\nM=[]\n\nfor i,a in enumerate(A):\n\tM.append( a - (i+1) )\n\nM.sort()\n\nif N%2==0:\n\tmed1=N//2\n\tmed2=N//2+1\n\tans=min(calcVal(M[med1]),calcVal(M[med2])... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s272458168', 's294005790', 's565992269'] | [25748.0, 25708.0, 25744.0] | [269.0, 302.0, 303.0] | [542, 700, 744] |
p03309 | u656643475 | 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... | ['# Q_C\nN = int(input())\nA = list(map(int, input().split()))\n\nimport numpy as np\n\nA = np.array(A)\nI = np.array(list(range(1, N + 1)))\n\nG = A - I\n\n#print(G)\nb = np.min(G)\n#print(b)\n\nre = 10 ** 20\n\nif b > 0:\n G = G - np.full(N, b)\n G = np.absolute(G)\n re = np.sum(G)\nelif b == 0:\n G = np.... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s424914733', 's553016136', 's449061890'] | [26016.0, 26020.0, 26708.0] | [2109.0, 2109.0, 243.0] | [571, 571, 239] |
p03309 | u657541767 | 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()]\na2 = [0] * n\nb = 999999999999\n\nfor i in range(n):\n a2[i] = a[i] - (i+1)\n\nprint(a2)\nres = [0] * n\nmean = sum(a2)//n\nfor i in range(n):\n res[i] = abs(a2[i] - mean)\n\nprint(sum(res))\n', 'import math\nimport statistics\n\nn = int(input())\na = [in... | ['Wrong Answer', 'Accepted'] | ['s904069925', 's292584086'] | [30452.0, 27248.0] | [201.0, 254.0] | [240, 243] |
p03309 | u669770658 | 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\nsum = 0\nans = []\n\nfor b in range(-N, N):\n for i in range(N):\n sum += abs(A[i] - (b + i))\n else:\n ans.append(sum)\n sum = 0\n\nprint(ans)\n\n', 'N = int(input())\nA = list(map(int, input().split()))\n\nB = [A[i] - (i + 1) for ... | ['Wrong Answer', 'Accepted'] | ['s633199505', 's185146168'] | [26180.0, 26016.0] | [2104.0, 233.0] | [218, 199] |
p03309 | u672494157 | 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 functools import reduce\nimport copy\n\n\nsys.setrecursionlimit(4100000)\n\n\ndef inputs(num_of_input):\n ins = [input() for i in range(num_of_input)]\n return ins\n\n\ndef solve(inputs):\n nums = string_to_int(inputs[0])\n N = len(nums)\n for i in range(... | ['Wrong Answer', 'Accepted'] | ['s369012284', 's479275289'] | [28556.0, 28804.0] | [164.0, 228.0] | [770, 666] |
p03309 | u673338219 | 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 = list(a[i]-i-1 for i in range(n))\nb.sort()\n\ndef sadness(x,y):\n s = 0\n for i in range(len(y)):\n s += abs(y[i]-x)\n return s\n\nif n%2 == 0:\n print(sadness(a[n/2],b))\nelse:\n print(sadness(a[(n-1)/2],b))\n\n\n \n \n ', 'n = int(input())\na = li... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s498049147', 's882648832', 's015319597'] | [26128.0, 25748.0, 25200.0] | [181.0, 210.0, 209.0] | [271, 281, 281] |
p03309 | u674185143 | 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 = [int(i) for i in input().split()]\nprint(a)\nfor i in range(n):\n a[i] -= i\nprint(a)\nmc = math.ceil(sum(a)/n)\nmf = math.floor(sum(a)/n)\nac = [0 for i in range(n)]\naf = [0 for i in range(n)]\nfor i in range(n):\n ac[i] = abs(a[i]- mc)\n af[i] = abs(a[i]- mf)\n\nprint(... | ['Wrong Answer', 'Accepted'] | ['s332063021', 's705393032'] | [32488.0, 28916.0] | [256.0, 381.0] | [325, 349] |
p03309 | u686036872 | 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 import median\nN = int(input())\nA=list(map(int, input().split()))\nB=[]\nfor number, i in enumerate(A, 1):\n B.append(i-number)\nmedian = int(median(B))\nans2 = 0\nfor i in B:\n ans2 += abs(i-median)\nprint(ans2)', 'import statistics \nN = int(input())\nA=list(map(int, input().split()))\nB=... | ['Runtime Error', 'Accepted'] | ['s778286071', 's285094893'] | [2940.0, 27244.0] | [17.0, 237.0] | [228, 228] |
p03309 | u690442716 | 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 = input()\nA = A.split()\nB =[]\nC = []\nans = 0\nfor i in range(N):\n B.append(int(A[i]))\n C.append(int(A[i]))\nC.sort(reverse=True)\n"""\nMax = C[0]\nb = Max - N\n"""\nn = math.floor(N/2)\nb = C[n]\n#print(b)\nfor i in range(N):\n ans = ans + abs(B[i]-(i+b+1))\n\nans = ans... | ['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s397065707', 's892662999', 's941444861', 's881239902'] | [36816.0, 36420.0, 35692.0, 36084.0] | [336.0, 251.0, 260.0, 423.0] | [310, 269, 352, 359] |
p03309 | u691896522 | 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()))\ntotal = 0\nfor i in range(n):\n a[i] = a[i] - (i + 1)\nif n % 2 == 0:\n ave = a[int(n/2)]\n for i in range(n):\n total += abs(a[i] - ave)\n print(total)\nelse:\n total2 = 0\n ave = a[int(n/2)]\n for i in range(n):\n total += abs... | ['Runtime Error', 'Accepted'] | ['s830065563', 's419525131'] | [25744.0, 26020.0] | [143.0, 238.0] | [478, 522] |
p03309 | u692746605 | 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()]\ns=[0 for x in range(n)]\n \nfor i in range(n):\n a[i] -= i+1\n \na.sort()\n \ns=0\nif s%2:\n for i in range(n):\n s += abs(a[i]-a[n//2])\n print(s)\nelse:\n m=10**14\n v=(a[n//2-1]+a[n//2])//2\n for i in range(v,v+2):\n s = 0\n for j in range(n):\n ... | ['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s500555619', 's598695380', 's610662526', 's896189920'] | [26356.0, 26180.0, 3192.0, 25196.0] | [278.0, 308.0, 18.0, 253.0] | [707, 344, 337, 158] |
p03309 | u706414019 | 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... | ["mport sys\nimport numpy as np\nimport math\nimport copy\ninput = sys.stdin.readline\n \nN = int(input())\nA = np.array(list(map(int,input().split())))\nr = np.array(list(range(1,N+1)))\nB = np.array(sorted(A-r))\nans = float('inf')\nfor i in range(max(N//2-1,0),max(N//2+2,N)):\n c = list(map(abs,(B - B[i])))\n ... | ['Runtime Error', 'Accepted'] | ['s535833915', 's670341183'] | [8844.0, 49604.0] | [24.0, 424.0] | [338, 391] |
p03309 | u722766569 | 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 sys import stdin\n\nn = int(stdin.readline().rstrip())\na = [int(x) for x in stdin.readline().rstrip().split()]\nma = max(a)\nindma = [i for i, x in enumerate(a) if x == max(a)]\nim = max(indma)\ns = 0\nc = 1\ni = 0\nwhile i < n:\n s += abs(a[i]-(ma-im+c))\n i = i+1\n c = c+1\nprint(s)\n', 'from sys imp... | ['Wrong Answer', 'Accepted'] | ['s721126140', 's773659037'] | [25872.0, 27240.0] | [2104.0, 263.0] | [287, 275] |
p03309 | u727478964 | 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... | ['macro_rules! input {\n ($ttype:ty) => {\n {\n let mut input = String::new();\n let _= std::io::stdin().read_line(&mut input);\n input.trim().parse::<$ttype>().unwrap()\n }\n };\n\n ($($ttype:ty),*) => {\n {\n use std::io::BufRead;\n ... | ['Runtime Error', 'Accepted'] | ['s441839395', 's956402565'] | [2940.0, 31472.0] | [17.0, 210.0] | [2302, 407] |
p03309 | u731368968 | 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\naa = [a[i] - i for i in range(n)]\naa.sort()\n\nprint(min(aa[n//2]))', 'n = int(input())\na = list(map(int, input().split()))\n\naa = [a[i] - i-1 for i in range(n)]\naa.sort()\n\nprint(aa[n//2])', 'n = int(input())\na = list(map(int, input().split()))\n\naa = [... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s418057414', 's513765138', 's355781826'] | [26184.0, 26708.0, 27844.0] | [170.0, 168.0, 201.0] | [119, 116, 169] |
p03309 | u736729525 | 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 findmin(l, u):\n memo={}\n def calc(b):\n score = memo.get(b, None)\n if not score is None:\n return score\n score = memo[b] = sum(abs(a-b) for a in A)\n return score\n d = (u-l)//3\n if d == 0:\n return min(calc(i) for i in range(l, u+1))\n left, rig... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s701131418', 's727143028', 's887038495'] | [26380.0, 25836.0, 26016.0] | [2105.0, 1983.0, 1988.0] | [847, 819, 1025] |
p03309 | u744344124 | 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 statistics\n\nn=int(input())\na=[]\nc=[]\nfor i in input().split():\n a.append(int(i))\n c.append(a[-1]-len(a))\n\nb=round(statistics.median(c))\nprint(b)\nk=0\n\nfor i in range(n):\n k+=abs(a[i]-b-1-i)\nprint(k)', '\nimport statistics\n\nn=int(input())\na=[]\nc=[]\nfor i in input().split():\n a.... | ['Wrong Answer', 'Accepted'] | ['s182227526', 's652889496'] | [37484.0, 38000.0] | [316.0, 301.0] | [214, 205] |
p03309 | u744920373 | 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\nsys.setrecursionlimit(10**8)\ndef ii(): return int(sys.stdin.readline())\ndef mi(): return map(int, sys.stdin.readline().split())\ndef li(): return list(map(int, sys.stdin.readline().split()))\ndef li2(N): return [list(map(int, sys.stdin.readline().split())) for _ in range(N)]\ndef dp2(ini, i, j): return ... | ['Wrong Answer', 'Accepted'] | ['s338117485', 's445166714'] | [25744.0, 25744.0] | [180.0, 232.0] | [796, 807] |
p03309 | u763968347 | 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 = []\nfor i,a_ in enumerate(A_):\n A.append(a_-i-1)\n\nd = {}\nfor a in A:\n if a in d.keys():\n d[a] += 1\n else:\n d[a] = 1\n\ncount = 0\nfor d_ in sorted(d.items()):\n if count >= len(d)/2:\n break\n count += d_[1]\n ... | ['Wrong Answer', 'Accepted'] | ['s964766354', 's601473976'] | [47132.0, 47260.0] | [542.0, 546.0] | [448, 435] |
p03309 | u780962115 | 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().split())\nlists=list(map(int,input().split())\nfor i in range(n):\n lists[i]-=(i+1)\nmini=10**100\nfor k in range(-10**9,10**9,1):\n sub=0\n for i in range(n):\n sub+=abs(list[i]-k)\n mini=min(mini,sub)\n \nprint(mini)', 'n=int(input())\nlists=list(map(int,input().split()))\... | ['Runtime Error', 'Time Limit Exceeded', 'Runtime Error', 'Accepted'] | ['s040690582', 's044828582', 's842824103', 's493518022'] | [2940.0, 26180.0, 25708.0, 26180.0] | [17.0, 2104.0, 190.0, 246.0] | [250, 244, 373, 369] |
p03309 | u781262926 | 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\ninputs = sys.stdin.readlines()\nn = int(inputs[0])\nA = list(map(int, inputs[1].split()))\n\nB = list(map(lambda x: x[1]-x[0], enumerate(A, 1)))\nb = floor(sum(B) / n)\nC = list(map(lambda x: abs(x-b), B))\nprint(sum(C))', 'import sys\nfrom math import floor, ceil\ninputs = sys.stdin.readlines()\n\nn = in... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s424917283', 's470531326', 's981907786', 's506394560'] | [27224.0, 3064.0, 3064.0, 29412.0] | [102.0, 19.0, 17.0, 225.0] | [224, 402, 330, 243] |
p03309 | u786150969 | 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\n\nN = int(input())\nan = list(map(int,input().split()))\n\nfor i in range(N):\n an[i] = an[i] - (i+1)\n \nb = int(median(bn))\n\nk = []\nfor i in range(N):\n y = abs(an[i] - b)\n k.append(y)\nans = sum(k)\n\nprint(ans)', 'import numpy as np\n\nN = int(input())\nan = list(map... | ['Runtime Error', 'Accepted'] | ['s556805091', 's115477371'] | [33888.0, 49484.0] | [108.0, 237.0] | [245, 242] |
p03309 | u787562674 | 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... | ['input_list = []\nindex = 1\nfor i in input().split():\n item = int(i) - index\n input_list.append(item)\n index += 1\n\ninput_list.sort()\nb = input_list[N//2]\nprint(sum(map(lambda x: abs(x-b), input_list)))', 'N = int(input())\ninput_list = [int(i) for i in input().split()]\n\nans1 = 0\nans2 = 0\n\nfor i i... | ['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s101920936', 's337403523', 's962129604', 's208901343'] | [3060.0, 25200.0, 44652.0, 26836.0] | [17.0, 111.0, 494.0, 232.0] | [208, 321, 508, 227] |
p03309 | u788137651 | 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# return a-1\n\n\nN = int(input())\nA = [int(i) for i in input().split()]\nfor i in range(len(A)):\n A[i] -= i+1\n# print(A)\naverage_A = sum(A) / N\nint_average = round(average_A)\n#print(average_A, int_average)\n"""\nprint([a for a in A]) # if a > 0])\nwhile len([a for a in A if a > 0]) > N // 2:\n A = ... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s682167113', 's881823758', 's488963141'] | [26128.0, 25196.0, 26180.0] | [855.0, 2105.0, 223.0] | [511, 513, 176] |
p03309 | u801359367 | 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\n\nN = int(input())\nA = list(map(int,input().split()))\nA = sorted(A)\n\nC = [A[i]-i for i in range(N)]\nprint(C) \nif N%2 ==1:\n B = C[int(N/2)]\nelse:\n B = C[int((N-1)/2)]+A[int((N+1)/2)]\n\nprint(sum(C)-N*B)\n', 'from statistics import median\n\nN = int(input())\nA = list(m... | ['Wrong Answer', 'Accepted'] | ['s954597887', 's289719414'] | [29156.0, 27228.0] | [212.0, 238.0] | [239, 283] |
p03309 | u804085889 | 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 collections\n\nif __name__ == "__main__" :\n n = int(input())\n array = list(map(int, input().split()))\n\n for i in range(0, n):\n array[i] = array[i] - (i + 1)\n c = collections.Counter(array)\n elem = int(c.most_common()[0][0])\n\n print(c.most_common()[0][0])\n \n for i in ra... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s438274541', 's592788982', 's691863696', 's866433005', 's836223641'] | [39912.0, 44092.0, 39912.0, 44092.0, 41048.0] | [327.0, 325.0, 324.0, 359.0, 386.0] | [397, 454, 430, 454, 587] |
p03309 | u804880764 | 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... | ["if __name__ == '__main__':\n N = int(input())\n A = list(map(int, input().split()))\n B = []\n ans = 10**9\n\n for i, a in enumerate(A):\n B.append(a - i - 1)\n\n print(B)\n for b in [min(B), max(B), (min(B)+max(B))//2]:\n tmp = 0\n for i, a in enumerate(A):\n tmp ... | ['Wrong Answer', 'Accepted'] | ['s340286525', 's127404745'] | [28624.0, 26184.0] | [356.0, 247.0] | [371, 287] |
p03309 | u813174766 | 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\na.sort()\nprint((a[n//2]+a[(n-1)//2])//2)', 'n=int(input())\na=list(map(int,input().split()))\nfor i in range(n):\n a[i]-=i\na.sort()\nb=(a[n//2]+a[(n-1)//2])//2\nprint(sum(abs(i-b) for i in a))'] | ['Wrong Answer', 'Accepted'] | ['s453533664', 's025202501'] | [26836.0, 26836.0] | [172.0, 211.0] | [117, 144] |
p03309 | u818213347 | 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())\nl = list(map(int,input().split()))\n\nfor i in range(n):\n l[i] = l[i] - i-1\nprint(sorted(l))\nif n % 2 == 1:\n print(sum(list(map(lambda x: x-l[((n//2)+1)],l))))\nelse:\n print(max(sum(list(map(lambda x: x-l[(n//2)],l))),sum(list(map(lambda x: x-l[((n//2)+1)],l)))))\n', 'n = int(input())\... | ['Runtime Error', 'Accepted'] | ['s260044102', 's003600883'] | [31224.0, 31192.0] | [209.0, 219.0] | [287, 290] |
p03309 | u827202523 | 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())\nnums = input().split(" ")\nnums2 = [int(x)-i-1 for i,x in enumerate(nums)]\nnums2.sort()\nlength = len(nums2)\nnumpre = 0\nsame = 1\nif length == 1:\n value = nums2[0]\n\nfor n,m in zip(nums2[:-1],nums2[1:]):\n print("c")\n if n == m:\n same += 1\n else:\n impact = same + numpre\n if im... | ['Wrong Answer', 'Accepted'] | ['s491049636', 's943370359'] | [29960.0, 28936.0] | [321.0, 271.0] | [462, 451] |
p03309 | u832039789 | 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 = sorted(a)\n\ndef calc(mid):\n res = 0\n for i in a:\n res += abs(i-mid)\n return res\n\nif n%2==1:\n res = calc(a[n//2])\nelse:\n res = float('inf')\n if (a[n//2-1]+a[n//2])%2==0:\n res = calc((a[n//2-1]+a[n//2])//2)\n else:\n mid = (a[n//2-1]+... | ['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s174583807', 's496998771', 's923100845', 's530713998'] | [25708.0, 25196.0, 25968.0, 26180.0] | [175.0, 230.0, 342.0, 294.0] | [364, 259, 460, 344] |
p03309 | u842950479 | 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().rstrip().split()))\nB=list(A[i]-i for i in range(N))\nC=B.sort()\nwork=C[N//2]\ntestA=sum(abs(B[i]-work) for i in range(N))\ntestB=sum(abs(B[i]-work-1) for i in range(N))\ntestC=sum(abs(B[i]-work+1) for i in range(N))\noutput=min(testA,testB,testC)\nprint(output)', 'N=int(input... | ['Runtime Error', 'Accepted'] | ['s367019529', 's414052122'] | [25744.0, 29772.0] | [171.0, 285.0] | [294, 325] |
p03309 | u846226907 | 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 = 10000000\nfor i in range(100):\n sum = 0\n for j in range(n):\n sum = sum + abs(a[j] - (i + n))\n\n if sum < b:\n c = i\n b = sum\n\n\nprint(c)\n\n\n', 'n = int(input())\n\na = list(map(int,input().split()))\n\n\nfor i in range(... | ['Runtime Error', 'Accepted'] | ['s252467709', 's502410076'] | [26360.0, 26180.0] | [2104.0, 234.0] | [222, 208] |
p03309 | u849290552 | 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\ndef kanashimi(b):\n \n out = 0\n for i in range(N):\n out = out + abs(A[i]-(b+(i+1)))\n return out \nans = 10**20\nfor i in range(-100,100):\n ans = min(ans,kanashimi(i))\nprint(ans)', "N = int(input().strip())\nA = list(map(int,input().strip().split(' ')))\n\n\nimport statistics\... | ['Runtime Error', 'Accepted'] | ['s175779548', 's743474279'] | [3060.0, 25196.0] | [22.0, 251.0] | [208, 306] |
p03309 | u855380359 | 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()))\nans = 0\nnans = 0\nfor i in range(10**9):\n for j in range(n):\n ans += abs(a[j]-i-j)\n if ans <= nans:\n nans =ans\nprint(nans)', 'n = int(input())\na = list(map(int, input().split()))\n\nbox = [0]*n\nans = 0\nfor i in range(n):\n box[i] =... | ['Time Limit Exceeded', 'Accepted'] | ['s632525995', 's572096691'] | [26016.0, 26180.0] | [2107.0, 249.0] | [194, 215] |
p03309 | u856169020 | 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... | ['ans = 9999999\nres = 0\nfor i in range(N):\n res += A[i] - (i+1)\n\nb = res // N\nres = 0\nfor i in range(N):\n res += abs(A[i] - (b+(i+1)))\nprint(res)\n', "N = int(input())\nA = list(map(int, input().split()))\n\nA_sorted = sorted([A[i] - (i+1) for i in range(N)])\n\nif len(A) != 1:\n b = A_sorted[int((len... | ['Runtime Error', 'Accepted'] | ['s507537028', 's333155243'] | [2940.0, 27720.0] | [17.0, 238.0] | [150, 367] |
p03309 | u858523893 | 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\nmin_sum = -1\ni_atmin = -1\n\n\ni = min(a)\nwhile(i <= max(a)) : \n sum_over = 0\n sum_over_minus = 0\n \n for j in range(N) :\n sum_over += abs(a[j] - (i + j))\n \n for j in range(N) :\n sum_over_minus += abs(a[j] - (j - ... | ['Wrong Answer', 'Accepted'] | ['s448985710', 's715956040'] | [25708.0, 26020.0] | [2104.0, 268.0] | [627, 457] |
p03309 | u861095163 | 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... | ['fun main(args : Array<String>) {\n val N = readLine()!!.toInt()\n val A = readLine()!!.split(" ").map { it.toInt() }\n val B = (1..N).map {\n val index = it - 1\n A.get(index) - it\n }.toMutableList()\n B.sort()\n\n val median = B.get(N / 2)\n val answer = B.map { Math.abs(it - medi... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s310733332', 's698098193', 's810553597'] | [2940.0, 2940.0, 25200.0] | [17.0, 17.0, 191.0] | [342, 321, 229] |
p03309 | u866949333 | 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 = [int(i) for i in input().split()]\n\nA_minus_i = [A[i] - (i+1) for i in range(N)]\n\n# print(A)\n# print(A_minus_i)\n\nbf = np.average(A_minus_i)\n# print(bf)\n\n# b_l = int(bf)+1\n# b_m = int(bf)\n# b_s = int(bf)-1\n#\n# score_l = sum([abs(a - b_l) for a in A_minus_i])\n# ... | ['Wrong Answer', 'Accepted'] | ['s583316957', 's875003786'] | [37388.0, 36160.0] | [516.0, 352.0] | [468, 491] |
p03309 | u875361824 | 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\n\n\ndef main():\n """\n 1 <= N <= 2 * 10^5\n 1 <= ai <= 10^9\n """\n N = int(input())\n *A, = map(int, input().split())\n\n ans = f(N, A)\n print(ans)\n\n\ndef f(N, A):\n \n C = [a - i for i, a in enumerate(A, 1)]\n b = sum(C) // N\n print(b)\n print(C)\n ans = s... | ['Wrong Answer', 'Accepted'] | ['s886550918', 's255671523'] | [28648.0, 25708.0] | [126.0, 187.0] | [449, 523] |
p03309 | u901582103 | 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(round(sum(A)/n))', 'n=int(input())\nA=list(map(int,input().split()))\nB=sorted([A[i]-(i+1) for i in range(n)])\nif n%2==1:\n b=B[n//2]\nelse:\n b=(B[n//2-1]+B[n//2])//2\nr=0\nfor i in range(n):\n r+=abs(B[i]-b)\npr... | ['Wrong Answer', 'Accepted'] | ['s848700171', 's762958388'] | [26180.0, 25196.0] | [110.0, 224.0] | [107, 199] |
p03309 | u903948194 | 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_ = [n - (i+1) for i, n in enumerate(a) ]\n\nb = sum(a_) // N\nb_ = b + 1\ns = [abs(n - b) for i, n in enumerate(a_)]\ns_ = [abs(n - b_) for i, n in enumerate(a_)]\n\nprint(min(sum(s), sum(s_))', 'N = int(input())\na = list(map(int, input().split()))\na_ = sorte... | ['Runtime Error', 'Accepted'] | ['s354408753', 's302715941'] | [3064.0, 27588.0] | [18.0, 210.0] | [240, 221] |
p03309 | u905203728 | 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\nimport math\nn=int(input())\nbox=list(map(int,input().split()))\nmedian=int(statistics.median(box))\ncount=0\nfor x,y in enumerate(box):\n count +=abs(y-(x+1-median))\nprint(count)', 'from statistics import median\nn=int(input())\nA=list(map(int,input().split()))\n\nB=[A[i]-(i+1) for i in range(... | ['Wrong Answer', 'Accepted'] | ['s049236296', 's259567976'] | [27244.0, 27256.0] | [220.0, 277.0] | [194, 204] |
p03309 | u909162870 | 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()))\nud = list()\nfor i in range(n):\n ud.append(a[i] - i)\nud.sort()\nprint(ud,)\nans = 0\nfor i in range(n):\n print(abs(ud[i] - ud[n // 2]))\n ans += abs(ud[i] - ud[n // 2])\nprint(ans)', 'n = int(input())\na = list(map(int, input().split()))\nud = list()\... | ['Wrong Answer', 'Accepted'] | ['s048925420', 's075175921'] | [26144.0, 26836.0] | [502.0, 246.0] | [236, 190] |
p03309 | u909991537 | 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([int(i) for i in input().split()])\n\nmin_num = 100000000000\n\nfor x in range(-(max(a)), max(a) + 1):\n min_sum = sum(abs(a - np.ones(len(a)) * x - np.array(range(1, n + 1))))\n #print(abs(a - np.array(range(1, n + 1))))\n if min_sum < min_num:\n min_num = min... | ['Wrong Answer', 'Accepted'] | ['s987766641', 's038884007'] | [34192.0, 38356.0] | [2109.0, 522.0] | [328, 245] |
p03309 | u923662841 | 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(a)-i-1 for i,a in enumerate(input().split(),1)]\nA.sort()\nb = int(sum(a)/len(a))\nc = 10**9\nfor j in range(b-10, b+11):\n k = sum(map(lambda x:abs(x-j), A))\n c = min(c,k)\nprint(c)', 'N=int(input())\nA=sorted(a-i-1 for i,a in enumerate(map(int,input().split())))\nprint(sum(abs(a-A[... | ['Runtime Error', 'Accepted'] | ['s681773386', 's307361938'] | [30948.0, 31160.0] | [137.0, 159.0] | [208, 115] |
p03309 | u924406834 | 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\nxave = ((n*(n-1))/2)/n\nyave = sum(a)/n\ncov = 0\nfor i in range(n):\n cov += (i+1-xave)*(a[i]-yave)\ncov = cov/n\n\ndps = 0\nfor i in range(n):\n dps += (i+1-xave)**2\ndps = dps / n\nA = cov / dps\nB = int(yave - A * xave)\nansls = []\nfor j in range(2):\... | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s045327584', 's669978324', 's835791639', 's931386678'] | [26016.0, 26020.0, 26016.0, 27252.0] | [371.0, 238.0, 2104.0, 366.0] | [464, 491, 464, 454] |
p03309 | u941753895 | 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())\nl=list(map(int,input().split()))\nif ' '.join([str(x) for x in l])=='2 2 3 5 5':\n exit()\ns=[0]*2\nf='first'\nf2='front'\nb=1\nans=0\nfor i in range(n):\n s[0]+=abs(l[i]-(i+1))\nwhile True:\n if f2=='front':\n for i in range(n):\n s[1]+=abs(l[i]-(b+i+1))\n if s[0]<s[1]:\n if f=='fi... | ['Wrong Answer', 'Accepted'] | ['s430577948', 's479797295'] | [28100.0, 27820.0] | [2104.0, 236.0] | [623, 732] |
p03309 | u944325914 | 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)\nimport numpy as np\nan=np.array(a)\nb=np.median(an)\nans=0\nfor i in a:\n ans+=abs(i-b)\nprint(ans)', 'n=int(input())\na=list(map(int,input().split()))\nfor i in range(n):\n a[i]=a[i]-(i+1)\nimport numpy as np\nan=np.arra... | ['Wrong Answer', 'Accepted'] | ['s529980248', 's479085666'] | [37636.0, 37788.0] | [281.0, 230.0] | [183, 188] |
p03309 | u945181840 | 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 = [A[i] - (i + 1) for i in range(N)]\nb = round(sum(A) // N)\nprint(A, b)\nans = 0\n\nfor i in A:\n ans += abs(i - b)\n\nprint(ans)', 'import statistics\n\nN = int(input())\nA = list(map(int, input().split()))\n\nB = [A[i] - (i + 1) for i in range(N)]\nb =... | ['Wrong Answer', 'Accepted'] | ['s669337652', 's700327778'] | [26128.0, 27256.0] | [154.0, 224.0] | [182, 196] |
p03309 | u945200821 | 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 numpy as np\n\n\ndef main():\n readline = sys.stdin.readline\n \n n = int(readline().rstrip())\n a = np.array(\n tuple(int(a_i) for a_i in readline().rstrip().split())\n )\n \n b = int(np.median(a - np.arange(1, n + 1)))\n \n print(b)\n \n\nif __name__ == "__main__":\n main()\n', 'imp... | ['Wrong Answer', 'Accepted'] | ['s395600690', 's120744617'] | [34424.0, 34388.0] | [226.0, 227.0] | [292, 334] |
p03309 | u952022797 | 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 -*-\nimport sys\nimport copy\nimport collections\nfrom bisect import bisect_left\nfrom bisect import bisect_right\nfrom collections import defaultdict\nfrom heapq import heappop, heappush\nimport numpy as np\n\ndef main():\n\tN = int(input())\n\tA = list(map(int, input().split(" ")))\n\t\n\tA_tmp ... | ['Wrong Answer', 'Accepted'] | ['s893157061', 's786615205'] | [34220.0, 35384.0] | [261.0, 750.0] | [530, 559] |
p03309 | u957167787 | 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\nC = []\nfor i in range(N):\n C.append(A[i] - (i+1))\nave = sum(C) / N\n\nblist = []\nblist.append(ave // 1)\nblist.append((ave + 1) // 1)\n\nans = 10**15\nfor b in blist:\n tmp = 0\n for c in C:\n tmp += abs(c - b)\n ans = min(... | ['Wrong Answer', 'Accepted'] | ['s510473278', 's564422339'] | [26832.0, 26832.0] | [201.0, 258.0] | [320, 278] |
p03309 | u963903527 | 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 = input()\nxs = input().split(" ")\n\nl = list()\nfor x in xs:\n\tl.append(int(x))\n\n\nll = list()\nfor index, argv in enumerate(l):\n\tfor x in range(max(l)):\n\t\tls = list()\t\t\n\t\tab = abs(argv - (n + index))\n\t\tls.append(ab)\n\tll.append(ls)\n\nsum_list = list()\nfor line in ls:\n\ts = sum(line)\n\tsum_li... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s062453996', 's632884644', 's026631870'] | [26180.0, 261876.0, 33108.0] | [100.0, 2120.0, 216.0] | [321, 321, 163] |
p03309 | u964299793 | 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=list(map(int,input().split()))\nc=list(map(int,input().split()))\na.sort()\nb.sort()\nc.sort()\nn=len(a)\nj=0\nk=0\nfor i in range(n):\n while j<n and b[j]<=a[i]:\n j+=1\n while k<n and c[k]<=b[j]:\n k+=1\n\n', 'n=int(input())\na=list(map(int,inp... | ['Runtime Error', 'Accepted'] | ['s433211162', 's357286837'] | [26836.0, 25200.0] | [66.0, 224.0] | [264, 288] |
p03309 | u978494963 | 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 pprint import pprint\nfrom statistics import median\n\nN = int(input())\nAs = list(map(int, input().split(" ")))\n\n# pprint(As)\n\nb = median(As)\n\nans = 0\n\nfor i, A in enumerate(As):\n ans += abs(A-b-i)\n\nprint(ans)', 'from pprint import pprint\n\nN = int(input())\nAs = list(map(int, input().split(" "))... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s276457648', 's579160292', 's670045622'] | [27268.0, 29980.0, 27260.0] | [233.0, 167.0, 211.0] | [214, 283, 243] |
p03309 | u979823197 | 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()))\ndef quick_sort(a):\n if len(a) <= 1:\n return a\n else:\n b = []\n c = []\n for i in range(1, len(a)):\n if a[i] < a[0]:\n b.append(a[i])\n else:\n c.append(a[i])\n return qui... | ['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s486060960', 's622870246', 's788243541', 's739049528'] | [143012.0, 140688.0, 142828.0, 26180.0] | [2112.0, 2116.0, 2112.0, 221.0] | [726, 748, 579, 221] |
p03309 | u982591663 | 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\n\nN = int(input())\nA = list(map(int, input().split()))\nans = 10**18\ndists_A2i = []\n\nfor i in range(1, N+1):\n dist_A2i = A[i-1] - i\n dists_A2i.append(dist_A2i)\n\nc = collections.Counter(dists_A2i)\n\nmax_c_list = [key for key, value in c.items() if value == max(c.v... | ['Wrong Answer', 'Accepted'] | ['s018411540', 's546983574'] | [49972.0, 34160.0] | [2110.0, 332.0] | [507, 345] |
p03309 | u982896977 | 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 = list(map(int,input().split()))\nwa = 0\nfor i in range(n):\n\ta[i] = a[i] - (i + 1)\n\twa += a[i]\nb = round(wa/n)\nans = 0\nfor i in range(n):\n\tans += abs(a[i] - b)\nprint(ans)', 'n = int(input())\na = list(map(int,input().split()))\na2 = [a[x] - (x + 1) for x in range(n)]\na2.sort()\nc = n // 2\nb = a2[c]\nan... | ['Runtime Error', 'Accepted'] | ['s418346492', 's781071429'] | [3064.0, 26356.0] | [18.0, 222.0] | [171, 183] |
p03309 | u989157442 | 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\nn = int(input())\na = list(map(int, input().split()))\nb = []\n_sum = 0\nfor i in range(n):\n b.append(a[i] - i - 1)\nprint(med)\nfor i in range(n):\n _sum += abs(b[i] - med)\nprint(int(_sum))\n', '\nfrom statistics import median\nn = int(input())\na = list(map(int, input().spli... | ['Runtime Error', 'Accepted'] | ['s917896539', 's962991633'] | [27316.0, 27252.0] | [131.0, 256.0] | [243, 248] |
p03309 | u989345508 | 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())\ns=input().split()\na=sorted([int(s[i])-i-1 for i in range(n)])\n\nif n==1:\n print(0)\nelse:\n mi=[]\n k=sum(a)\n for i in range(n-1):\n c,d=a[i],a[i+1]\n k-=2*a[i]\n m=k\n l=(i+1)-(n-i-1)\n if l>0:\n m+=(l*a[i+1])\n else:\n m... | ['Wrong Answer', 'Accepted'] | ['s420441928', 's172371850'] | [34780.0, 26020.0] | [377.0, 396.0] | [401, 292] |
p03309 | u992910889 | 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\nimport sys\nsys.setrecursionlimit(10 ** 5 + 10)\n# input = sys.stdin.readline\n\ndef resolve():\n N=int(input())\n A=np.array(list(map(int,input().split())))\n\n B=np.array([i for i in range(1,N+1)])\n\n A=A-B\n val=0\n for i in A:\n val += abs(i - statistics.median(A))\n ... | ['Runtime Error', 'Accepted'] | ['s246611338', 's964163873'] | [5400.0, 34164.0] | [42.0, 538.0] | [330, 555] |
p03309 | u994521204 | 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())\nhikumono = n * (n-1)//2\nA = np.array(list(map(int, input().split())))\nB = np.array([i+1 for i in range(n)])\nC=A-B\nheikin1 = np.median(C)//1\nheikin2 = heikin1 + 1\nheikin3 = heikin1 - 1\nans1 = abs(C-heikin1).sum()\nans2 = abs(C-heikin2).sum()\nans3 = abs(C-heikin3).sum()\npr... | ['Wrong Answer', 'Accepted'] | ['s441314962', 's593858361'] | [34192.0, 34184.0] | [241.0, 246.0] | [332, 334] |
p03309 | u996749146 | 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\n\n\n\n# 7\n# 1 1 1 1 2 3 4\n#import sys\n\nN = int(input())\na = list(map(int, input().strip().split(" ")))\n\nfor i in range(N):\n a[i] = a[i] - (i+1)\n\na.sort()\nif N % 2 != 0:\n mid = (N-1)/2 +1\nelse:\n mid = N / 2\nb = a[mid]\n\nsadness_left = b * (mid-1) - sum(a[:mid])\nsadness = sum(a) - b * N + ... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s423847890', 's658731548', 's609152142'] | [26708.0, 25748.0, 26128.0] | [183.0, 218.0, 194.0] | [437, 444, 434] |
p03309 | u997641430 | 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 for i in range(N)]\nC=median(B)\nprint(sum([b-C for b in B]))', 'N=int(input())\nA=list(map(int,input().split()))\nB=sorted([A[i]-i for i in range(N)])\nif N%2==0:\n\tC=int((B[int(N/2)]+B[int(N/2-1)])/2)\nelse:\n\tC=B[int((N-1)/2)]\nprint(sum([abs(b-C) for b... | ['Runtime Error', 'Accepted'] | ['s277486555', 's737391816'] | [25196.0, 27588.0] | [88.0, 192.0] | [117, 192] |
p03311 | u102126195 | 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())\ndata = list(map(int, input().split()))\nfor i in range(N):\n data[i] -= (i + 1)\nave = sum(data) / N\nif ave > 0:\n key = int(ave + 1)\n key1 = int(ave)\nelse:\n key = int(ave - 1)\n key1 = int(ave)\ndata.sort()\nsumdata = 0\nsumdata2 = 0\nkey = data[int(N / 2) - 1]\nkey2 = data[int(N... | ['Wrong Answer', 'Accepted'] | ['s185407590', 's886137484'] | [26180.0, 25708.0] | [275.0, 274.0] | [469, 445] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.