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 |
|---|---|---|---|---|---|---|---|---|---|---|
p03012 | u143051858 | 2,000 | 1,048,576 | We have N weights indexed 1 to N. The mass of the weight indexed i is W_i. We will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \leq T < N. Let S_1 be the sum of the masses of the weights in the former group, and S_2 be th... | ['N = int(input())\nW = list(map(int,input().split()))\ns1 = 0;s2 = 0\nmin = 1001001001\nfor T in range(1,N-1):\n for i in range(T):\n s1 += W[i]\n for i in range(T,N):\n s2 += W[i]\n if abs(s1-s2) < min:\n min = abs(s1-s2)\n s1 = 0;s2 = 0\nprint(min)', 'N = int(input())\nW = list(map(int,input().split()))... | ['Wrong Answer', 'Accepted'] | ['s908172684', 's536157085'] | [3064.0, 3064.0] | [18.0, 18.0] | [250, 248] |
p03012 | u143492911 | 2,000 | 1,048,576 | We have N weights indexed 1 to N. The mass of the weight indexed i is W_i. We will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \leq T < N. Let S_1 be the sum of the masses of the weights in the former group, and S_2 be th... | ['n=int(input())\nw=list(map(int,input().split()))\nans=[]\nfor i in range(n):\n small_total=0\n big_total=0\n for j in range(n):\n if w[i]<=j:\n small_total+=w[i]\n else:\n big_total+=w[i]\n ans.append(abs(small_total-big_total))\nprint(min(ans))\n\n', 'n=int(input())\nw... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s005081893', 's066277025', 's454856309'] | [3060.0, 2940.0, 3060.0] | [19.0, 17.0, 20.0] | [283, 151, 166] |
p03012 | u145600939 | 2,000 | 1,048,576 | We have N weights indexed 1 to N. The mass of the weight indexed i is W_i. We will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \leq T < N. Let S_1 be the sum of the masses of the weights in the former group, and S_2 be th... | ['n = int(input())\nw = list(map(int,input().split()))\nans = 1e100\nfor t in w:\n over = 0\n under= 0\n for i in w:\n if i > w:\n over += i\n else:\n under+= i\n ans = min(ans,abs(over - under))\nprint(ans)\n', 'n = int(input())\nw = list(map(int,input().split()))\nans = 1e100\nfor i in range(1,n):... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s076556704', 's655921080', 's635101965'] | [2940.0, 2940.0, 2940.0] | [17.0, 18.0, 17.0] | [214, 135, 142] |
p03012 | u156113867 | 2,000 | 1,048,576 | We have N weights indexed 1 to N. The mass of the weight indexed i is W_i. We will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \leq T < N. Let S_1 be the sum of the masses of the weights in the former group, and S_2 be th... | ['N = int(input())\nW = list(map(int, input().split()))\n \ndef calc_sum(W, T):\n S1 = sum(W[:T])\n S2 = sum(W[T:])\n return S1, S2\n \ndef calc_abs(S1, S2):\n return abs(S1-S2)\n \nmin_ = 1000\nfor i in range(len(W)):\n S1, S1 = calc_sum(W, i)\n j = calc_abs(S1, S2)\n if j < min_:\n min_ = j\n \nprint(mi... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s271283412', 's560829264', 's797707764'] | [3316.0, 3064.0, 3064.0] | [21.0, 17.0, 17.0] | [303, 295, 303] |
p03012 | u164149485 | 2,000 | 1,048,576 | We have N weights indexed 1 to N. The mass of the weight indexed i is W_i. We will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \leq T < N. Let S_1 be the sum of the masses of the weights in the former group, and S_2 be th... | ['import sys\ninput = sys.stdin.readline\nsuuzi = int(input())\nnum = []\nnum = [int(i) for i in input().split()]\n\nsa = sum(num)\nfor i in range(suuzi):\n left = sum(num[:i])\n right = sum(num[i:])\n temp_sa = right - left\n if i == len(num):\n print(temp_sa)\n break;\n elif temp_sa < 0:\... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s273182805', 's704145808', 's753109886'] | [3064.0, 3064.0, 3064.0] | [17.0, 17.0, 17.0] | [432, 451, 430] |
p03012 | u169138653 | 2,000 | 1,048,576 | We have N weights indexed 1 to N. The mass of the weight indexed i is W_i. We will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \leq T < N. Let S_1 be the sum of the masses of the weights in the former group, and S_2 be th... | ['n=int(input())\nw=list(map(int,input().split()))\ns=sum(w)\ncnt=0\nt=10**5\nfor i in range(n):\n cnt+=w[i]\n t=min(t,abs(s-2*cnt))', 'n=int(input())\nw=list(map(int,input().split()))\ns=sum(w)\ncnt=0\nt=10**5\nfor i in range(n):\n cnt+=w[i]\n t=min(t,abs(s-2*cnt))\nprint(t)'] | ['Wrong Answer', 'Accepted'] | ['s590764345', 's740225769'] | [2940.0, 2940.0] | [17.0, 18.0] | [125, 134] |
p03012 | u172569352 | 2,000 | 1,048,576 | We have N weights indexed 1 to N. The mass of the weight indexed i is W_i. We will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \leq T < N. Let S_1 be the sum of the masses of the weights in the former group, and S_2 be th... | ['N = int(input())\nW = [int(i) for i in input().split()]\ncalc(N, W)\ndef calc(n, w):\n min_sub = 100000\n N = n\n num = w\n for i in range(1,N):\n S1 = num[:i]\n S2 = num[i:]\n sub = abs(sum(S1)-sum(S2))\n if min_sub > sub:\n min_sub = sub\n print(min_sub)', 'def ... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s012248222', 's274048003', 's315834543', 's860428693', 's072212925'] | [3064.0, 3060.0, 3188.0, 3060.0, 3060.0] | [18.0, 18.0, 19.0, 18.0, 17.0] | [297, 303, 336, 277, 306] |
p03012 | u172785970 | 2,000 | 1,048,576 | We have N weights indexed 1 to N. The mass of the weight indexed i is W_i. We will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \leq T < N. Let S_1 be the sum of the masses of the weights in the former group, and S_2 be th... | ['n=int(input())\nw=list(map(int,input().split()))\nans=10000\n\nfor i in range(n):\n\twl=sum([w[j] for j in range(i)])\n\twr=sum([w[j] for j in range(i,n)])\n\twlr=wl-wr\n\tprint(i,wl,wr,wlr)\n\tif wlr<0:\n\t\twlr=wlr*(-1)\n\tans=min(ans,wlr)\n\nprint(ans)', 'n=int(input())\nw=list(map(int,input().split()))\nans=10000... | ['Wrong Answer', 'Accepted'] | ['s488404088', 's417385332'] | [3064.0, 3064.0] | [18.0, 19.0] | [234, 214] |
p03012 | u173374079 | 2,000 | 1,048,576 | We have N weights indexed 1 to N. The mass of the weight indexed i is W_i. We will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \leq T < N. Let S_1 be the sum of the masses of the weights in the former group, and S_2 be th... | ['n = int(input())\nw = map(int,input().split())\n\nl = 0\nr = sum(w)\nres = r\n\nfor i in w:\n l += i\n r -= i\n if abs(r - l) > res:\n break\n res = abs(r - l)\n\nprint(res)\n', '_ = input()\nw = list(map(int,input().split()))\n\nl = 0\nr = sum(w)\nres = r\n\nfor i in w:\n l += i\n r -= i\n if abs(r - l) > ... | ['Wrong Answer', 'Accepted'] | ['s017609699', 's110173257'] | [2940.0, 3060.0] | [17.0, 19.0] | [167, 168] |
p03012 | u175590965 | 2,000 | 1,048,576 | We have N weights indexed 1 to N. The mass of the weight indexed i is W_i. We will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \leq T < N. Let S_1 be the sum of the masses of the weights in the former group, and S_2 be th... | ['n = int(input())\nw = list(map(int,input().split()))\nans = []\nfor i in range(1,n):\n ans.append(abs(sum(l[:i])-sum(l[i:])))\nprint(min(ans))', 'n = int(input())\nw = list(map(int,input().split()))\nans = []\nfor i in range(1,n):\n ans.append(abs(sum(l[:i])-sum(l[i:])))\nprint(min(ans))', 'n = int(input())\nw ... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s258688601', 's661700212', 's802143600'] | [3060.0, 3060.0, 3060.0] | [17.0, 18.0, 18.0] | [140, 140, 140] |
p03012 | u177756077 | 2,000 | 1,048,576 | We have N weights indexed 1 to N. The mass of the weight indexed i is W_i. We will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \leq T < N. Let S_1 be the sum of the masses of the weights in the former group, and S_2 be th... | ['N=int(input())\nW=list(map(int,input().split()))\n\ndiff=[]\nfor i in range(N-1):\n diff.append(abs(sum(W[:i+1])-sum(W[i+1:])))\nprint(min(diff)', 'N=int(input())\nW=list(map(int,input().split()))\n\ndiff=[]\nfor i in range(N-1):\n diff.append(abs(sum(W[:i+1])-sum(W[i+1:])))\nprint(min(diff))\n'] | ['Runtime Error', 'Accepted'] | ['s950988854', 's375705483'] | [2940.0, 2940.0] | [17.0, 17.0] | [141, 143] |
p03012 | u185393907 | 2,000 | 1,048,576 | We have N weights indexed 1 to N. The mass of the weight indexed i is W_i. We will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \leq T < N. Let S_1 be the sum of the masses of the weights in the former group, and S_2 be th... | ['n = int(input())\nw = list(map(int,input().split())\nans = 10000000\nsumpoint = 0\nfor i in range (n):\n sumpoint = sumpoint + w[i];\n ans = min(ans, abs(sum(w)-sumpoint))\nprint(ans)', 'n = int(input())\nw = list(map(int,input().split()))\nans = 10000000\nsumpoint = 0\nfor i in range (n):\n sumpoint += w[i]... | ['Runtime Error', 'Accepted'] | ['s353880985', 's640918574'] | [2940.0, 3060.0] | [17.0, 18.0] | [182, 176] |
p03012 | u185966380 | 2,000 | 1,048,576 | We have N weights indexed 1 to N. The mass of the weight indexed i is W_i. We will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \leq T < N. Let S_1 be the sum of the masses of the weights in the former group, and S_2 be th... | ['N = int(input())\nW = list(map(int, input().split()))\nans = [abs(W[0:i+1] - W[i+1:]) for i in range(N-1)]\nprint(min(ans))\n', 'N = int(input())\nW = []\nfor i in range(N):\n w = int(input())\n if i == 0:\n W.append(w)\n continue\n \n W.append(w + W[i-1])\n \nans = [abs((2 * q) - W[N-1]) for q in W]\npr... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s011311938', 's096916808', 's784639543', 's943710479'] | [2940.0, 2940.0, 2940.0, 2940.0] | [17.0, 17.0, 17.0, 17.0] | [121, 192, 119, 131] |
p03012 | u188827677 | 2,000 | 1,048,576 | We have N weights indexed 1 to N. The mass of the weight indexed i is W_i. We will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \leq T < N. Let S_1 be the sum of the masses of the weights in the former group, and S_2 be th... | ['n = int(input())\nw = list(map(int, input().split()))\n\ns1, s2 = 0, sum(w)\nans = sum(w)\n\nfor i in range(n):\n s1 += w[i]\n s2 -= w[i]\n ans = min(ans, abs(s1, - s2))\nprint(ans)', 'n = int(input())\nw = list(map(int, input().split()))\n\na = 0\nb = sum(w)\nfor i in w:\n a += i\n b -= i\n if a > b:\n brea... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s440342423', 's923720984', 's683671920'] | [3060.0, 2940.0, 9100.0] | [17.0, 17.0, 25.0] | [174, 138, 177] |
p03012 | u193598069 | 2,000 | 1,048,576 | We have N weights indexed 1 to N. The mass of the weight indexed i is W_i. We will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \leq T < N. Let S_1 be the sum of the masses of the weights in the former group, and S_2 be th... | ['N = int(input())\nS = list(map(int, input().split()))\nans = 10000\n\nfor T in range(1, N):\n s1 = sum(S[:T+1])\n s2 = sum(S[T+2:])\n\n diff = abs(s1 - s2)\n if diff < ans:\n ans = diff\n \nprint (ans)\n\n\n', 'N = int(input())\nS = list(map(int, input().split()))\nans = 10000\n\nfor T in ra... | ['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s216429409', 's807018226', 's947488975', 's178005248'] | [2940.0, 2940.0, 3060.0, 3060.0] | [17.0, 18.0, 17.0, 17.0] | [218, 216, 290, 218] |
p03012 | u196579381 | 2,000 | 1,048,576 | We have N weights indexed 1 to N. The mass of the weight indexed i is W_i. We will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \leq T < N. Let S_1 be the sum of the masses of the weights in the former group, and S_2 be th... | ['input()\nn = [int(i) for i in input().split()]\nans = abs(n[0]-sum(n[1:]))\nfor i in range(1, len(n)):\n tmp = abs(sum(n[:i])-sum(n[i:]))\n print(i)\n if ans > tmp:\n ans = tmp\n\nprint(ans)\n', 'input()\nn = [int(i) for i in input().split()]\nans = abs(n[0]-sum(n[1:]))\nfor i in range(1, len(n)):\n ... | ['Wrong Answer', 'Accepted'] | ['s386398581', 's455862123'] | [3060.0, 2940.0] | [18.0, 18.0] | [198, 185] |
p03012 | u196697332 | 2,000 | 1,048,576 | We have N weights indexed 1 to N. The mass of the weight indexed i is W_i. We will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \leq T < N. Let S_1 be the sum of the masses of the weights in the former group, and S_2 be th... | ['from math import abs\nN = int(input())\n\nweight_list = list(map(int, input().split()))\n\ntotal_list = [0] * N\nfor i in range(N):\n list_one = weight_list[: i + 1]\n list_two = weight_list[i + 1:]\n \n abs_diff = math.abs(sum(list_one) - sum(list_two))\n \n total_list[i] = abs_diff\nprint(min(tota... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s245358897', 's665806254', 's758069074'] | [3188.0, 3060.0, 3060.0] | [18.0, 17.0, 17.0] | [313, 308, 315] |
p03012 | u197922478 | 2,000 | 1,048,576 | We have N weights indexed 1 to N. The mass of the weight indexed i is W_i. We will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \leq T < N. Let S_1 be the sum of the masses of the weights in the former group, and S_2 be th... | ['weight_num = int(input())\nweight_list = input().split(" ")\nt = int(input())\nheavy_list = []\nlight_list = []\nfor i in range(len(weight_list)):\n weight_list[i] = int(weight_list[i])\n\n if i>=t:\n heavy_list.append(weight_list[i])\n else:\n light_list.append(weight_list[i])\n\ns1=sum(heavy_... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s227617842', 's780086238', 's093928803'] | [3064.0, 3064.0, 3064.0] | [17.0, 17.0, 17.0] | [381, 383, 596] |
p03012 | u200527996 | 2,000 | 1,048,576 | We have N weights indexed 1 to N. The mass of the weight indexed i is W_i. We will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \leq T < N. Let S_1 be the sum of the masses of the weights in the former group, and S_2 be th... | ['import math\nN = int(input())\nW = list(map(int, input().split()))\nallw = sum(W)\ntmp = []\nfor j in range(N):\n tmp.append(abs(sum(W[:j])-sum(W[j:])))\nprint(tmp)\nprint(min(tmp))', 'import math\nN = int(input())\nW = list(int(input()))\nw_sort = sorted(W)\nif N%2 == 0:\n tmp = N/2 + 1\n s1 = sum(w_sort[:t... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s040826327', 's383191168', 's698383297'] | [3060.0, 3060.0, 3060.0] | [18.0, 17.0, 17.0] | [176, 299, 166] |
p03012 | u200887663 | 2,000 | 1,048,576 | We have N weights indexed 1 to N. The mass of the weight indexed i is W_i. We will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \leq T < N. Let S_1 be the sum of the masses of the weights in the former group, and S_2 be th... | ['n=int(input())\nwl=list(map(int,input().split()))\ntotalw=sum(wl)\n#ans=abs((totalw-wl[0])-wl[0])\nans=totalw\ntotal=0\nfor i in range(n-2):\n total+=wl[i]\n v=abs((totalw-total)-total)\n if ans > v:\n ans=v\nprint(ans)\n', 'n=int(input())\nwl=list(map(int,input().split()))\ntotalw=sum(wl)\nans=abs((totalw-wl[0... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s774399613', 's806517942', 's884440567', 's024006972'] | [3060.0, 3060.0, 3060.0, 2940.0] | [17.0, 17.0, 17.0, 18.0] | [215, 203, 195, 145] |
p03012 | u208497224 | 2,000 | 1,048,576 | We have N weights indexed 1 to N. The mass of the weight indexed i is W_i. We will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \leq T < N. Let S_1 be the sum of the masses of the weights in the former group, and S_2 be th... | ['import numpy as np\nn = int(input())\nweights = np.array(list(map(lambda x: int(x),input().split())))\nprint(weights)\nmin = 99999\nfor t in range(1, n-1):\n w1 = weights[:t+1]\n w2 = weights[t+1:]\n s1 = np.sum(w1)\n s2 = np.sum(w2)\n sa = np.abs(s1-s2)\n if sa < min:\n min = sa\nprint(min)'... | ['Wrong Answer', 'Accepted'] | ['s260003564', 's876799854'] | [12504.0, 12500.0] | [150.0, 150.0] | [304, 289] |
p03012 | u209918867 | 2,000 | 1,048,576 | We have N weights indexed 1 to N. The mass of the weight indexed i is W_i. We will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \leq T < N. Let S_1 be the sum of the masses of the weights in the former group, and S_2 be th... | ['n=int(input())\na=list(map(int,input().split()))\nc=[0]*(n-1)\nfor i in range(n-1):\n c[i]=abs(sum(a[:i])-sum(a[i:]))\nprint(min(c))', 'n=int(input())\na=list(map(int,input().split()))\nc=[0]*n\nfor i in range(n):\n c[i]=abs(sum(a[:i])-sum(a[i:]))\nprint(min(c))\n'] | ['Wrong Answer', 'Accepted'] | ['s739000358', 's418495857'] | [3060.0, 2940.0] | [17.0, 17.0] | [128, 123] |
p03012 | u215743476 | 2,000 | 1,048,576 | We have N weights indexed 1 to N. The mass of the weight indexed i is W_i. We will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \leq T < N. Let S_1 be the sum of the masses of the weights in the former group, and S_2 be th... | ['n = int(input())\nw = list(map(int, input().split()))\n\nres = sum(w)\nsum1 = 0\nsum2 = sum(w)\nfor i in range(n):\n sum1 += w[i]\n sum2 -= w[i]\n res = min(res, abs(sum2-sum1))\n\nprint(ans)', 'n = int(input())\nw = list(map(int, input().split()))\n\nres = sum(w)\nsum1 = 0\nsum2 = sum(w)\nfor i in range(n):... | ['Runtime Error', 'Accepted'] | ['s427074543', 's760638348'] | [3064.0, 3060.0] | [17.0, 17.0] | [189, 189] |
p03012 | u218843509 | 2,000 | 1,048,576 | We have N weights indexed 1 to N. The mass of the weight indexed i is W_i. We will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \leq T < N. Let S_1 be the sum of the masses of the weights in the former group, and S_2 be th... | ['n = int(input())\nw = list(map(int, input().split()))\nans = 10**10\nfor i in range(n-1):\n\tans = min(ans, abs(sum(w[:i]) - sum(w[i:])))\nprint(ans)', 'n = int(input())\nw = list(map(int, input().split()))\nans = 10**10\nfor i in range(1, n):\n\tans = min(ans, abs(sum(w[:i]) - sum(w[i:])))\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s007562442', 's716308972'] | [3060.0, 3060.0] | [18.0, 17.0] | [143, 144] |
p03012 | u219197917 | 2,000 | 1,048,576 | We have N weights indexed 1 to N. The mass of the weight indexed i is W_i. We will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \leq T < N. Let S_1 be the sum of the masses of the weights in the former group, and S_2 be th... | ['4\n1 3 1 1', 'n = int(input())\nw = [int(i) for i in input().split()]\nd = sum(w)\nfor wi in w:\n if d - 2 * wi < 0:\n print(min(d, 2 * wi - d))\n break\n d -= 2 * wi\n'] | ['Runtime Error', 'Accepted'] | ['s671485331', 's399188122'] | [2940.0, 9132.0] | [17.0, 27.0] | [9, 166] |
p03012 | u223555291 | 2,000 | 1,048,576 | We have N weights indexed 1 to N. The mass of the weight indexed i is W_i. We will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \leq T < N. Let S_1 be the sum of the masses of the weights in the former group, and S_2 be th... | ['a=int(input())\nb=[0]*a\nb=map(int,input().split())\nc=0\nm=0\nfor i in range(a):\n m+=b[i]\nm/=a\nn=int(m)\n\nif (m-n)>=0.5:\n m=int(m)+1\nelse:\n m=int(m)\nm*=a\nfor j n range(a):\n c+=b[j]\n if c>=m:\n for z in range(j+1,a):\n d+=b[z]\nprint(int(c-d))\n\n \n', 'import math\nN=int(input())\na=list(m... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s114860421', 's617680410', 's876039921'] | [2940.0, 3060.0, 3060.0] | [17.0, 18.0, 18.0] | [254, 219, 167] |
p03012 | u225388820 | 2,000 | 1,048,576 | We have N weights indexed 1 to N. The mass of the weight indexed i is W_i. We will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \leq T < N. Let S_1 be the sum of the masses of the weights in the former group, and S_2 be th... | ['n=int(input())\nw= list(map(int, input().split()))\ns=sum(w)\nt=0\nans=abs(s-2*a[0])\nfor i in range(n-1):\n t+=a[i]\n ans=min(ans,abs(s-2*t))\nprint(ans)', 'n=int(input())\nw= list(map(int, input().split()))\ns=sum(w)\nt=0\nans=abs(s-2*w[0])\nfor i in range(n-1):\n t+=w[i]\n ans=min(ans,abs(s-2*t))\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s706330582', 's041185439'] | [3060.0, 3060.0] | [17.0, 18.0] | [148, 148] |
p03012 | u227082700 | 2,000 | 1,048,576 | We have N weights indexed 1 to N. The mass of the weight indexed i is W_i. We will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \leq T < N. Let S_1 be the sum of the masses of the weights in the former group, and S_2 be th... | ['n,w=int(input()),list(map(int,input().split()))\na=w[0]\nfor i in w[1:]:a.append(a[-1]+i)\nans=a[-1]\nfor i in a:\n if ans>max(i,ans-i):ans=a[-1]-i\nprint(ans)', 'n,w=int(input()),list(map(int,input().split()))\na=[w[0]]\nfor i in w[1:]:a.append(a[-1]+i)\nans=a[-1]\nfor i in a:\n if ans>max(a[-1]-i,i):ans=a[-1]-i\n... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s035943771', 's566029645', 's620382660'] | [3060.0, 3060.0, 2940.0] | [17.0, 17.0, 17.0] | [154, 158, 130] |
p03012 | u229621546 | 2,000 | 1,048,576 | We have N weights indexed 1 to N. The mass of the weight indexed i is W_i. We will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \leq T < N. Let S_1 be the sum of the masses of the weights in the former group, and S_2 be th... | ['N = int(input())\nA = list(map(int,input().split()))\n\nB = [sum(A[:i]) for i in range(1,N + 1)]\nprint(B)\ns = sum(A)\nans = B[-1]\nfor i in range(N):\n ans = min(ans,abs(sum(A[i:N + 1]) - sum(A[:i])))\n \nprint(ans)', 'N = int(input())\nA = list(map(int,input().split()))\n\nB = [sum(A[:i]) for i in range(1,N + 1)... | ['Wrong Answer', 'Accepted'] | ['s359913659', 's176574211'] | [3064.0, 3064.0] | [18.0, 17.0] | [209, 200] |
p03012 | u231936499 | 2,000 | 1,048,576 | We have N weights indexed 1 to N. The mass of the weight indexed i is W_i. We will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \leq T < N. Let S_1 be the sum of the masses of the weights in the former group, and S_2 be th... | ['N=int(input())\nw_list=list(map(int, input().split()))\ntotal=sum(w_list)\nw_sum_list=[0]*len(w_list)\nans_list=[0]*len(w_list)\nfor i in range(len(w_list)):\n #print(i)\n if i==0:\n print(w_list[i])\n w_sum_list[i]=w_list[i]\n else:\n w_sum_list[i]=w_sum_list[i-1]+w_list[i]\n ans_lis... | ['Wrong Answer', 'Accepted'] | ['s396887890', 's114834119'] | [3064.0, 3064.0] | [17.0, 17.0] | [363, 364] |
p03012 | u244416763 | 2,000 | 1,048,576 | We have N weights indexed 1 to N. The mass of the weight indexed i is W_i. We will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \leq T < N. Let S_1 be the sum of the masses of the weights in the former group, and S_2 be th... | ['n = int(input())\nw = list(map(int, input().split()))\ns = [0]\nfor i in range(n):\n s.append(w[i] + s[i])\n\nfor i in range(n+1):\n if(2*(s[i]) > s[n]):\n t = i\n break\nprint(abs(s[n] - 2*(s[t])))', 'n = int(input())\nw = list(map(int, input().split()))\ns = [0]\nfor i in range(n):\n s.append(w... | ['Wrong Answer', 'Accepted'] | ['s180847990', 's454459956'] | [3064.0, 3064.0] | [17.0, 17.0] | [208, 213] |
p03012 | u244836567 | 2,000 | 1,048,576 | We have N weights indexed 1 to N. The mass of the weight indexed i is W_i. We will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \leq T < N. Let S_1 be the sum of the masses of the weights in the former group, and S_2 be th... | ['a=int(input())\nb=list(map(int,input().split()))\nc=sum(b)\nd=0\ne=0\nf=0\nfor i in range(a):\n d=d+b[i]\n if d>=c/2:\n e=i\n break\nfor i in range(e):\n f=f+b[e]\nif d-(c-d)<f-(c-f):\n print(d-(c-d))\nelse:\n print(f-(c-f))', 'a=int(input())\nb=list(map(int,input().split()))\nc=sum(b)\nd=0\ne=0\nf=0\nfor ... | ['Wrong Answer', 'Accepted'] | ['s161165101', 's076162345'] | [9068.0, 9168.0] | [27.0, 28.0] | [219, 239] |
p03012 | u247211039 | 2,000 | 1,048,576 | We have N weights indexed 1 to N. The mass of the weight indexed i is W_i. We will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \leq T < N. Let S_1 be the sum of the masses of the weights in the former group, and S_2 be th... | ['N=input()\nW=list(map(int, input().split()))\n\nsum1,sum2=0,0\nans=0\ndif=1000\n\nfor i in range(N):\n sum1=sum(W[0:i])\n sum2=sum(W[i:])\n now = abs(sum1-sum2)\n if dif > now:\n dif =now\n\nprint(dif)', 'N=int(input())\nW=list(map(int, input().split()))\n \nsum1,sum2=0,0\nans=0\ndif=1000\n \nfor i... | ['Runtime Error', 'Accepted'] | ['s769650762', 's212099885'] | [9044.0, 9136.0] | [23.0, 28.0] | [206, 214] |
p03012 | u250061066 | 2,000 | 1,048,576 | We have N weights indexed 1 to N. The mass of the weight indexed i is W_i. We will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \leq T < N. Let S_1 be the sum of the masses of the weights in the former group, and S_2 be th... | ['N = int(input())\nL = list(map(int, input().split()))\nA = [abs(sum(L[:i])-sum(L[i:]))for i in range(1,N)]\nprint(A)\nprint(min(A))', 'N = int(input())\nL = list(map(int, input().split()))\nA = [abs(sum(L[:i])-sum(L[i:]))for i in range(1,N)]\nprint(min(A))'] | ['Wrong Answer', 'Accepted'] | ['s990385000', 's285731745'] | [3060.0, 2940.0] | [17.0, 17.0] | [127, 118] |
p03012 | u251075661 | 2,000 | 1,048,576 | We have N weights indexed 1 to N. The mass of the weight indexed i is W_i. We will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \leq T < N. Let S_1 be the sum of the masses of the weights in the former group, and S_2 be th... | ['n = int(input())\n\nnums = list(map(int, input().split()))\nsums = [nums[0]]\nfor i in range(1, n):\n sums.append(sums[i-1] + nums[i])\n \nmin_diff = 100\nindex = 0\nfor sum in sums:\n if sum - (sum[-1] - sum) < min_diff:\n min_diff = sum - (sum[-1] - sum)\n \nprint(min_diff)', 'n = int(input())\n\nnums = li... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s380729298', 's718094602', 's410056859'] | [3064.0, 3064.0, 3064.0] | [17.0, 18.0, 17.0] | [272, 245, 284] |
p03012 | u255898796 | 2,000 | 1,048,576 | We have N weights indexed 1 to N. The mass of the weight indexed i is W_i. We will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \leq T < N. Let S_1 be the sum of the masses of the weights in the former group, and S_2 be th... | ['N = int(input())\na = [int(s) for s in input().split()]\nb = sum(a)\nc = int(0)\ni = int(0)\nsabun = int(0)\nsabun2 = int(0)\ncount = int(0)\n\nfor i in range(N):\n if sabun >= 0:\n b = b - a[i]\n c = c + a[i]\n sabun = b - c\n i = i + 1\n print(sabun)\n else:\n sabun2 = sabun + a[i-1] * 2\n pr... | ['Wrong Answer', 'Accepted'] | ['s956570487', 's447829985'] | [9096.0, 9176.0] | [26.0, 29.0] | [371, 336] |
p03012 | u262869085 | 2,000 | 1,048,576 | We have N weights indexed 1 to N. The mass of the weight indexed i is W_i. We will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \leq T < N. Let S_1 be the sum of the masses of the weights in the former group, and S_2 be th... | ['n =int(input())\nl =[int(i) for i in input().split()]\nans =10**9\nfoo =0\nfor i in range(n):\n foo = abs(sum(l[:n]) -sum(l[n:]))\n if foo < ans:\n ans = foo\nprint(ans)', '\nn =int(input())\nl =[int(i) for i in input().split()]\nans =10**9\nfoo =0\nfor i in range(n):\n foo = abs(sum(l[:i]) -sum(l[i:]))\n ... | ['Wrong Answer', 'Accepted'] | ['s237827272', 's623630202'] | [3060.0, 3060.0] | [18.0, 18.0] | [166, 176] |
p03012 | u266874640 | 2,000 | 1,048,576 | We have N weights indexed 1 to N. The mass of the weight indexed i is W_i. We will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \leq T < N. Let S_1 be the sum of the masses of the weights in the former group, and S_2 be th... | ["N = int(input())\nW = list(map(int,input().split()))\ninf = float('inf')\nans = inf\n\nfor i in range(N-1):\n s1 = sum(W[:i+1])\n s2 = sum(W[i+1:])\n ans = min(ans, abs(s1-s2))\n", "N = int(input())\nW = list(map(int,input().split()))\ninf = float('inf')\nans = inf\n\nfor i in range(N-1):\n s1 = sum(W[:i+... | ['Wrong Answer', 'Accepted'] | ['s961945335', 's950074140'] | [2940.0, 2940.0] | [17.0, 18.0] | [178, 189] |
p03012 | u267222408 | 2,000 | 1,048,576 | We have N weights indexed 1 to N. The mass of the weight indexed i is W_i. We will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \leq T < N. Let S_1 be the sum of the masses of the weights in the former group, and S_2 be th... | ['N = int(input())\nomori_list = list(map(int,input().split()))\nS1, S2 = 0,0\n\n#print(omori_list)#\n\nomori_sum = sum(omori_list)\n\nprint(omori_sum)#dbg\n\nfor i in range(N):\n if S1 < int(omori_sum/2):\n oldS1 = S1\n S1 += omori_list[i]\n \nS2 = omori_sum - S1\noldS2 = omori_sum - oldS1\n\nprint(min( abs(... | ['Wrong Answer', 'Accepted'] | ['s863316846', 's433412884'] | [3064.0, 3064.0] | [17.0, 17.0] | [331, 332] |
p03012 | u276686572 | 2,000 | 1,048,576 | We have N weights indexed 1 to N. The mass of the weight indexed i is W_i. We will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \leq T < N. Let S_1 be the sum of the masses of the weights in the former group, and S_2 be th... | ['count = int(input())\narr = input().split()\ns1 = 0\ns2 = 0\nfor i in arr:\n s2 += int(i)\nminimum_diff = s2\nfor i in range(0, count):\n s1 += arr[i]\n s2 -= arr[i]\n minimum_diff = min(minimum_diff, abs(s1-s2))\n ', 'count = int(input())\narr = input().split()\ns1 = 0\ns2 = 0\nfor i in arr:\n s2 += int(i)\nmi... | ['Runtime Error', 'Accepted'] | ['s722742212', 's961708742'] | [9128.0, 9180.0] | [26.0, 30.0] | [209, 240] |
p03012 | u277353449 | 2,000 | 1,048,576 | We have N weights indexed 1 to N. The mass of the weight indexed i is W_i. We will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \leq T < N. Let S_1 be the sum of the masses of the weights in the former group, and S_2 be th... | ['a=input().split()\nnum=a[0]\ndel a[0]\nfor i in range(0,a[0]//2+1):\n a[i]=int(a[i])\nb=0\nc=0\nanswer=sum(a)\nfor i in range(0,len(a)):\n b=b+a[i]\n c=sum(a)-b\n if (b-c>=0 and answer>b-c):\n answer=b-c\n elif (c-b>0 and answer>c-b):\n answer=c-b\nprint(answer)', 'a=input().split()\ndel ... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s132745212', 's227225856', 's305937396', 's532942270', 's697386200', 's604028110'] | [3064.0, 3064.0, 3064.0, 3064.0, 3064.0, 3064.0] | [18.0, 17.0, 17.0, 18.0, 18.0, 17.0] | [276, 210, 213, 276, 203, 265] |
p03012 | u283520984 | 2,000 | 1,048,576 | We have N weights indexed 1 to N. The mass of the weight indexed i is W_i. We will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \leq T < N. Let S_1 be the sum of the masses of the weights in the former group, and S_2 be th... | ['N = int(input())\nA = list(map(int, input().split()))\nS=sum(A)\ni=0\nX=0\nwhile X<S/2:\n X=X+A[i]\n i=i+1\nk=i\nka=0\nja=0\nwa=0\nya=0\nza=0\nfor l in range(k+2):\n ja=ja+A[l]\nfor l in range(k+1):\n ka=ka+A[l]\nfor l in range(k):\n wa=wa+A[l]\nfor l in range(k-2):\n ya=ya+A[l]\nfor l in range(k-1)... | ['Runtime Error', 'Accepted'] | ['s941100525', 's348751652'] | [3064.0, 3064.0] | [17.0, 17.0] | [447, 340] |
p03012 | u285443936 | 2,000 | 1,048,576 | We have N weights indexed 1 to N. The mass of the weight indexed i is W_i. We will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \leq T < N. Let S_1 be the sum of the masses of the weights in the former group, and S_2 be th... | ['N = int(input())\nW = list(map(int, input().split()))\nL, R = 0, sum(W)\nans = 10000\n\nfor i in range(N):\n L += W[i]\n R -= W[i]\n tmp = abs(L - R)\n ans = min(tmp, ans)\n print(L, R, tmp, ans)\nprint(ans)', 'N = int(input())\nW = list(map(int, input().split()))\nL, R = 0, sum(W)\nans = 10000\n\nfor i in range... | ['Wrong Answer', 'Accepted'] | ['s628452672', 's015883975'] | [3060.0, 3060.0] | [17.0, 17.0] | [201, 177] |
p03012 | u288040421 | 2,000 | 1,048,576 | We have N weights indexed 1 to N. The mass of the weight indexed i is W_i. We will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \leq T < N. Let S_1 be the sum of the masses of the weights in the former group, and S_2 be th... | ['n = int(input())\nweight = list(map(int, input().split()))\ncompare = []\n\nfor i in range(len(weight)):\n print(sum(weight[:i+1]))\n print(sum(weight[i+1:]))\n compare.append(abs(sum(weight[:i+1]) - sum(weight[i+1:])))\nprint(min(compare))', 'n = int(input())\nweight = list(map(int, input().split()))\ncompa... | ['Wrong Answer', 'Accepted'] | ['s569917930', 's728769249'] | [3060.0, 3060.0] | [20.0, 17.0] | [241, 183] |
p03012 | u294385082 | 2,000 | 1,048,576 | We have N weights indexed 1 to N. The mass of the weight indexed i is W_i. We will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \leq T < N. Let S_1 be the sum of the masses of the weights in the former group, and S_2 be th... | ['n = int(input())\nw = list(map(int,input().split()))\na=0\nb=0\nli = []\nfor i in range(1,n):\n for j in range(1,i+1):\n a += w[j-1]\n for k in range(i+1,n+1):\n b += w[k]\n li.append(abs(a-b))\n a = 0\n b = 0\n \nprint(min(li))', 'n = int(input())\nw = list(map(int,input().split()))\na=0\nb=0\nli = []\nf... | ['Runtime Error', 'Accepted'] | ['s990926253', 's805020036'] | [3064.0, 3064.0] | [17.0, 20.0] | [226, 228] |
p03012 | u295294832 | 2,000 | 1,048,576 | We have N weights indexed 1 to N. The mass of the weight indexed i is W_i. We will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \leq T < N. Let S_1 be the sum of the masses of the weights in the former group, and S_2 be th... | ['sm=sum(n)\nav = sm/2\nc =0\n\nfor i in range(len(n)):\n\tc += n[i]\n\tif c == av:\n\t\tprint(0)\n\t\texit()\n\telif c > av:\n\t\tb1 = abs(c - (sm-c))\n\t\tb2 = abs((c-n[i]) - (sm-c+n[i]))\n\t\tprint(b1 if b1<b2 else b2)\n\t\texit()\t\n', 'N = int(input())\nn = list(map(int, input().split()))\nsm=sum(n)\nav = sm/2\nc ... | ['Runtime Error', 'Accepted'] | ['s471182135', 's137380155'] | [2940.0, 3060.0] | [17.0, 18.0] | [205, 253] |
p03012 | u296518383 | 2,000 | 1,048,576 | We have N weights indexed 1 to N. The mass of the weight indexed i is W_i. We will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \leq T < N. Let S_1 be the sum of the masses of the weights in the former group, and S_2 be th... | ['N=int(input())\nW=list(map(int,input().split()))\n\nres=0\ns=sum(W)\nans=100000000000\nfor i in range(N):\n res+=W[i]\n ans=min(abs(s-res*2)', 'N=int(input())\nW=list(map(int,input().split()))\n\nres=0\ns=sum(W)\nans=100000000000\nfor i in range(N):\n res+=W[i]\n ans=min(abs(s-res*2))\nprint(ans)\n ', 'N... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s156025468', 's552736729', 's101488283'] | [2940.0, 3060.0, 3060.0] | [17.0, 17.0, 17.0] | [134, 157, 161] |
p03012 | u298297089 | 2,000 | 1,048,576 | We have N weights indexed 1 to N. The mass of the weight indexed i is W_i. We will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \leq T < N. Let S_1 be the sum of the masses of the weights in the former group, and S_2 be th... | ['from collections import Counter\nn = int(input())\nw = list(map(int, input().split()))\nmx = sum(w)\nw = Counter(w)\nans = mx\ntmp = 0\nfor k in sorted(w).keys():\n tmp += w[k] * k\n ans = min(ans, abs(mx - tmp * 2))\nprint(ans)', 'from collections import Counter\nn = int(input())\nw = list(map(int, input().split()... | ['Runtime Error', 'Accepted'] | ['s126279606', 's836886858'] | [3316.0, 3316.0] | [21.0, 21.0] | [220, 183] |
p03012 | u298945776 | 2,000 | 1,048,576 | We have N weights indexed 1 to N. The mass of the weight indexed i is W_i. We will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \leq T < N. Let S_1 be the sum of the masses of the weights in the former group, and S_2 be th... | ['N = int(input())\nW = list(map(int, input().split()))\nt1 = W[0]\nt2 = 0\n\nfor i in range(N-1):\n t2 += W[i+1]\nfir = t2 - t1\n\nfor j in range(N-1):\n t = t2-t1\n if t < 0:\n if fir > -t:\n print(-t)\n break\n else:\n print(fir)\n break\n\n else:... | ['Wrong Answer', 'Accepted'] | ['s938238197', 's540989530'] | [3060.0, 3060.0] | [17.0, 18.0] | [358, 359] |
p03012 | u309039873 | 2,000 | 1,048,576 | We have N weights indexed 1 to N. The mass of the weight indexed i is W_i. We will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \leq T < N. Let S_1 be the sum of the masses of the weights in the former group, and S_2 be th... | ['N = int(input())\nW = list(map(int,input().split()))\ncumsum_b,cumsum_e = [],[]\n\nfor i,w in enumerate(W):\n if i == 0:\n cumsum_b.append(w)\n else:\n cumsum_b.append(w+cumsum_b[i-1])\n \nfor i,w in enumerate(reversed(W)):\n if i == 0:\n cumsum_e.append(w)\n else:\n cumsum_e.append(w+cumsum_e[i-... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s207797524', 's338843454', 's156269104'] | [2940.0, 3064.0, 3064.0] | [17.0, 18.0, 17.0] | [448, 451, 451] |
p03012 | u309120194 | 2,000 | 1,048,576 | We have N weights indexed 1 to N. The mass of the weight indexed i is W_i. We will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \leq T < N. Let S_1 be the sum of the masses of the weights in the former group, and S_2 be th... | ['N = int(input())\nW = list(map(int, input().split()))\n\nm = 10**10\nfor i in range(1, W):\n m = min(m, abs(sum(W[:i]), sum(W[i:])))\n\nprint(m)', 'N = int(input())\nW = list(map(int, input().split()))\n\n\nS = [0] * N\nS[0] = W[0]\nfor i in range(N-1):\n S[i+1] = S[i] + W[i+1]\n \n# S[0] = W[0]\n# S[1] = W[0] + W... | ['Runtime Error', 'Accepted'] | ['s477963228', 's210572929'] | [9072.0, 9184.0] | [24.0, 30.0] | [138, 393] |
p03012 | u314906167 | 2,000 | 1,048,576 | We have N weights indexed 1 to N. The mass of the weight indexed i is W_i. We will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \leq T < N. Let S_1 be the sum of the masses of the weights in the former group, and S_2 be th... | ['8\n27 23 76 2 3 5 62 52', 'N = int(input())\nW = [int(s) for s in input().split()]\nans = float("inf")\nfor i in range(1, N):\n ans = min(ans, abs(sum(W[:i]) - sum(W[i:])))\nprint(ans)\n'] | ['Runtime Error', 'Accepted'] | ['s872912956', 's987827518'] | [2940.0, 2940.0] | [17.0, 17.0] | [22, 156] |
p03012 | u316401642 | 2,000 | 1,048,576 | We have N weights indexed 1 to N. The mass of the weight indexed i is W_i. We will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \leq T < N. Let S_1 be the sum of the masses of the weights in the former group, and S_2 be th... | ['n = int(input())\nw = list(map(int,input().split()))\n\ns1, s2 = 0, sum(w)\npre = 0\nfor i in w:\n s1 += i\n s2 -= i\n if s1 > s2:\n if s1 - s2 > s2 - pre:\n print(s2 - pre)\n else:\n print(s1 - s2)\n break\n pre = s1', 'n = int(input())\nw = list(map(int,input()... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s147405742', 's909853847', 's258444918'] | [3060.0, 3064.0, 2940.0] | [17.0, 17.0, 17.0] | [258, 282, 252] |
p03012 | u327162583 | 2,000 | 1,048,576 | We have N weights indexed 1 to N. The mass of the weight indexed i is W_i. We will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \leq T < N. Let S_1 be the sum of the masses of the weights in the former group, and S_2 be th... | ['N = int(input())\nW = [int(i) for i in input().split()] \nonon = 0\nhoge = sum(W)\nfor i in range(N):\n onon += W[0]:\n hoge -= W[0]:\n result = abs(onon - hoge)\n if result <= nowresult:\n nowresult = result\nprint(nowresult)\n', 'N = int(input())\nW = [int(i) for i in input().split()] \nonon = 0\... | ['Runtime Error', 'Accepted'] | ['s849197855', 's216392602'] | [2940.0, 3064.0] | [17.0, 17.0] | [236, 252] |
p03012 | u329455846 | 2,000 | 1,048,576 | We have N weights indexed 1 to N. The mass of the weight indexed i is W_i. We will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \leq T < N. Let S_1 be the sum of the masses of the weights in the former group, and S_2 be th... | ['a = int(input())\ns = list(map(int,input().split()))\nT = [i for i in range(1,a)]\nresult = []\nfor i in T:\n s_1 = s[0:i+1]\n s_2 = s[i+1:]\n s_1_sum = 0\n s_2_sum = 0\n print(s_1)\n print(s_2)\n for i in range(len(s_1)):\n s_1_sum += s_1[i]\n for j in range(len(s_2)):\n s_2_sum... | ['Wrong Answer', 'Accepted'] | ['s649851867', 's840001387'] | [3064.0, 3064.0] | [20.0, 19.0] | [433, 403] |
p03012 | u329565519 | 2,000 | 1,048,576 | We have N weights indexed 1 to N. The mass of the weight indexed i is W_i. We will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \leq T < N. Let S_1 be the sum of the masses of the weights in the former group, and S_2 be th... | ['N = int(input())\nW = list(map(int, input().split()))\nsorted(W)\ns = sum(W) // 2\nx = 0\nfor w in W:\n x += w\n if x > s:\n break\nprint(abs(sum(W) - 2 * x))', 'N = int(input())\nW = list(map(int, input().split()))\n\nx = sum(W) // 2\ns = 0\nfor w in W:\n s += w\n if x <= s:\n a = abs(sum(W... | ['Wrong Answer', 'Accepted'] | ['s818773616', 's483083280'] | [3060.0, 3060.0] | [17.0, 17.0] | [162, 240] |
p03012 | u331390010 | 2,000 | 1,048,576 | We have N weights indexed 1 to N. The mass of the weight indexed i is W_i. We will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \leq T < N. Let S_1 be the sum of the masses of the weights in the former group, and S_2 be th... | ["import numpy as np\nW = []\nsum1 = 0\nsum2 = 0\ndelta = []\nN = int(input())\nW = list(map(int, input().split()))\n\nprint('N',N)\n\nfor i in range(N-1):\n sum1 = sum(W[:i])\n sum2 = sum(W[i:])\n delta.append(abs(sum1-sum2))\n\nprint(min(delta))", 'import numpy as np\nW = []\nsum1 = 0\nsum2 = 0\ndelta = []\n... | ['Wrong Answer', 'Accepted'] | ['s527253467', 's753071630'] | [12488.0, 20756.0] | [152.0, 313.0] | [239, 251] |
p03012 | u333134020 | 2,000 | 1,048,576 | We have N weights indexed 1 to N. The mass of the weight indexed i is W_i. We will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \leq T < N. Let S_1 be the sum of the masses of the weights in the former group, and S_2 be th... | ['n=int(input())\nl=list(map(int,input().split()))\nans=1000000009;\nfor t in range(1,n+1):\n ans=min(ans,abs(sum(l[:t]) - sum(l[t:]))\nprint(ans)', 'n=int(input().strip())\nl=list(map(int,input().strip().split()))\nans=1000000009;\nfor t in range(1,n):\n ans=min(ans,abs(sum(l[:t]) - sum(l[t:])))\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s150770613', 's479249189'] | [2940.0, 3060.0] | [17.0, 17.0] | [140, 155] |
p03012 | u342563578 | 2,000 | 1,048,576 | We have N weights indexed 1 to N. The mass of the weight indexed i is W_i. We will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \leq T < N. Let S_1 be the sum of the masses of the weights in the former group, and S_2 be th... | ['n = int(input())\nw = list(map(int,input().split()))\nans = 10**9+a\np = 0\nfor i in range(n):\n p += w[i]\nfor i in range(n):\n p -= 2*w[i]\n ans = min(ans,abs(p))\nprint(ans)\n\n', 'n = int(input())\nw = list(map(int,input().split()))\nans = 10**9\np = 0\nfor i in range(n):\n p += w[i]\nfor i in range(n... | ['Runtime Error', 'Accepted'] | ['s071957531', 's914748572'] | [3060.0, 3064.0] | [17.0, 17.0] | [178, 174] |
p03012 | u348868667 | 2,000 | 1,048,576 | We have N weights indexed 1 to N. The mass of the weight indexed i is W_i. We will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \leq T < N. Let S_1 be the sum of the masses of the weights in the former group, and S_2 be th... | ['N = int(input())\nW = list(map(int,input().split()))\ntmp = []\nfor i in range(N-1):\n tmp.append(sum(W[:i+1])-sum(W[i+1:]))\nprint(min(tmp))', 'N = int(input())\nW = list(map(int,input().split()))\ntmp = []\nfor i in range(N-1):\n tmp.append(abs(sum(W[:i+1])-sum(W[i+1:])))\nprint(min(tmp))'] | ['Wrong Answer', 'Accepted'] | ['s495812948', 's811963374'] | [3060.0, 3060.0] | [17.0, 17.0] | [139, 144] |
p03012 | u350093546 | 2,000 | 1,048,576 | We have N weights indexed 1 to N. The mass of the weight indexed i is W_i. We will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \leq T < N. Let S_1 be the sum of the masses of the weights in the former group, and S_2 be th... | ['n=int(input())\nw=list(map(int,input().split()))\nx=0\nfor i in range(n):\n s=abs(sum(w(0,i+1))-sum(w(i+1,n+1)))\n if x==0 or x<s:\n x=s\nprint(x)\n', 'n=int(input())\nw=list(map(int,input().split()))\nx=0\nfor i in range(n):\n s=abs(w[:i+1]-w[i+1:])\n if x==0 or x<s:\n x=s\nprint(x)\n', 'n=int(input())\nw=... | ['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s028446613', 's349950068', 's448041750', 's866860614', 's071019565'] | [3060.0, 2940.0, 2940.0, 2940.0, 9140.0] | [17.0, 18.0, 17.0, 18.0, 31.0] | [145, 131, 141, 138, 243] |
p03012 | u356232173 | 2,000 | 1,048,576 | We have N weights indexed 1 to N. The mass of the weight indexed i is W_i. We will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \leq T < N. Let S_1 be the sum of the masses of the weights in the former group, and S_2 be th... | ["N=int(input())\nW=list(map(int,input().split(' ')))\nT=0\nS1=0\nS2=0\nlist=[]\nfor j in range(N-1):\n for i in range(N):\n if i<=T :\n S1=S1+W[i]\n else :\n S2=S2+W[i]\n T+=1\n list.append(abs(S1-S2))\n S1=0\n S2=0\nprint(list)\nprint(min(list))\n", 'N = int(input())... | ['Wrong Answer', 'Accepted'] | ['s172153997', 's614946231'] | [3064.0, 2940.0] | [19.0, 17.0] | [280, 159] |
p03012 | u359837458 | 2,000 | 1,048,576 | We have N weights indexed 1 to N. The mass of the weight indexed i is W_i. We will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \leq T < N. Let S_1 be the sum of the masses of the weights in the former group, and S_2 be th... | ['N = int(input()) \nW = list(map(int, input().split()))\nx = sum(W)\n\nfor i in range(N):\n\tS_1 = sum(W[:i+1])\n\tS_2 = sum(W) - S_1\n x_current = abs(S_2 - S_1)\n if x_current < x:\n x = x_current\n\nprint(x)', 'N = int(input()) \nW = list(map(int, input().split()))\nx = sum(W)\n \nfor i in range(N):\n\tS... | ['Runtime Error', 'Accepted'] | ['s932179757', 's997081325'] | [2940.0, 2940.0] | [17.0, 19.0] | [207, 198] |
p03012 | u374829922 | 2,000 | 1,048,576 | We have N weights indexed 1 to N. The mass of the weight indexed i is W_i. We will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \leq T < N. Let S_1 be the sum of the masses of the weights in the former group, and S_2 be th... | ['def main():\n N = int(input())\n L = list(map(int, input().split()))\n\n s1, s2 = 0,sum(W)\n ans = sum(W)\n\n for i in range(N):\n s1 += L[i]\n s2 -= L[i]\n ans = min(ans, abs(s1-s2))\n\n print(ans)\n\nif __name__ == "__main__":\n main()', 'def main():\n N = int(input())\n... | ['Runtime Error', 'Accepted'] | ['s518463203', 's463940589'] | [3064.0, 3064.0] | [19.0, 17.0] | [264, 264] |
p03012 | u380539609 | 2,000 | 1,048,576 | We have N weights indexed 1 to N. The mass of the weight indexed i is W_i. We will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \leq T < N. Let S_1 be the sum of the masses of the weights in the former group, and S_2 be th... | ['N = int(input())\nw = [int(x) for x in input().split()]\n\ns1 = 0\ns2 = sum(w)\ntmp = s2 + 10\n\nfor i in range(N):\n s1 += w[i]\n s2 -= w[i]\n if tmp < abs(s2 - s1):\n break\n print(s1, s2, tmp)\n tmp = s2 - s1\nprint(min(abs(tmp), abs(s2-s1)))', 'N = int(input())\nw = [int(x) for x in input().... | ['Wrong Answer', 'Accepted'] | ['s407787790', 's543414435'] | [3064.0, 3064.0] | [18.0, 17.0] | [253, 230] |
p03012 | u395894569 | 2,000 | 1,048,576 | We have N weights indexed 1 to N. The mass of the weight indexed i is W_i. We will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \leq T < N. Let S_1 be the sum of the masses of the weights in the former group, and S_2 be th... | ['n=int(input())\nw = [int(_) for _ in input().split()]\nl=[999]*n\nfor i in range(1,n-1):\n l[i] = abs(sum(w[:i]) - sum(w[i:]))\nprint(min(l))\n', 'n=int(input())\nw = [int(_) for _ in input().split()]\nl=[999]*n\nfor i in range(1,n):\n l[i] = abs(sum(w[:i]) - sum(w[i:]))\nprint(min(l))\n'] | ['Wrong Answer', 'Accepted'] | ['s323246271', 's294945445'] | [2940.0, 2940.0] | [17.0, 17.0] | [140, 138] |
p03012 | u397953026 | 2,000 | 1,048,576 | We have N weights indexed 1 to N. The mass of the weight indexed i is W_i. We will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \leq T < N. Let S_1 be the sum of the masses of the weights in the former group, and S_2 be th... | ['n = int(input())\nw = list(map(int,input().split()))\nans = 0\nfor i in range(n):\n ans += w[i]\n if ans > sum(w)//2:\n print(abs(ans - (sum(w)-ans)))\n break', 'n = int(input())\nw = list(map(int,input().split()))\nans = 0\nfor i in range(n):\n ans += w[i]\n if ans >= sum(w)//2:\n pr... | ['Wrong Answer', 'Accepted'] | ['s321444028', 's394157857'] | [2940.0, 3060.0] | [17.0, 17.0] | [171, 212] |
p03012 | u408375121 | 2,000 | 1,048,576 | We have N weights indexed 1 to N. The mass of the weight indexed i is W_i. We will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \leq T < N. Let S_1 be the sum of the masses of the weights in the former group, and S_2 be th... | ['N = int(input())\nW = list(map(int, input().split()))\nd = sum(W) / 2\ncount = 0\nfor i in range(N):\n count += W[i]\n if count >= d:\n if i == 0:\n print(W[0] - sum(W[1:]))\n else:\n print(min(sum(W[i:]) - sum(W[:i]), sum(W[:i + 1]) - sum(W[i+1:])))\n ', 'N = int(input())\nW = list(map(int, inpu... | ['Wrong Answer', 'Accepted'] | ['s739137537', 's750649336'] | [3060.0, 3060.0] | [18.0, 17.0] | [263, 293] |
p03012 | u412481017 | 2,000 | 1,048,576 | We have N weights indexed 1 to N. The mass of the weight indexed i is W_i. We will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \leq T < N. Let S_1 be the sum of the masses of the weights in the former group, and S_2 be th... | ['n,m=map(int,input().split())\n\ns=[0]*n\n\nfor _ in range(m):\n s[int(input())-1]=""\n \n#print(s)\n\nif n==1:\n print(1)\n exit()\nelif n==2:\n if s[0]=="":\n print(1)\n else:\n print(2)\n exit()\n \nif s[0]=="":\n s[0]=0\nelse:\n s[0]=1\n \nif s[1]=="":\n s[1]=0\nelse:\n s[1]=1+s[0]\n\ni=2\nwhile... | ['Runtime Error', 'Accepted'] | ['s275923723', 's511837264'] | [3064.0, 3060.0] | [17.0, 17.0] | [381, 155] |
p03012 | u422673384 | 2,000 | 1,048,576 | We have N weights indexed 1 to N. The mass of the weight indexed i is W_i. We will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \leq T < N. Let S_1 be the sum of the masses of the weights in the former group, and S_2 be th... | ['import math\nn = int(input())\nwn = list(map(int, input().split()))\n \n \nmini = math.inf\nfor i in range(n-1):\n new_mini = abs(sum(wn[:i]) -sum(wn[i:]))\n if new_mini < mini:\n mini = new_mini\nprint(mini)', 'import math\nn = int(input())\nwn = list(map(int, input().split()))\n\n\nmini = math.inf\n... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s236080653', 's933147141', 's677418979'] | [3060.0, 3316.0, 3060.0] | [17.0, 21.0, 17.0] | [214, 209, 218] |
p03012 | u434872492 | 2,000 | 1,048,576 | We have N weights indexed 1 to N. The mass of the weight indexed i is W_i. We will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \leq T < N. Let S_1 be the sum of the masses of the weights in the former group, and S_2 be th... | ['import math\nN = int(input())\nW = list(map(int,input().split()))\nmin = 10**4+1\nsum_W = sum(W)\nfor i in range(N-1):\n S1 = 0\n S2 = 0\n for j in range(i+1):\n S1 += W[j]\n S2 = sum_W - S1\n S1_S2 = math.fabs(S1-S2)\n if S1_S2 < min:\n min = S1_S2\nprint(min)', 'import math\nN = int(... | ['Wrong Answer', 'Accepted'] | ['s207078134', 's300703122'] | [3064.0, 3060.0] | [19.0, 18.0] | [279, 285] |
p03012 | u441320782 | 2,000 | 1,048,576 | We have N weights indexed 1 to N. The mass of the weight indexed i is W_i. We will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \leq T < N. Let S_1 be the sum of the masses of the weights in the former group, and S_2 be th... | ['N = int(input())\nx = list(map(int,input().split()))\nmiddle = sum(x)/2\ntol = 0\nans = []\n\nfor i in range(4):\n tol += x[i]\n re_new =abs(tol-middle)\n ans.append(re_new)\n\nt = ans.index(min(ans))\nprint(sum(x[0:t+1])-sum(x[t+1::]))\n ', 'N = int(input())\nx = list(map(int,input().split()))\nans = []\nfor i ... | ['Runtime Error', 'Accepted'] | ['s729398921', 's737537886'] | [3060.0, 3060.0] | [17.0, 18.0] | [231, 172] |
p03012 | u442581202 | 2,000 | 1,048,576 | We have N weights indexed 1 to N. The mass of the weight indexed i is W_i. We will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \leq T < N. Let S_1 be the sum of the masses of the weights in the former group, and S_2 be th... | ['n = input()\nl = list(map(int,input().split()))\ndiff = []\nfor t in range(1,n):\n diff.append(abs(sum(l[:t])-sum(l[t:]))))\nprint(min(diff))', 'n = int(input())\nl = list(map(int,input().split()))\ndiff = []\nfor t in range(1,n):\n diff.append(abs(sum(l[:t])-sum(l[t:])))\nprint(min(diff))\n'] | ['Runtime Error', 'Accepted'] | ['s623634202', 's595965251'] | [2940.0, 2940.0] | [17.0, 17.0] | [137, 144] |
p03012 | u446628914 | 2,000 | 1,048,576 | We have N weights indexed 1 to N. The mass of the weight indexed i is W_i. We will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \leq T < N. Let S_1 be the sum of the masses of the weights in the former group, and S_2 be th... | ['n = int(input())\nw = list(map(int,input().split()))\nl=[]\nfor i in range(n):\n s_1=sum(w[:i])\n s_2=sum(w[i+1])\n l.append(abs(s_1,s_2))\nprint(min(l))', 'n = int(input())\nw = list(map(int,input().split()))\nl=[]\nfor i in range(n):\n s_1=sum(w[:i])\n s_2=sum(w[i:])\n l.append(abs(s_1-s_2))\nprin... | ['Runtime Error', 'Accepted'] | ['s387334580', 's509083179'] | [3060.0, 3060.0] | [18.0, 17.0] | [155, 154] |
p03012 | u448655578 | 2,000 | 1,048,576 | We have N weights indexed 1 to N. The mass of the weight indexed i is W_i. We will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \leq T < N. Let S_1 be the sum of the masses of the weights in the former group, and S_2 be th... | ['N = int(input())\nremain = []\nS1 = 0\nS2 = 0\nstring = list(map(int,input().split())\nfor T in range(1,N+1):\n for i in range(T):\n S1 += string[i]\n for j in range(T, len(string)):\n S2 += string[j]\n remain.append(abs(S1-S2))\n S1 = 0\n S2 = 0\nprint(min(remain))\n \n ... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s286959657', 's318484596', 's655844456', 's361540127'] | [2940.0, 2940.0, 2940.0, 3064.0] | [17.0, 17.0, 17.0, 19.0] | [359, 339, 362, 361] |
p03012 | u450904670 | 2,000 | 1,048,576 | We have N weights indexed 1 to N. The mass of the weight indexed i is W_i. We will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \leq T < N. Let S_1 be the sum of the masses of the weights in the former group, and S_2 be th... | ['import numpy as np\nn = int(input())\nw = np.array(list(map(int, input().split())))\nw_amount = w.cumsum()\nw_reverse_amount = w[::-1].cumsum()[::-1]\n\nres = abs(w_amount[0] - w_reverse_amount[0])\nmin_index = 0\nfor i in range(n):\n if(res => abs(w_amount[i] - w_reverse_amount[i])):\n res = abs(w_amount[i] - w_... | ['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s103388871', 's185335610', 's879192066', 's643481969'] | [2940.0, 12396.0, 12424.0, 14476.0] | [17.0, 149.0, 149.0, 150.0] | [355, 323, 363, 342] |
p03012 | u468189539 | 2,000 | 1,048,576 | We have N weights indexed 1 to N. The mass of the weight indexed i is W_i. We will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \leq T < N. Let S_1 be the sum of the masses of the weights in the former group, and S_2 be th... | ['N= int(input())\nL= list(map(int,input().split()))\n\nv=[]\nfor i in range(N-1):\n v.append(abs(sum(L[:i+1]-L[i+1:])))\n\nans=min(v)\n\nprint(ans)\n', 'N= int(input())\nL= list(map(int,input().split()))\n\nv=[]\nfor i in range(N):\n v.append(abs(sum(L[:(i+1)]-L[(i+1):])))\n\nans=min(v)\n\nprint(ans)\n', 'N= int(inp... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s380017243', 's549975808', 's744953209', 's772969085', 's931775178', 's441827195'] | [2940.0, 2940.0, 2940.0, 2940.0, 2940.0, 2940.0] | [17.0, 23.0, 17.0, 18.0, 18.0, 17.0] | [139, 141, 137, 134, 143, 144] |
p03012 | u468972478 | 2,000 | 1,048,576 | We have N weights indexed 1 to N. The mass of the weight indexed i is W_i. We will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \leq T < N. Let S_1 be the sum of the masses of the weights in the former group, and S_2 be th... | ['n = int(input())\na = list(map(int, input().split()))\ns = []\nfor i in range(1, n):\n s.append(abs(a[:i] - a[i:]))\nprint(max(s))\n ', 'n = int(input())\na = list(map(int, input().split()))\ns = []\nfor i in range(1, n):\n s.append(abs(a[:i] - a[i:]))\nprint(min(s))\n ', 'n = int(input())\na = list(map(int, inpu... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s509681652', 's828420294', 's452377752'] | [9128.0, 9176.0, 9136.0] | [23.0, 23.0, 29.0] | [129, 129, 139] |
p03012 | u474514603 | 2,000 | 1,048,576 | We have N weights indexed 1 to N. The mass of the weight indexed i is W_i. We will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \leq T < N. Let S_1 be the sum of the masses of the weights in the former group, and S_2 be th... | ['#-*- coding: utf-8\n# -*-\n"""\noj dl https://atcoder.jp/contests/abc116/tasks/abc116_d -d test-d\noj test -d test-d -c "python abc116d.py"\noj test -d test-d -c "python abc116d.py" test-d/sample-3.in\n"""\nfrom collections import defaultdict\nimport sys\nimport math\nfrom datetime import datetime\n\ndef sol(n, W):\... | ['Runtime Error', 'Accepted'] | ['s390462225', 's288282872'] | [3692.0, 3816.0] | [23.0, 28.0] | [1255, 1247] |
p03012 | u476604182 | 2,000 | 1,048,576 | We have N weights indexed 1 to N. The mass of the weight indexed i is W_i. We will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \leq T < N. Let S_1 be the sum of the masses of the weights in the former group, and S_2 be th... | ['N = input()\nsource = map(int, input().split())\nsource = list(source)\nscore = sum(souce)\nfor i in range(1, len(source)):\n value = sum(souce[:i])-sum(souce[i:])\n value = abs(value)\n if score > value:\n score = value\nprint(score)', 'n = input()\nline = map(int, input().split())\nline = list(line)\nm = abs(... | ['Runtime Error', 'Accepted'] | ['s650379475', 's881835706'] | [3060.0, 3060.0] | [17.0, 17.0] | [231, 196] |
p03012 | u494058663 | 2,000 | 1,048,576 | We have N weights indexed 1 to N. The mass of the weight indexed i is W_i. We will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \leq T < N. Let S_1 be the sum of the masses of the weights in the former group, and S_2 be th... | ['import math\nimport itertools\nN = int(input())\nW = [int(i) for i in input().split()]\nW.sort()\n\nif N%2 == 0:\n T = N//2-1\nelse:\n T = math.ceil(N/2-1)\nprint(T)\nSum = list(itertools.accumulate(W))\nprint(Sum[-1]-2*Sum[T])\n', "N = int(input())\nW = [int(i) for i in input().split()]\nans = float('inf')\ntm... | ['Wrong Answer', 'Accepted'] | ['s502400440', 's823906342'] | [3060.0, 3060.0] | [18.0, 17.0] | [222, 206] |
p03012 | u495678669 | 2,000 | 1,048,576 | We have N weights indexed 1 to N. The mass of the weight indexed i is W_i. We will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \leq T < N. Let S_1 be the sum of the masses of the weights in the former group, and S_2 be th... | ['N = int(input())\nlist = list(map(int, input().split(\' \')))\na1_list = [0]\n\nfor a1 in list:\n # print(a1)\n a1_list.append(a1+a1_list[-1])\na1_list.pop(0)\nlist_sum = a1_list[-1]\n# print(list_sum)\nabstmp=1000\nnumtmp=0\nfor i in range(len(a1_list)):\n print("abstmp"+str(abstmp))\n if(abs((list_sum -... | ['Wrong Answer', 'Accepted'] | ['s909157607', 's999679629'] | [3064.0, 3064.0] | [17.0, 18.0] | [421, 423] |
p03012 | u500297289 | 2,000 | 1,048,576 | We have N weights indexed 1 to N. The mass of the weight indexed i is W_i. We will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \leq T < N. Let S_1 be the sum of the masses of the weights in the former group, and S_2 be th... | ['N = int(input())\nW = list(map(int, input().split()))\nl = sum(W)\nr = 0\nans = l\nfor w in W:\n l -= w\n r += w\n ans = min(abs(r - l))\n\nprint(ans)', 'N = int(input())\nW = list(map(int, input().split()))\nl = sum(W)\nr = 0\nans = l\nfor w in W:\n l -= w\n r += w\n ans = min(abs(r - l), ans)\n\np... | ['Runtime Error', 'Accepted'] | ['s749352567', 's422751555'] | [3060.0, 3060.0] | [17.0, 17.0] | [149, 154] |
p03012 | u500589232 | 2,000 | 1,048,576 | We have N weights indexed 1 to N. The mass of the weight indexed i is W_i. We will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \leq T < N. Let S_1 be the sum of the masses of the weights in the former group, and S_2 be th... | ['t = int(input())\nl = [int(x) for x in input().split()]\nmin_sum = -1\n\ns1 = l[:t]\ns2 = l[t:]\ns1_sum = sum(s1)\ns2_sum = sum(s2)\n#if min_sum < 0 or min_sum > abs(s1_sum - s2_sum):\nmin_sum = abs(s1_sum - s2_sum)\nprint(min_sum)\n', 'n = int(input())\nl = [int(x) for x in input().split()]\nmin_sum=-1\nfor t in ran... | ['Wrong Answer', 'Accepted'] | ['s226448943', 's432620306'] | [3060.0, 3064.0] | [17.0, 28.0] | [222, 256] |
p03012 | u511449169 | 2,000 | 1,048,576 | We have N weights indexed 1 to N. The mass of the weight indexed i is W_i. We will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \leq T < N. Let S_1 be the sum of the masses of the weights in the former group, and S_2 be th... | ['n = int(input())\nw = list(map(int, input().split()))\nlow = []\nhigh = []\ndist = []\nfor i in range(n-1):\n low = w[:i+1]\n print(low)\n high = w[i+1:]\n print(high)\n dist.append(abs(sum(low) - sum(high)))\nprint(dist)\nprint(min(dist))', 'n = int(input())\nw = list(map(int, input().split()))\nlow = []\nhigh ... | ['Wrong Answer', 'Accepted'] | ['s726467110', 's140026641'] | [3064.0, 3060.0] | [19.0, 18.0] | [232, 193] |
p03012 | u514118270 | 2,000 | 1,048,576 | We have N weights indexed 1 to N. The mass of the weight indexed i is W_i. We will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \leq T < N. Let S_1 be the sum of the masses of the weights in the former group, and S_2 be th... | ['N = int(input())\nW = list(map(int,input().split()))\nweight= sum(W)\ncnt = 0\nfor i in range(N):\n weight -= W[i]\n cnt += W[i]\n if weight <= cnt:\n print(cnt-weight)\n exit()\n', 'N = int(input())\nW = list(map(int,input().split()))\nweight= sum(W)\ncnt = 0\nfor i in range(N):\n if weight <= cnt:\n ... | ['Runtime Error', 'Accepted'] | ['s670103098', 's882187426'] | [2940.0, 3060.0] | [17.0, 18.0] | [180, 218] |
p03012 | u514429645 | 2,000 | 1,048,576 | We have N weights indexed 1 to N. The mass of the weight indexed i is W_i. We will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \leq T < N. Let S_1 be the sum of the masses of the weights in the former group, and S_2 be th... | ['n=int(input())\nw=list(map(int,input().split()))\ns=w.sum()\np=0\nbestsub=100000000\n\nfor i in range n:\n p=p+w[i]\n sub=abs(s-p)\n if(bestsub>sub):\n bestsub=sub\n\nprint(bestsub)', 'n=int(input())\nw=list(map(int,input().split()))\ns=sum(w)\np=0\nbestsub=100000000\n\nfor i in range(n):\n p=p+w[i]\n sub=abs... | ['Runtime Error', 'Accepted'] | ['s425699759', 's759939375'] | [2940.0, 3060.0] | [17.0, 17.0] | [175, 180] |
p03012 | u529012223 | 2,000 | 1,048,576 | We have N weights indexed 1 to N. The mass of the weight indexed i is W_i. We will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \leq T < N. Let S_1 be the sum of the masses of the weights in the former group, and S_2 be th... | ['N = int(input())\nW = list(map(int, input().split()))\n\ndiff = np.abs(np.sum(W[0]) - np.sum(W[0:]))\nfor i in range(N):\n S_1 = np.sum(W[:i])\n S_2 = np.sum(W[i:])\n diff = np.abs(S_1 - S_2)\n if S_1 > S_2:\n if diff > np.abs(S_1 - S_2):\n print(np.abs(S_1 - S_2))\n else:\n ... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s578735695', 's634578224', 's749313438', 's155623645'] | [3060.0, 3064.0, 3064.0, 21004.0] | [17.0, 17.0, 17.0, 327.0] | [377, 375, 339, 395] |
p03012 | u530253034 | 2,000 | 1,048,576 | We have N weights indexed 1 to N. The mass of the weight indexed i is W_i. We will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \leq T < N. Let S_1 be the sum of the masses of the weights in the former group, and S_2 be th... | ['N = input()\nN = int(N)\nW = [int(i) for i in input().split()]\n\nTotal = sum(W)\nfor i in range(len(W)):\n sub_Total = sum(W[:i])\n if Total/2 < sub_Total:\n diff1 = abs(Total - 2*sub_Total)\n diff2 = abs(Total - 2*sum(W[:i-1]))\n break\n \nprint(min(diff1, diff2))', 'N = input()\nN = int(N)\nW = [int(... | ['Runtime Error', 'Accepted'] | ['s853867506', 's939517152'] | [3064.0, 3064.0] | [17.0, 17.0] | [268, 317] |
p03012 | u535423069 | 2,000 | 1,048,576 | We have N weights indexed 1 to N. The mass of the weight indexed i is W_i. We will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \leq T < N. Let S_1 be the sum of the masses of the weights in the former group, and S_2 be th... | ['import sys\n\nstdin = sys.stdin\n\nmod = 1000000007\ninf = 1 << 60\n\nni = lambda: int(ns())\nna = lambda: list(map(int, stdin.readline().split()))\nns = lambda: stdin.readline().rstrip()\nnas = lambda: stdin.readline().split()\n\nn = ni()\nw = na()\n\nans = inf\nd = [0] * (n + 1)\nb = [0] * (n + 1)\nfor i in range(1... | ['Runtime Error', 'Accepted'] | ['s378128683', 's786795325'] | [3064.0, 3064.0] | [17.0, 17.0] | [444, 338] |
p03012 | u535794843 | 2,000 | 1,048,576 | We have N weights indexed 1 to N. The mass of the weight indexed i is W_i. We will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \leq T < N. Let S_1 be the sum of the masses of the weights in the former group, and S_2 be th... | ['n = input()\nweights = list(map(int, input().strip().split()))\n\nsum_w = sum(weights)\nfor t, w in enumerate(weights):\n if sum(weights[:t]) > sum_w / 2:\n print(min(sum_w - sum(weights[:t-1]) * 2, sum(weights[:t])) * 2 - sum_w)\n break', 'n = input()\nweights = list(map(int, input().strip().split()... | ['Wrong Answer', 'Accepted'] | ['s763822250', 's410851435'] | [3060.0, 3060.0] | [18.0, 17.0] | [247, 249] |
p03012 | u538368953 | 2,000 | 1,048,576 | We have N weights indexed 1 to N. The mass of the weight indexed i is W_i. We will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \leq T < N. Let S_1 be the sum of the masses of the weights in the former group, and S_2 be th... | ['#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nN = int(input())\ns = list(map(int,input().split()))\n\n\npartial_sum = 0\ni = 0\n\nfor i in range(N):\n if(partial_sum < sum(s)/2.):\n partial_sum += s[i]\n else:\n break\n\nans1 = abs(2*(partial_sum - sum(s)/2.))\n\nans2=abs(2*(sum(s)/2. - (parti... | ['Wrong Answer', 'Accepted'] | ['s117816059', 's057044193'] | [3060.0, 3064.0] | [17.0, 17.0] | [345, 350] |
p03012 | u538956308 | 2,000 | 1,048,576 | We have N weights indexed 1 to N. The mass of the weight indexed i is W_i. We will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \leq T < N. Let S_1 be the sum of the masses of the weights in the former group, and S_2 be th... | ['result=[]\nN = int(input())\nW = list(map(int,input().split()))\nfor i in range(1:N+1):\n a = W[:i]\n b = W[i+1:N]\n c = sum(a)\n d = sum(b)\n e = abs(c-d)\n result.append(e)\n \nprint(min(result))\n', 'result=[]\nN = int(input())\nW = list(map(int,input().split()))\nfor i in range(N):\n a = W[:i]\n b = W[i+1... | ['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s376180409', 's447254361', 's991204785', 's135893189'] | [2940.0, 3060.0, 2940.0, 3064.0] | [17.0, 18.0, 17.0, 17.0] | [193, 190, 192, 285] |
p03012 | u540698208 | 2,000 | 1,048,576 | We have N weights indexed 1 to N. The mass of the weight indexed i is W_i. We will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \leq T < N. Let S_1 be the sum of the masses of the weights in the former group, and S_2 be th... | ['from sys import stdin\n\nn = int(stdin.readline().rstrip())\nw = [int(x) for x in stdin.readline().rstrip().split()]\n\nave = sum(w)/len(w)\nw1 = [w.pop(0)]\nwhile sum(w1)/len(w1) <= ave:\n w1.append(w.pop(0))\n\nprint(abs(sum(w1) - sum(w)))\n', 'from sys import stdin\n\nn = int(stdin.readline().rstrip())\nw = [in... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s027151284', 's942912369', 's602378728'] | [3060.0, 3060.0, 2940.0] | [17.0, 18.0, 17.0] | [235, 234, 247] |
p03012 | u547633429 | 2,000 | 1,048,576 | We have N weights indexed 1 to N. The mass of the weight indexed i is W_i. We will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \leq T < N. Let S_1 be the sum of the masses of the weights in the former group, and S_2 be th... | ['import numpy as np\nn=int(input()) \nw = list(map(int, input().split())) \n\ns = sum(w)\n\n_s=0\nfor i,x in enumerate(w):\n _s+=x\n if _s>=s/2:\n break\nmin(abs(_s-(s-_s)), abs(_s-w[i]-(s-_s+w[i])))', 'import numpy as np\nn=int(input()) \nw = list(map(int, input().split())) \n\ns = sum(w)\n\n_s=0\nfo... | ['Wrong Answer', 'Accepted'] | ['s442050735', 's712121213'] | [12488.0, 13312.0] | [147.0, 151.0] | [231, 238] |
p03012 | u561478555 | 2,000 | 1,048,576 | We have N weights indexed 1 to N. The mass of the weight indexed i is W_i. We will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \leq T < N. Let S_1 be the sum of the masses of the weights in the former group, and S_2 be th... | ['a = input()\nb = list(map(int, input().split()))\nmin = 100000\n\nfor i in range(len(b)):\n left = 0\n right = 0\n for j in range(i):\n left += b[j]\n for j in range(len(b)):\n right += b[j]\n if min > abs(left - right):\n min = abs(left - right)\n \nprint(min)', 'a = input()\nb = list(map(int, input... | ['Wrong Answer', 'Accepted'] | ['s946805213', 's466710465'] | [9140.0, 9144.0] | [30.0, 29.0] | [264, 272] |
p03012 | u564906058 | 2,000 | 1,048,576 | We have N weights indexed 1 to N. The mass of the weight indexed i is W_i. We will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \leq T < N. Let S_1 be the sum of the masses of the weights in the former group, and S_2 be th... | ['n = int(input())\nw = list(map(int,input().split()))\ns = 0\nlist = []\nfor i in range(n):\n s += w[i]\nfor i in range(n):\n t = 0\n for j in range(i):\n t += w[j]\n list.append(abs(s - 2t))\nprint(min(list)) ', 'n = int(input())\nw = list(map(int,input().split()))\ns = 0\nlist = []\nfor i in range(n):\n s +... | ['Runtime Error', 'Accepted'] | ['s611708313', 's243849979'] | [2940.0, 3064.0] | [18.0, 18.0] | [206, 205] |
p03012 | u566297428 | 2,000 | 1,048,576 | We have N weights indexed 1 to N. The mass of the weight indexed i is W_i. We will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \leq T < N. Let S_1 be the sum of the masses of the weights in the former group, and S_2 be th... | ['N = int(input())\n*W, = map(int, input().split())\n\ns1, s2 = 0, sum[W]\nans = sum[W]\n\nfor i in range(N):\n s1 += W[i]\n s2 -= W[i]\n ans = min(ans, abs(s1 - s2))\nprint(ans)', 'N = int(input())\n*W, = map(int, input().split())\n \ns1, s2 = 0, sum(W)\nans = sum(W)\n \nfor i in range(N):\n s1 += W[i]\n s2 -= W[... | ['Runtime Error', 'Accepted'] | ['s567904061', 's986822903'] | [9024.0, 9144.0] | [26.0, 29.0] | [169, 171] |
p03012 | u566529875 | 2,000 | 1,048,576 | We have N weights indexed 1 to N. The mass of the weight indexed i is W_i. We will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \leq T < N. Let S_1 be the sum of the masses of the weights in the former group, and S_2 be th... | ['n=int(input())\nw=list(map(int,input().split()))\nsu =sum(w)\n\nans = 1234567890\ncnt =0\nfor i in range(n):\n cnt += w[i]\n ans = min(ans,abs(su-cnt)\nprint(ans)', 'n=int(input())\nw=list(map(int,input().split()))\nwa=[0]*(n+1)\nfor i in range(n):\n\twa[i+1] = wa[i]+w[i]\n\nans = 1234567890\nfor i in range(1,n... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s517048110', 's955021882', 's272254414'] | [2940.0, 3316.0, 3316.0] | [17.0, 21.0, 20.0] | [159, 188, 167] |
p03012 | u568595296 | 2,000 | 1,048,576 | We have N weights indexed 1 to N. The mass of the weight indexed i is W_i. We will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \leq T < N. Let S_1 be the sum of the masses of the weights in the former group, and S_2 be th... | ['N = int(input())\nW = map(int,input().split())\nt = []\nfor i in range(1,N):\n t.append(abs(sum(W[:i])-sum(W[i:])))\nprint(min(t))', 'N = int(input())\nW = list(map(int,input().split()))\nt = []\nfor i in range(1,N):\n t.append(abs(sum(W[:i])-sum(W[i:])))\nprint(min(t))'] | ['Runtime Error', 'Accepted'] | ['s666854650', 's726763102'] | [2940.0, 3060.0] | [17.0, 17.0] | [126, 132] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.