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
p03111
u255943004
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic poi...
['N,A,B,C = map(int,input().split())\nl = [int(input()) for _ in range(N)]\nINF = 10 ** 9\ndef dfs(cur,a,b,c):\n if cur == N:\n return abs(a-A) + abs(b-B) + abs(c-C) - 30 if min(a,b,c) > 0 else INF\n ret0 = dfs(cur+1,a,b,c)\n ret1 = dfs(cur+1,a,b,c)+10\n ret2 = dfs(cur+1,a,b+l[cur],c)+10\n ret3 = ...
['Wrong Answer', 'Accepted']
['s688319717', 's981932436']
[3188.0, 3064.0]
[55.0, 74.0]
[392, 454]
p03111
u269969976
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic poi...
['# coding: utf-8\n\nlist = [int(i) for i in input().rstrip().split(" ")]\n\nmatsu_count = list[0]\nrequire = sorted(list[1:])\n\nmatsu_list = sorted([int(input().rstrip()) for i in range(matsu_count)])\n\ndef get_mp(matsu:list):\n ans = 0\n for i in range(3):\n ans += abs(matsu[i] - require[i])\n retur...
['Runtime Error', 'Accepted']
['s676243416', 's434190063']
[3064.0, 3828.0]
[18.0, 152.0]
[1022, 1223]
p03111
u286201019
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic poi...
['# N A B C\n# l1\n# l2\n# ...\n\n(N, A, B, C) = int(input().split())\nL = []\nfor i in range(N):\n l = int(input())\n L.append(l)\n# N = 5\n# A = 100\n# B = 90\n# C = 80\n# L = [98, 40, 30, 21, 80]\n\ndef recur_function(a, b, c, n):\n if n == N:\n return abs(a - A) + abs(b - B) + abs(c - C) if min(a, b...
['Runtime Error', 'Accepted']
['s293473769', 's307479263']
[3064.0, 3064.0]
[17.0, 71.0]
[753, 786]
p03111
u288087195
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic poi...
['N, A, B, C = list(map(str, input().split()))\nl = []\nfor i in range(N):\n l.append(int(input()))\n\n\ndef dfs(A_list, B_list, C_list, i):\n if i == N:\n return abs(A - sum(A_list)) + abs(B - sum(B_list)) + abs(C - sum(C_list))\n\n dfs_not_used = dfs(A_list, B_list, C_list, i+1)\n dfs_A = dfs(A_lis...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s037907232', 's076277700', 's141191697', 's425207661', 's764674755', 's880232425', 's776390851']
[3064.0, 3064.0, 3064.0, 3064.0, 3064.0, 3064.0, 3064.0]
[18.0, 17.0, 17.0, 17.0, 17.0, 17.0, 65.0]
[564, 564, 552, 552, 556, 552, 524]
p03111
u303059352
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic poi...
['import os\nimport math\nfrom itertools import permutations\nimport functools as func\nINF, MOD = float("inf"), 1e9 + 7\nMAX, MIN = -INF, INF\ndx1, dy1, dx2, dy2 = [-1, 0, 1, 0], [0, -1, 0, 1], [-1, 0, 1, -1, 1, -1, 0, 1], [-1, -1, -1, 0, 0, 1, 1, 1]\n\ndef get_int():\n return int(input())\n\ndef get_int_list():\n ...
['Runtime Error', 'Accepted']
['s503297073', 's219369147']
[3700.0, 3188.0]
[180.0, 300.0]
[1703, 2082]
p03111
u305965165
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic poi...
['n, A, B, C = (int(i) for i in input().split()) #a=1, b=3, c=5, d=7\nl = [int(input()) for i in range(n)]\nINF = 10 ** 9\n\ndef dfs(cur, a, b, c):\n if cur == N:\n return abs(a - A) + abs(b - B) + abs(c - C) - 30 if min(a, b, c) > 0 else INF\n ret0 = dfs(cur + 1, a, b, c)\n ret1 = dfs(cur + 1, a + l[c...
['Runtime Error', 'Accepted']
['s996220309', 's141690174']
[3064.0, 3064.0]
[17.0, 74.0]
[486, 486]
p03111
u310678820
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic poi...
['def ttt (x,y,z,i,m,p,q,r):\n if i==n and (p==0 or q==0 or r==0):\n print(p,q,r)\n return 10000000\n if i==n:\n m+=abs(x-a)+abs(y-b)+abs(z-c)\n return m\n else:\n return min(ttt(x,y,z,i+1,m,p,q,r), ttt(x+l[i],y,z,i+1,m+10,p+1,q,r), \n ttt(x,y+l[i],z,i+1,m+10,p,q+1,r), ttt(x,y,z+l[i],i+1...
['Wrong Answer', 'Accepted']
['s092837335', 's703578024']
[3316.0, 3064.0]
[19.0, 70.0]
[399, 408]
p03111
u316322317
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic poi...
['n,a,b,c=map(int,input().split())\nl=[]\nfor _ in range(n):\n x=int(input())\n l.append(x)\n\ndef dfs(cur,x,y,z):\n if cur==n and min(x,y,z)>0:\n return abs(a-x)+abs(b-y)+abs(c-z)-30\n elif cur==n:\n return inf\n ret0=dfs(cur+1,x,y,z)\n ret1=dfs(cur+1,x+l[cur],y,z)+10\n ret2=dfs(cur+1,x,y+l[cur],z)+10\n ...
['Runtime Error', 'Accepted']
['s722842208', 's058817931']
[3064.0, 3064.0]
[18.0, 76.0]
[391, 408]
p03111
u316386814
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic poi...
['n, a, b, c = list(map(int, input().split()))\ngoals = [a, b, c]\nbamboos = []\nfor _ in range(n):\n bamboos.append(int(input()))\n\ndef get_best(li, goal):\n bam_mp_lis = {0: (-10, tuple())}\n li.sort()\n for i, v in enumerate(li):\n tmp = bam_mp_lis.copy()\n for bam, (mp, lis) in tmp.items(...
['Wrong Answer', 'Accepted']
['s655040627', 's558248391']
[3064.0, 3064.0]
[19.0, 140.0]
[1140, 469]
p03111
u332906195
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic poi...
["# -*- coding: utf-8 -*-\n\nimport itertools\nINF = 1e10\n\nN, A, B, C = map(int, input().split())\nL = [int(input()) for _ in range(N)]\n\nans = INF\nfor prod in itertools.product('NABC', repeat=N):\n if not ('A' in prod and 'B' in prod and 'C' in prod):\n continue\n\n D = {'A': [], 'B': [], 'C': [], 'N'...
['Wrong Answer', 'Accepted']
['s493688878', 's361894102']
[3064.0, 3064.0]
[240.0, 250.0]
[573, 573]
p03111
u340010271
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic poi...
['N,A,B,C=map(int,input().split())\nl=[int(input()) for i in range(N)]\ninf=10**9\ndef dfs(d,a,b,c):\n if d==n:\n return abs(a-A)+abs(b-B)+abs(c-C)-30 if min(a,b,c)>0 else inf \n ret0=dfs(d+1,a,b,c)\n ret1=dfs(d+1,a+l[d],b,c)+10\n ret2=dfs(d+1,a,b+l[d],c)+10\n ret3=dfs(d+1,a,b,c+l[d])+10\n retu...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s142442922', 's206842330', 's779893337', 's107280414']
[3064.0, 2940.0, 3064.0, 3064.0]
[18.0, 18.0, 18.0, 76.0]
[449, 423, 498, 498]
p03111
u346527636
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic poi...
["tgt_b = int(str_in[2])\ntgt_c = int(str_in[3])\n\nsource = [int(input()) for i in range(num)]\n\nmp = float('inf')\n\nfor i in range(1,2**num):\n\n sum_a = 0\n len_a = 0\n \n bin_i = format(i,'0256b') \n for t in range(1,num+1):\n sum_a += int(bin_i[-t])\n len_a += int(bin_i[-t]) * source[t-1]\n \n fo...
['Runtime Error', 'Accepted']
['s289254727', 's297589188']
[3064.0, 3064.0]
[17.0, 687.0]
[1018, 1085]
p03111
u366959492
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic poi...
['N,A,B,C=map(int,input().split())\nl=[int(input()) for i in range(n)]\ninf=10**9\n\ndef dfs(cur,a,b,c):\n if cur==N:\n return abs(a-A)+abs(b-B)+abs(c-C)-30 if min(a,b,c)>0 else inf\n ret0=dfs(cur+1,a,b,c)\n ret1=dfs(cur+1,a+l[cur],b,c)+10\n ret2=dfs(cur+1,a,b+l[cur],c)+10\n ret3=dfs(cur+1,a,b,c+l...
['Runtime Error', 'Accepted']
['s573851376', 's630489040']
[3064.0, 3064.0]
[17.0, 74.0]
[375, 375]
p03111
u367130284
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic poi...
['from itertools import*\nn,a,b,c,*l=map(int,open(0).read().split())\nwant=[a,b,c]\nans=0\n\nfor s in range(3):\n if want[s] in l:\n l.remove(want[s])\n want[s]=0\n\nwant=list(filter(lambda x:x!=0,want))\nfor s in range(3):\n for t in l:\n if abs(want[s]-t)<10:\n ans+=abs(want[s]-t)\n l.remove(t)\n...
['Runtime Error', 'Accepted']
['s830360597', 's346717941']
[3064.0, 3188.0]
[18.0, 325.0]
[693, 402]
p03111
u371467115
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic poi...
['N, A, B, C = map(int, input().split())\nl = [int(input()) for i in range(N)]\nINF=10**9\n\ndef dfs(cur, a, b, c):\nif cur == N:\nreturn abs(a - A) + abs(b - B) + abs(c - C) - 30 if min(a, b, c) > 0 else INF\nret0 = dfs(cur + 1, a, b, c)\nret1 = dfs(cur + 1, a + l[cur], b, c) + 10\nret2 = dfs(cur + 1, a, b + l[cur], c...
['Runtime Error', 'Accepted']
['s374196425', 's355568380']
[2940.0, 3064.0]
[18.0, 72.0]
[433, 450]
p03111
u371763408
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic poi...
['n,A,B,C=(map(int,input().split()))\nl=[int(input()) for i in range(n)]\nans=10**9\na=b=c=[]\nfor i in range(1<<n):\n for j in range(1<<n):\n res=0\n a=b=c=[]\n for k in range(n):\n if i&(1<<k):\n if j&(1<<k):\n b.append(l[k])\n else:\...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s344616381', 's530760586', 's271644574']
[3064.0, 6260.0, 3316.0]
[365.0, 555.0, 68.0]
[566, 550, 364]
p03111
u373274281
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic poi...
['from copy import copy\nN, A, B, C = map(int, input().split())\nL = []\nfor _ in range(N):\n L.append(int(input()))\n\nINF = 10 ** 9\ndef dfs(cur, a, b, c, m):\n if cur == N-1:\n if min(a, b, c) == 0:\n return INF\n return abs(A-a)+abs(B-b)+abs(C-c)+(m-3)*10\n\n res0 = dfs(cur+1, a, b, c, m)\n res1 = df...
['Wrong Answer', 'Accepted']
['s491765863', 's236233370']
[3444.0, 3444.0]
[38.0, 79.0]
[481, 479]
p03111
u374103100
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic poi...
['\nimport copy\n\ndef solve(t, l, c):\n \n min_cost = 100000\n cand = []\n\n ptn = 1 << len(l)\n # print(l)\n # print("ptn = {}".format(ptn))\n for i in range(1, ptn):\n answers = []\n for j in range(0, len(l)):\n if (i >> j) & 1:\n answers.append(l[j])\n ...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s527464343', 's919207958', 's063570411']
[3444.0, 3444.0, 3436.0]
[27.0, 27.0, 84.0]
[1598, 1600, 809]
p03111
u379692329
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic poi...
["N, A, B, C = map(int, input().split())\nl = [int(input()) for _ in range(N)]\n\ndef dfs(index, a, b, c):\n if index == N:\n return abs(a-A)+abs(b-B)+abs(c+C)-30 if min(a, b, c) > 0 else float('inf')\n \n val1 = dfs(index+1, a, b, c)\n val2 = dfs(index+1, a+l[index], b, c) + 10\n val3 = dfs(index...
['Wrong Answer', 'Accepted']
['s884082137', 's202521514']
[3064.0, 3064.0]
[81.0, 80.0]
[445, 445]
p03111
u379959788
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic poi...
['N, A, B, C = map(int, input().split())\nL = [int(input()) for _ in range(N)]\n\nINF = 10 ** 9\n\ndef dfs(cur, a, b, c):\n if cur == N:\n if min(a, b, c) > 0:\n return abs(a-A)+abs(b-B)+abs(c-C)-30\n else:\n return INF\n ret1 = dfs(cur+1, a, b, c)\n ret2 = dfs(cur+1, a+L[cu...
['Runtime Error', 'Accepted']
['s342562602', 's623920862']
[3064.0, 3064.0]
[18.0, 71.0]
[470, 467]
p03111
u382639013
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic poi...
['N, A, B, C = map(int, input().split())\nfrom itertools import product\nl = [int(input()) for i in range(N)]\nans = []\nfor i in product(range(4), repeat=N):\n a = 0\n b = 0\n c = 0\n d = 0\n for j in range(N):\n if i[j]:\n d += 1\n if i[j] == 1:\n a += l[j]\n elif i[j] == 2:\n b +...
['Wrong Answer', 'Accepted']
['s833193084', 's402862615']
[9204.0, 10916.0]
[151.0, 190.0]
[309, 436]
p03111
u384261199
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic poi...
['N, A,B,C = map(int, input().split())\nl = sorted([int(input()) for _ in range(N)])[-1::-1]\n\nINF = 1e+10\n\ndef DFS(depth, current_a, current_b, current_c):\n if depth == N:\n if min(current_a, current_b, current_c) > 0:\n return abs(current_a - A) + abs(current_b - B) + abs(current_c - C) -30\n...
['Wrong Answer', 'Accepted']
['s887858080', 's290611976']
[3064.0, 3064.0]
[73.0, 74.0]
[679, 694]
p03111
u389910364
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic poi...
['import bisect\nimport heapq\nimport itertools\nimport math\nimport os\nimport re\nimport string\nimport sys\nfrom collections import Counter, deque, defaultdict\nfrom fractions import gcd\nfrom functools import lru_cache, reduce\n\nimport numpy as np\n\nif os.getenv("LOCAL"):\n sys.stdin = open("_in.txt", "r")\n\n...
['Time Limit Exceeded', 'Accepted']
['s100340250', 's002431672']
[27376.0, 3064.0]
[2109.0, 281.0]
[997, 790]
p03111
u405256066
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic poi...
['from sys import stdin\nimport itertools\nN,A,B,C=[int(x) for x in stdin.readline().rstrip().split()]\ndata=[]\n\nfor i in range(N):\n data.append(int(input()))\ntarget=[A,B,C]\n\nans=0\n\nif A in data:\n data.remove(A)\n target.remove(A)\n\nif B in data:\n data.remove(B)\n target.remove(B)\n \nif C ...
['Runtime Error', 'Accepted']
['s657468122', 's389018671']
[3064.0, 10996.0]
[19.0, 358.0]
[796, 741]
p03111
u416758623
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic poi...
["N,A,B,C = map(int, input().split())\nls = [int(input()) for i in range(N)]\nINF = float('inf')\n\ndef dfs(cur, a,b,c):\n print(cur,a,b,c)\n if cur == N:\n print(abs(a-A)+abs(b-B)+abs(c-C)-30 if min(a,b,c)>0 else INF)\n return abs(a-A)+abs(b-B)+abs(c-C)-30 if min(a,b,c)>0 else INF\n ret0 = dfs(c...
['Wrong Answer', 'Accepted']
['s812480588', 's995128072']
[4976.0, 3064.0]
[354.0, 69.0]
[493, 376]
p03111
u417365712
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic poi...
['from collections import defaultdict\nfrom operator import itemgetter\n\nn, a, b, c, *L = map(int, open(0).read().split())\nL.sort()\nA = [a, b, c]\ndicts = [defaultdict(lambda: 10**5) for _ in range(3)]\nfor i in range(n-2):\n for x in combinations(enumerate(L), i+1):\n k = tuple(i for i, l in x)\n v...
['Runtime Error', 'Accepted']
['s922400840', 's087283512']
[3316.0, 3436.0]
[21.0, 23.0]
[836, 884]
p03111
u422886513
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic poi...
['from itertools import product\n\nimport numpy as np\n\nN, A, B, C = (int(i) for i in input().split())\nl = []\n\nfor i in range(N):\n l.append(int(input()))\n\nl = np.array(l)\n\n###########\n\n\n\nmin_cost = 1e10\n\nfor i in product(np.arange(4), repeat=N):\n i = np.array(i)\n\n if(len(np.unique(i)) != 4):\...
['Wrong Answer', 'Accepted']
['s894912490', 's102365285']
[14452.0, 3064.0]
[2109.0, 72.0]
[778, 455]
p03111
u426397594
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic poi...
['N,A,B,C = map(int,input().split())\nl = [input() for i in range(N)]\nINF = 10 ** 9\n\ndef ans(cur,a,b,c):\n \n if cur == N:\n return abs(a-A) + abs(b-B) + abs(c-C) - 30 if min(a,b,c) > 0 else INF\n \n ret0 = ans(cur + 1,a,b,c) \n ret1 = ans(cur + 1,a + l[cur],b,c) + 10\n ret2 = ans(cur + 1,a,...
['Runtime Error', 'Accepted']
['s375806656', 's760788411']
[3064.0, 3064.0]
[20.0, 71.0]
[433, 438]
p03111
u437638594
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic poi...
['N, A, B, C = map(int, input().split())\nl = [int(input()) for _ in range(N)]\nINF = 10 ** 9\n\ndef dfs(cur, a, b, c):\n if cur == N:\n return abs(a-A) + abs(b-B) + abs(c-C) - 30 if min(a, b, c) > 0 else INF\n \n \n ret0 = dfs(cur + 1, A, B, C)\n \n ret1 = dfs(cur + 1, A + l[cur], B, C) + 10\n \n ret2 = dfs...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s011897607', 's395798836', 's513713890']
[3064.0, 3064.0, 3064.0]
[76.0, 17.0, 76.0]
[528, 529, 528]
p03111
u466331465
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic poi...
['def rec (i,a,b,c):\n if i==N:\n if a==0 and b==0 and c==0:\n return INF\n else:\n return abs(a-A)+abs(b-B)+abs(c-C)\n res = rec(i+1,a,b,c)\n \n res = min(res,rec(i+1,a+L[i],b,c)+(10 if a>0 else 0))\n res = min(res,rec(i+1,a,b+L[i],c)+(10 if b>0 else 0))\n res = mi...
['Runtime Error', 'Accepted']
['s601017116', 's951925498']
[3064.0, 3064.0]
[18.0, 73.0]
[471, 479]
p03111
u476124554
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic poi...
['from itertools import combinations\nN,A,B,C=map(int,input().split())\nl = []\nfor i in range(N):\n l.append(int(input()))\ninput_l = list(map(list,combinations(l,3)))\nexcept_l = [l[:] for _ in range(len(input_l))]\nfor i in range(len(input_l)):\n except_l[i].remove(input_l[i][0])\n except_l[i].remove(input_...
['Wrong Answer', 'Accepted']
['s176609432', 's411541484']
[3064.0, 4992.0]
[18.0, 67.0]
[386, 501]
p03111
u476604182
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic poi...
['N, A, B, C = map(int, input().split())\nls = [int(input()) for i in range(N)]\n\ndef dfs(cur, a, b, c):\n if cur==N:\n return abs(A-a)+abs(B-b)+abs(C-c)-30 if min(a,b,c)>0 else 10**9\n ret0 = dfs(cur+1, a+ls[cur], b, c)\n ret1 = dfs(cur+1, a, b+ls[cur], c)\n ret2 = dfs(cur+1, a, b, c+ls[cur])\n ret3 = dfs(cur...
['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted']
['s284167471', 's359326921', 's544262769', 's765451230']
[3064.0, 3064.0, 3064.0, 3064.0]
[66.0, 18.0, 17.0, 326.0]
[378, 376, 445, 443]
p03111
u492030100
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic poi...
['\nN, A, B, C = map(int, input().split())\nL = [int(input()) for i in range(N)]\n\nINF = 10 ** 9\n\n\ndef dfs(cursor, a, b, c): \n if cursor == N: \n return abs(a - A) + abs(b - B) + abs(c - C) - 30 if min(a, b, c) > 0 else INF\n \n # dfs(0,0,0)\n \n \n \n \n\n \n \n no_compound_...
['Runtime Error', 'Wrong Answer', 'Accepted']
['s159461881', 's420308422', 's363033006']
[3940.0, 3064.0, 3064.0]
[83.0, 17.0, 72.0]
[1660, 1627, 1678]
p03111
u503228842
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic poi...
['N,A,B,C = map(int,input().split())\nl = [int(input()) for _ in range(N)]\n\ndef dfs(cur,a,b,c):\n if cur == N:\n return abs(a-A) + abs(b-B) + abs(c-C)-30 if min(a,b,c) > 0 else 10**9\n ret0 = dfs(cur+1,a,b,c)\n ret1 = dfs(cur+1,a+l[cur],b,c)\n ret2 = dfs(cur+1,a,b+l[cur],c)\n ret3 = dfs(cur+1,a,...
['Wrong Answer', 'Accepted']
['s058181640', 's520316014']
[3064.0, 3064.0]
[70.0, 69.0]
[376, 391]
p03111
u513844316
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic poi...
['N,A,B,C=map(int,input().split())\n\nl=[int(input()) for i in range(N)]\n\nINF=3000\n\ndef mp(co,a,b,c):\n if co==N:\n return abs(a-A)+abs(b-B)+abs(c-C)-30 if min(a,b,c)>0 else INF\n\n ret0=mp(co+1,a,b,c)\n ret1=mp(co+1,a+1,b,c)+10\n ret2=mp(co+1,a,b+1,c)+10\n ret3=mp(co+1,a,b,c+1)+10\n\n retu...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s095905604', 's482494250', 's527581422', 's271260861']
[3064.0, 3064.0, 3188.0, 3064.0]
[69.0, 17.0, 18.0, 71.0]
[702, 328, 345, 344]
p03111
u514118270
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic poi...
['import sys\nimport math\nimport itertools\nimport bisect\nfrom copy import copy\nfrom collections import deque,Counter\nfrom decimal import Decimal\ndef s(): return input()\ndef i(): return int(input())\ndef S(): return input().split()\ndef I(): return map(int,input().split())\ndef L(): return list(map(int,input().sp...
['Wrong Answer', 'Accepted']
['s582350606', 's036770378']
[10028.0, 10040.0]
[35.0, 72.0]
[828, 808]
p03111
u518042385
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic poi...
['n,a,b,c=map(int,input().split())\nl=[]\nfor i in range(n):\n l.append(int(input()))\nlist2=[]\ns=0\nfor i in range(4):\n list=[0,0,0,0]\n list[i]+=l[0]\n if i!=3:\n s+=10\n for j in range(4):\n list[j]+=l[1]\n if j!=3:\n s+=10\n for o in range(4):\n list[o]+=l[2]\n if o!=3:\n ...
['Runtime Error', 'Accepted']
['s246828266', 's939195571']
[3440.0, 12788.0]
[33.0, 436.0]
[1288, 631]
p03111
u529012223
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic poi...
['N, A, B, C = map(int,input().split())\nl = [int(input()) for i in range(N)]\ninf = 10**9\n\ndef magic(cur, a, b, c):\n if cur == N:\n if min(a, b, c) > 0:\n return abs(a - A) + abs(b - B) + abs (c - C) - 30\n else:\n return inf\n \n ret0 = magic(cur+1, a, b, c)\n ret1 =...
['Runtime Error', 'Accepted']
['s317720686', 's765089276']
[3064.0, 3064.0]
[18.0, 68.0]
[506, 457]
p03111
u543954314
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic poi...
['n, a, b, c = map(int, input().split())\nl = [int(input()) for _ in range(n)]\ncnt = 0\nfor k in [a,b,c]:\n ans = 0\n for i in range(1, 257):\n s = 0\n for j in range(n):\n if i & 2**j:\n if s > 0:\n s += 10\n s += l[j]\n v = abs(k ...
['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s155924495', 's722532422', 's728905701', 's888206051', 's731127404']
[3064.0, 3064.0, 3188.0, 3064.0, 3064.0]
[18.0, 18.0, 23.0, 18.0, 71.0]
[459, 357, 473, 459, 358]
p03111
u545368057
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic poi...
['import numpy as np\n\nN, A, B, C = map(int,input().split())\ngoals = [A,B,C]\nfor i in range(N):\n ls.append(int(input()))\n\n\n# ls = [300,333,400,444,500,555,600,666]\n\n# ls = [98, 40,30,21,80]\n\ndef count(x,ls):\n try:\n x.index(0)\n x.index(1)\n x.index(2) \n except:\n ...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s021865922', 's365318351', 's401464926', 's964969163', 's758244351']
[13164.0, 12516.0, 12516.0, 14516.0, 3064.0]
[153.0, 151.0, 149.0, 1983.0, 68.0]
[976, 860, 976, 984, 819]
p03111
u548303713
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic poi...
['n,A,B,C=map(int,input().split())\nbam=[]\nfor i in range(n):\n bam.append(int(input()))\nINF = 10 ** 9\n\ndef dfs(cur, a, b, c):\n if cur == n: \n print(str(cur)+" "+str(a)+" "+str(b)+" "+str(c))\n return abs(a - A) + abs(b - B) + abs(c - C) - 30 if min(a, b, c) > 0 else INF \n \n \n...
['Wrong Answer', 'Accepted']
['s948201087', 's330380223']
[4208.0, 3188.0]
[205.0, 70.0]
[977, 979]
p03111
u552357043
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic poi...
['N,A,B,C = map(int, input().split())\nl = list(map(int, input().split()))\ndef dfs(cur,a,b,c):\n if cur == N:\n if min(a, b, c) > 0:\n return abs(a-A) + abs(b-B) + abs(c-C) - 30\n else:\n return 10**9\n ret0 = dfs(cur+1, a, b, c)\n ret1 = dfs(cur+1, a + l[cur], b, c...
['Runtime Error', 'Accepted']
['s400330011', 's732782604']
[3064.0, 3064.0]
[18.0, 71.0]
[465, 467]
p03111
u556225812
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic poi...
['N, A, B, C = map(int, input().split())\nl = [int(input()) for i in range(N)]\nINF = 10 ** 9\n\ndef dfs(cur, a, b, c):\n if cur == N:\n return abs(a-A) + abs(b-B) + abs(C-C) - 30 if min(a, b, c) > 0 else INF\n ret0 = dfs(cur+1, a, b, c)\n ret1 = dfs(cur+1, a+l[cur], b, c) + 10\n ret2 = dfs(cur+1, a,...
['Runtime Error', 'Runtime Error', 'Accepted']
['s769998675', 's898690016', 's638263903']
[3064.0, 3064.0, 3064.0]
[18.0, 19.0, 70.0]
[434, 434, 433]
p03111
u556326496
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic poi...
['many, A, B, C = map(int, input().split())\nbamboos = [int(input()) for i in range(many)]\n\n\n\n\n\n\n\ninfinity = 1e10\n\ndef dfs(depth, a, b, c):\n if depth == many:\n \n if min(a, b, c) > 0:\n \n \n \n return abs(a-A) + abs(b-B) + abs(c-C) - 30\n else...
['Runtime Error', 'Accepted']
['s731145308', 's418166132']
[3064.0, 3064.0]
[19.0, 75.0]
[1108, 1150]
p03111
u572142121
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic poi...
["N,a,b,c=map(int,input().split())\nL=[int(input()) for i in range(N)]\nimport itertools \nans=300000\nfor i in itertools.product('ABCD',repeat=N):\n cst=0\n A=[]\n B=[]\n C=[]\n for j in range(N):\n if i[j]=='A':\n A.append(L[j])\n elif i[j]=='B':\n B.append(L[j]) \n elif i[j]=='C':\n C.ap...
['Wrong Answer', 'Accepted']
['s708946144', 's694263108']
[3064.0, 3064.0]
[315.0, 328.0]
[572, 587]
p03111
u576432509
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic poi...
['l=[]\n\ndef detain(n,a,b,c,l):\n \n n,a,b,c=map(int,input().split())\n for i in range(n):\n li=int(input())\n l.append(li)\n return\n\n\ndetain(n,a,b,c,l)\nd=[a,b,c]\nd.sort()\n\nmpmin=sum(l)*4+len(l)*10\nfor i in range(4**n):\n k=[]\n kj=i%4\n k.append(kj)\n b=int((i-kj)/4)\n ...
['Runtime Error', 'Accepted']
['s286323641', 's101518942']
[3192.0, 3064.0]
[18.0, 76.0]
[1164, 510]
p03111
u578489732
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic poi...
['# -*- coding: utf-8 -*-\nimport sys\n# ----------------------------------------------------------------\n# Use Solve Function\n\ndef solve(lines):\n def dfs(depth, l):\n if depth == 0:\n calc(l)\n return\n for i in range(4):\n dfs( depth - 1, l + str(i) )\n\n def c...
['Wrong Answer', 'Accepted']
['s194577642', 's479385950']
[4996.0, 5008.0]
[377.0, 388.0]
[1062, 1066]
p03111
u580697892
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic poi...
['#coding: utf-8\nimport numpy as np\n\nN, A, B, C = map(int, input().split())\nbumboo = np.array([int(input()) for _ in range(N)])\nmagic = 0\nfor i in [A, B, C]:\n bumboo_diff = bumboo - i\n bumboo_diff = np.where(bumboo_diff >= 0)\n if np.sum(bumboo_diff) >= 2:\n magic += 10\n else:\n magic...
['Runtime Error', 'Runtime Error', 'Accepted']
['s159538611', 's357924251', 's805846705']
[12504.0, 12504.0, 3064.0]
[150.0, 149.0, 75.0]
[342, 342, 642]
p03111
u584174687
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic poi...
["\nnow_ans = 100000\n\n\ndef kotae(A, a_tree, a_tree_sum):\n ans = (a_tree - 1) * 10 + abs(a_tree_sum - A)\n if a_tree == 0:\n ans = 100000\n return ans\n\ndef calc_final(A, B, C, a_tree, b_tree, c_tree, a_tree_sum, b_tree_sum, c_tree_sum):\n global now_ans\n ans = 0\n ans += kotae(A, a_tree, ...
['Runtime Error', 'Accepted']
['s024692877', 's845264821']
[3316.0, 3192.0]
[19.0, 117.0]
[1941, 1921]
p03111
u603234915
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic poi...
['N, A, B, C = map(int, input().split())\nl = [int(input()) for i in range(N)]\nINF = 10 ** 9\n\ndef dfs(cur, a, b, c):\n if cur == N:\n return abs(a - A) + abs(b - B) + abs(c - C) - 30 if min(a, b, c) > 0 else INF\n ret0 = dfs(cur + 1, a, b, c)\n ret1 = dfs(cur + 1, a + l[cur], b, c)\n ret2 = dfs(c...
['Runtime Error', 'Accepted']
['s444630367', 's017908737']
[3064.0, 3064.0]
[17.0, 70.0]
[452, 455]
p03111
u606878291
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic poi...
["from itertools import product, permutations\n\nN, A, B, C = map(int, input().split(' '))\nL = [int(input()) for _ in range(N)]\n\nans = 10 ** 9\nfor groups in product(range(4), repeat=N):\n items = []\n group_a = []\n group_b = []\n group_c = []\n\n for group, length in zip(groups, L):\n if grou...
['Wrong Answer', 'Accepted']
['s143046020', 's437097956']
[9292.0, 9204.0]
[737.0, 188.0]
[1382, 790]
p03111
u620600011
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic poi...
['@n, @a, @b, @c = gets.chomp.split(" ").map(&:to_i)\n\n@l = []\n@n.times do\n @l << gets.chomp.to_i\nend\nINF = 10**9\n\ndef dfs(cur, a, b, c)\n if cur == @n\n if [a, b, c].min > 0\n return (a - @a).abs + (b - @b).abs + (c - @c).abs - 30\n else\n return INF\n end\n end\n ret0 = dfs(cur + 1, a, b...
['Runtime Error', 'Accepted']
['s263876764', 's075959773']
[2940.0, 3064.0]
[17.0, 72.0]
[509, 437]
p03111
u623065116
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic poi...
['N, A, B, C = map(int, input().split())\nl = list(int(input()) for i in range(N))\ninf = 10**9\n\n def dfs(cur,a,b,c):\n if cur == N:\n return abs(a - A) + abs(b - B) + abs(c - C) - 30 if min(a, b, c) > 0 else inf\n ret0 = dfs(cur+1,a,b,c)\n ret1 = dfs(cur+1,a+l[cur],b,c) + 10\n ...
['Runtime Error', 'Runtime Error', 'Accepted']
['s040094973', 's050751973', 's228993554']
[2940.0, 2940.0, 3064.0]
[17.0, 17.0, 74.0]
[458, 458, 417]
p03111
u637170240
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic poi...
['N, A, B, C = map(int, input().split())\nL = [int(input()) for i in range(N)]\nprint(L)\n\n\ndef dfs(cur, a, b, c):\n if cur == N:\n return abs(a-A) + abs(b-B) + abs(c-C) - 30 if min(a, b, c) else 1000000000\n\n path_null = dfs(cur+1, a, b, c)\n path_a = dfs(cur+1, a+L[cur], b, c) + 10\n path_b = df...
['Wrong Answer', 'Accepted']
['s831718444', 's613843320']
[3064.0, 3064.0]
[71.0, 74.0]
[454, 445]
p03111
u652656291
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic poi...
['N,A,B,C = map(int,input().split())\nl = [int(input()) for _ in range(n)]\nINF=10**9\n\ndef dfs(cur, a, b, c):\n if cur == N:\n return abs(a - A) + abs(b - B) + abs(c - C) - 30 if min(a, b, c) > 0 else INF\n ret0 = dfs(cur + 1, a, b, c)\n ret1 = dfs(cur + 1, a + l[cur], b, c) + 10\n ret2 = dfs(cur + 1, a, b + l...
['Runtime Error', 'Runtime Error', 'Accepted']
['s100861001', 's132935140', 's787999715']
[3064.0, 3064.0, 3064.0]
[17.0, 19.0, 75.0]
[429, 429, 375]
p03111
u653807637
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic poi...
['n, a, b, c = list(map(int, input().split()))\nls = [int(input()) for _ in range(n)]\n\nmin_ans = 10 ** 10\nfor i in range(4 ** n):\n\tmm = [[], [], [],[]]\n\ttmp = i\n\tfor i2 in range(n):\n\t\tg = tmp // (4 ** (n - i2 - 1))\n\t\ttmp = tmp % (4 ** (n - i2 - 1))\n\t\tmm[g%4].append(ls[i2])\n\t\n\tif len(mm[0]) * len(m...
['Wrong Answer', 'Accepted']
['s985077307', 's513655916']
[5364.0, 3064.0]
[822.0, 646.0]
[530, 531]
p03111
u664796535
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic poi...
["import numpy as np\n\nn, a, b, c = map(int, input().split(' '))\nls = []\nfor _ in range(n):\n ls.append(int(input()))\nn = 0\n\n\ndef solve(obj):\n c = len(ls)\n dp = np.zeros((obj + 1, c + 1), dtype=int)\n dp[1:, 0] = 10000\n for j in range(1, c + 1):\n dp[0, j] = min(ls[:j])\n for i in ran...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s143650742', 's956267070', 's437943514']
[14556.0, 21732.0, 12508.0]
[275.0, 326.0, 203.0]
[661, 524, 467]
p03111
u668503853
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic poi...
['\nN, A, B, C = map(int, input().split())\nl = [int(input()) for i in range(N)]\nINF = 10 ** 9\ndef dfs(cur, a, b, c):\nif cur == N:\nreturn abs(a - A) + abs(b - B) + abs(c - C) - 30 if min(a, b, c) > 0 else INF\nret0 = dfs(cur + 1, a, b, c)\nret1 = dfs(cur + 1, a + l[cur], b, c) + 10\nret2 = dfs(cur + 1, a, b + l[cur...
['Runtime Error', 'Runtime Error', 'Accepted']
['s024443075', 's998948221', 's677696995']
[2940.0, 2940.0, 3064.0]
[17.0, 17.0, 70.0]
[433, 438, 450]
p03111
u672494157
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic poi...
['import sys\nimport math\nfrom collections import deque\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(N, A, B, C, inputs):\n bamboos = [int(i) for i in inputs]\n\n def cost(cursor, a, b, c):\n if cursor == ...
['Runtime Error', 'Accepted']
['s413494333', 's918618227']
[3316.0, 3316.0]
[21.0, 82.0]
[987, 985]
p03111
u677121387
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic poi...
['from itertools import product \nn,a,b,c = map(int,input().split())\nl = [int(input()) for _ in range(n)]\ntar = [a,b,c]\nans = float("inf")\nfor p in product(range(4),repeat=8):\n mp = 0\n length = [0]*3\n for i,j in enumerate(p):\n if j == 3: continue\n if length[j] > 0: mp += 10\n leng...
['Runtime Error', 'Accepted']
['s826195614', 's050813751']
[3064.0, 3064.0]
[352.0, 358.0]
[460, 460]
p03111
u677440371
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic poi...
['{\n "cells": [\n {\n "cell_type": "code",\n "execution_count": 4,\n "metadata": {},\n "outputs": [\n {\n "name": "stdout",\n "output_type": "stream",\n "text": [\n "5 100 90 80\\n"\n ]\n }\n ],\n "source": [\n "N,A,B,C = map(int, input().split())"\n ]\n },\n {\n "cell_...
['Runtime Error', 'Accepted']
['s056169006', 's291301168']
[3064.0, 10996.0]
[18.0, 282.0]
[1868, 833]
p03111
u693378622
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic poi...
['def dfs(a, b, c, k)\n \n if k == N\n nil if [a, b, c].min == 0\n return (A-a).abs + (B-b).abs + (C-c).abs - 10 * 3\n end\n \n x = dfs(a+L[k], b, c, k+1) + 10\n y = dfs(a, b+L[k], c, k+1) + 10\n z = dfs(a, b, c+L[k], k+1) + 10\n w = dfs(a, b, c, k+1)\n \n [x, y, z, w].compact.min\nend\n\nN, A, B, C = g...
['Runtime Error', 'Accepted']
['s687044193', 's130995556']
[2940.0, 3064.0]
[17.0, 76.0]
[394, 454]
p03111
u693716675
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic poi...
['N,A,B,C=[int(i) for i in input().split()]\nl=[int(input()) for _ in range(n)]\nINF=10**18\n\ndef dfs(cur, a, b, c):\n if cur==N:\n return abs(a-A)+abs(b-B)+abs(c-C)-30 \n ret0 = dfs(cur+1,a,b,c)\n ret1 = dfs(cur+1,a+l[cur],b,c)+10\n ret2 = dfs(cur+1,a,b+l[cur],c)+10 \n ret3 = dfs(cur+1,a,b,c+...
['Runtime Error', 'Accepted']
['s650572762', 's241339842']
[3064.0, 3064.0]
[17.0, 75.0]
[379, 396]
p03111
u698176039
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic poi...
['N,A,B,C = map(int,input().split())\n\nl = [int(input()) for _ in range(N)]\n\nans = 2 ** 20 -1\nfor i in range(N):\n for j in range(N):\n if i == j: continue\n for k in range(N):\n if i == k or j == k : continue\n \n x,y,z = l[i],l[j],l[k]\n cnt = 0\n ...
['Wrong Answer', 'Accepted']
['s650319061', 's470745661']
[3064.0, 3064.0]
[21.0, 424.0]
[844, 536]
p03111
u706929073
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic poi...
['\n(N, A, B, C) = map(int, input().split())\nl = [int(input()) for _ in range(N)]\n\n\ndef dfs(index, a, b, c):\n if N == index:\n if 0 < min(a, b, c):\n return abs(a - A) + abs(b - B) + abs(c - C) - 30\n else:\n return 1 ** 9\n costs = []\n costs.append(dfs(index + 1, a, b...
['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s031773521', 's669385878', 's977422219', 's985237886', 's676426573']
[3064.0, 3192.0, 3064.0, 3064.0, 3064.0]
[72.0, 21.0, 71.0, 72.0, 63.0]
[1326, 529, 447, 447, 508]
p03111
u716043626
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic poi...
['N, A, B, C = map(int, input().split())\nl = [int(input()) for i in range(N)]\nINF = 10 ** 9\n\ndef dfs(cur, a, b, c):\n if cur == N:\n return abs(a - A) + abs(b - B) + abs(c - C) - 30 if min(a,b,c) > 0 else INF\n ret0 = dfs(cur + 1, a, b, c)\n ret1 = dfs(cur + 1, a + l[cur], b, c) + 10\n ret2 = dfs...
['Wrong Answer', 'Accepted']
['s820895711', 's127654440']
[3952.0, 3064.0]
[137.0, 73.0]
[514, 450]
p03111
u720636500
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic poi...
['N, A, B, C = map(int, input().split())\nl = [int(input()) for i in range(N)]\ninf = 10 ** 9\n\ndef dfs(cur, a, b, c):\n if cur == N:\n if min(a, b, c) > 0:\n return abs(a - A) + abs(b - B) + abs(c - C) \n else:\n return inf\n else: \n ret0 = dfs(cur + 1, a, b, c) \n ret1 = dfs(cur + 1, a + l[cur]...
['Runtime Error', 'Runtime Error', 'Accepted']
['s112200751', 's577220615', 's492136843']
[2940.0, 2940.0, 3064.0]
[17.0, 17.0, 75.0]
[468, 434, 484]
p03111
u721316601
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic poi...
['import bisect\n\nans = 10**20\n\nN, K = list(map(int, input().split()))\nx = [-10**20] + list(map(int, input().split())) + [10**20]\n\nzero = bisect.bisect_left(x, 0)\n\nleft = x[:zero] + [0] \nright = [0] + x[zero:]\nleft.reverse()\nl = len(left)\nr = len(right)\n\nidxs = [[K-i, i] for i in range(K+1) if K-i < l and...
['Runtime Error', 'Accepted']
['s586229855', 's483823996']
[3064.0, 3064.0]
[18.0, 69.0]
[424, 493]
p03111
u729938879
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic poi...
['N, A, B, C = map(int, input().split())\nl = [int(input()) for i in range(N)]\ndef calc(take, a, b, c):\n if take == N:\n return abs(a-A)+abs(b-B)+abs(c-C) \n ret0 = calc(take+1, a, b, c)\n ret1 = calc(take+1, a+l[take], b, c) + 10\n ret2 = calc(take+1, a, b+l[take], c) + 10\n ret3 = calc(take+1,...
['Wrong Answer', 'Accepted']
['s371762138', 's004839256']
[3064.0, 3064.0]
[59.0, 69.0]
[397, 439]
p03111
u731368968
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic poi...
['8 1000 800 100\n300\n333\n400\n444\n500\n555\n600\n666', 'N, A, B, C = map(int, input().split())\nl = []\nfor i in range(N):\n l.append(int(input()))\nans = 100000000\n\n\ndef rec(a, b, c, d):\n if d == N:\n if a[1] > 0 and b[1] > 0 and c[1] > 0:\n global ans\n ans = min(\n ...
['Runtime Error', 'Accepted']
['s092673436', 's914191421']
[2940.0, 3064.0]
[17.0, 81.0]
[46, 626]
p03111
u754022296
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic poi...
['import sys\nsys.setrecursionlimit("10**7")\n\nN, A, B, C = map(int, input().split())\nl = [int(input()) for i in range(N)]\nINF = 10 ** 9\ndef dfs(cur, a, b, c):\n if cur == N:\n return abs(a - A) + abs(b - B) + abs(c - C) - 30 if min(a, b, c) > 0 else INF\n ret0 = dfs(cur + 1, a, b, c)\n ret1 = dfs(cur + 1, a ...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s240401520', 's302399244', 's876804087', 's371168216']
[3064.0, 2940.0, 2940.0, 3064.0]
[17.0, 17.0, 18.0, 74.0]
[479, 433, 477, 476]
p03111
u762557532
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic poi...
["\n\nimport numpy as np\nfrom copy import deepcopy\n\nN, A, B, C = map(int,input().split())\nL = [list(map(int,input().split())) for i in range(N)]\n\nL = np.array(L)\nmax_merge = N-3\n#min_MP = float('Inf')\n\n\n\ndef bamboo2MP_nomerge(bamboo, A, B, C):\n arr = deepcopy(bamboo)\n n_bamboo = len(arr)\n bamboo_A = n...
['Wrong Answer', 'Accepted']
['s029334311', 's561044026']
[12660.0, 3064.0]
[152.0, 353.0]
[950, 823]
p03111
u764956288
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic poi...
['N,A,B,C = map(int, input().split())\n\nbms = [int(input()) for _ in Range(N)]\n\ndef dfs(cur,a,b,c):\n if cur == N:\n s = abs(A-a)+abs(B-b)+abs(C-c)-30 if min(a,b,c) > 0 else 10**9\n return s\n s_0 = dfs(cur+1,a,b,c)\n s_a = dfs(cur+1,a+bms[cur],b,c) + 10\n s_b = dfs(cur+1,a,b+bms[cur],c) + ...
['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s064925562', 's392507167', 's963033480', 's984021878', 's573676194']
[3064.0, 3064.0, 13200.0, 3064.0, 3064.0]
[18.0, 17.0, 147.0, 18.0, 76.0]
[404, 296, 32, 406, 404]
p03111
u778814286
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic poi...
['N, A, B, C = map(int, input().split())\nL = [int(input()) for _ in range(N)]\n\n\n\n\n\ninitialSum = []\nfor i in range(2**N): \n nowsum = 0\n nowbamboocnt = 0\n for j in range(N): \n if i % (2**(j+1)) >= 2**j:\n nowbamboocnt += 1\n nowsum += L[j] \n initialSum.append([nowsum,...
['Wrong Answer', 'Accepted']
['s750895264', 's195799866']
[3188.0, 3316.0]
[186.0, 268.0]
[3708, 3544]
p03111
u788068140
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic poi...
['import math\n\nN, A, B, C = 5, 100, 90, 80\nARR = [\n 98,\n 40,\n 30,\n 21,\n 80\n]\n\n# N, A, B, C = map(int, input().split())\n# ARR = []\n\n# ARR.append(int(input()))\nresult = []\n\n\ndef dfs(deep, crr):\n if deep == N:\n ok, res = calculate(crr)\n if ok:\n result.ap...
['Wrong Answer', 'Accepted']
['s024952290', 's654300935']
[3188.0, 5020.0]
[31.0, 314.0]
[1191, 1158]
p03111
u791082321
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic poi...
['N, A, B, C = map(int, input().split())\nl = [int(input()) for i in range(N)]\nINF = 10 ** 9\n\ndef dfs(cur, a, b, c):\n\tif cur == N:\n\t\treturn abs(a - A) + abs(b - B) + abs(c - C) - 30 if min(a, b, c) > 0 else INF\n\tret0 = dfs(cur + 1, a, b, c)\n \tret1 = dfs(cur + 1, a + l[cur], b, c) + 10\n\tret2 = dfs(cur + 1,...
['Runtime Error', 'Accepted']
['s654777849', 's840152383']
[2940.0, 3064.0]
[17.0, 73.0]
[430, 437]
p03111
u807772568
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic poi...
['n,a,b,c = map(int,input().spilt())\n\nko = [int(input()) for i in range(n)]\nINF = 10**9\n\n def dfs(q,w,e,r):\n \tif q == n:\n \t\t return abs(a-w) + abs(b-e) + abs(c-r) - 30 if min(a,b,c) > 0 else INF\n \tre0 = dfs(q+1,w,e,r)\n \tre1 = dfs(q+1,w+ko[q],e,r) + 10\n \tre2 = dfs(q+1,w,e+ko[ko],r) + 10\n \tre3 = dfs(q+1...
['Runtime Error', 'Runtime Error', 'Accepted']
['s523191056', 's876687903', 's803832675']
[2940.0, 2940.0, 3064.0]
[18.0, 17.0, 71.0]
[369, 365, 368]
p03111
u811132356
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic poi...
['N,A,B,C=map(int,input().split())\nl=[]\n\nfor i in range(N):\nl.append(int(input()))\nINF=100000\n\ndef mp(j,a,b,c):\n if j==N:\n return abs(a-A)+abs(b-B)+abs(c-C)-30 if min(a,b,c)>0 else INF\n ret0=mp(j+1,a,b,c)\n ret1=mp(j+1,a+l[j],b,c)+10\n ret2=mp(j+1,a,b+l[j],c)+10\n ret3=mp(j+1,a,b,c+l[j])+1...
['Runtime Error', 'Accepted']
['s758319437', 's401639198']
[2940.0, 3188.0]
[18.0, 72.0]
[361, 367]
p03111
u815659544
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic poi...
['#%%\nimport sys\nINPUT = sys.stdin.readline\n\ndef SINGLE_INT(): return int(INPUT())\ndef MULTIPLE_INT_LIST(): return list(map(int, INPUT().split()))\ndef MULTIPLE_INT_MAP(): return map(int, INPUT().split())\ndef SINGLE_STRING(): return INPUT()\ndef MULTIPLE_STRING(): return INPUT().split()\n\n#%%\n\nN, A, B, C = MUL...
['Runtime Error', 'Accepted']
['s986055138', 's935661663']
[3064.0, 3064.0]
[18.0, 73.0]
[1467, 1480]
p03111
u818349438
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic poi...
['n,A,B,C = map(int,input().split())\nl = list(int(input())for _ in range(n))\ndef dfs(depth,a,b,c):\n if depth == n:\n return abs(a-A)+abs(b-B)*abs(c-C)-30 if min(a,b,c) >0 else 10**9\n x = dfs(depth+1,a,b,c)\n y = dfs(depth+1,a+l[depth],b,c) +10\n z = dfs(depth+1,a,b+l[depth],c) +10\n w = dfs(d...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s007767576', 's805594482', 's987365546']
[3064.0, 3064.0, 3064.0]
[75.0, 74.0, 74.0]
[394, 387, 394]
p03111
u826263061
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic poi...
['import itertools as itr\n\nn, a, b, c = list(map(int, input().split()))\nl = []\nfor _ in range(n):\n l.append(int(input()))\n \nl.sort()\n\ncost = 10**9\nfor cr in range(1, n-2):\n for ccomb in itr.combinations(l, cr):\n ccosti = abs(c-sum(ccomb)) + (cr-1)*10\n cl = l[:]\n for icomb in ...
['Wrong Answer', 'Accepted']
['s399576672', 's015431407']
[3064.0, 3064.0]
[29.0, 60.0]
[883, 881]
p03111
u835482198
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic poi...
["N, A, B, C = map(int, input().split())\nl = [int(input()) for i in range(N)]\n\n\ndef dfs(cur, a, b, c):\n if cur == N:\n if min(a, b, c) > 0:\n return abs(a - A) + abs(b - B) + abs(c - C) - 30\n else:\n return float('inf')\n ret0 = dfs(cur + 1, a, b, c)\n ret1 = dfs(cur +...
['Runtime Error', 'Accepted']
['s101216109', 's103565758']
[3188.0, 3188.0]
[18.0, 76.0]
[491, 492]
p03111
u842964692
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic poi...
['N,A,B,C=map(int,input().split())\nL=[int(input()) for _ in range(N)]\n\n\n# L.append(int(input())\n\nans=10**18\ndef cost_calc(pp,TAKEs):\n if TAKEs==[]:\n return 10**8\n \n else:\n ans=0\n ans+=(len(TAKEs)-1)*10\n ans+=abs(pp-sum(TAKEs))\n return ans\n\nassign=[]#[A,B,C...
['Runtime Error', 'Accepted']
['s618374398', 's101045429']
[3064.0, 3064.0]
[19.0, 290.0]
[716, 498]
p03111
u863150907
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic poi...
['\n\n\n# A = 90, L! = [40,30,21] -> 20 + 1\nimport copy as cp\ninf = 10**9\ndef cost(li, length):\n if len(li)==0:\n return inf\n return (len(li)-1)*10 + abs(sum(li)-length)\n\ndef search_cost(ln,assignment,length):\n# from IPython.core.debugger import Pdb; Pdb().set_trace()\n if len(ln)==0:\n ...
['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s497534545', 's626296828', 's982305622', 's797984681']
[9332.0, 3064.0, 3152.0, 3700.0]
[2089.0, 192.0, 18.0, 1676.0]
[1170, 1123, 988, 1153]
p03111
u875361824
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic poi...
['def main():\n N, A, B, C = map(int, input().split())\n ls = [int(input()) for _ in range(N)]\n\n tmp = []\n from itertools import permutations\n for a, b, c in permutations([A, B, C]):\n x = f(N, a, b, c, ls)\n tmp.append(x)\n\n ans = min(tmp)\n print(ans)\n\n\ndef f(N, A, B, C, ls)...
['Runtime Error', 'Accepted']
['s505763746', 's834175008']
[3192.0, 3064.0]
[19.0, 86.0]
[2111, 943]
p03111
u879870653
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic poi...
['N,A,B,C = map(int,input().split())\nL = list(int(input()) for i in range(N))\n\ndef f(cur,a,b,c) :\n if cur == N :\n if min(a,b,c) > 0 :\n return abs(a-A) + abs(b-B) + abs(c-C) - 30\n else :\n return float("inf")\n ret0 = f(cur+1,a,b,c)\n ret1 = f(cur+1,a+L[cur],b,c) + 10\...
['Runtime Error', 'Accepted']
['s523072206', 's229995380']
[3064.0, 3192.0]
[17.0, 305.0]
[444, 665]
p03111
u883203948
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic poi...
['data = input().split()\nN = int(data[0])\nA = int(data[1])\nB = int(data[2])\nC = int(data[3])\n\ni = 0\nkd = []\nwhile i < N:\n kd.append(int(input()))\n i += 1\n\n\ncur = 0 \nsc = 0\ndef ans(n,a,b,c):\n if cur == N:\n return abs(a-A) + abs(b-B)+ abs(c-C) - 30 if min(a,b,c) > 0 else 1000000\n ret0 = ans(cur+1...
['Runtime Error', 'Accepted']
['s886240217', 's091070112']
[3960.0, 3064.0]
[79.0, 74.0]
[503, 506]
p03111
u887207211
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic poi...
['N, A, B, C = map(int,input().split())\nl = [int(input()) for _ in range(N)]\n\ndef dfs(x, a, b, c):\n if x == N:\n if min(a, b, c) >= 30:\n print(a, b, c)\n return abs(a-A)+abs(b-B)+abs(c-C)-30\n else:\n return float("inf")\n \n ret0 = dfs(x+1, a, b, c)\n ret1 = dfs(x+1, a+l[x], b, c)+10\n r...
['Wrong Answer', 'Accepted']
['s251841821', 's696207194']
[4044.0, 3064.0]
[150.0, 79.0]
[432, 409]
p03111
u909991537
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic poi...
['import numpy as np\nN, A, B, C = (int(i) for i in input().split()) \nl = [int(input()) for i in range(N)] \n\ndef dfs(cur, a, b, c):\n if cur == N:\n return abs(a-A) + abs(b-B) + abs(c-C) - 30 if min(a, b, c) > 0 else np.inf\n \n ret0 = dfs(cur + 1, a, b, c)\n ret1 = dfs(cur + 1, a + l[cur], b, c) + 10\n ret...
['Wrong Answer', 'Accepted']
['s510387464', 's765658970']
[12148.0, 12260.0]
[208.0, 207.0]
[511, 453]
p03111
u917733926
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic poi...
['N, A, B, C = map(int, input().split())\nl = [int(input()) for i in range(N)]\nINF = 10 ** 9\n\ndef cost(index, a,b,c):\n if index == N:\n return (abs(a-A) + abs(b-B) + abs(c-C) - 30) if min(a,b,c) > 0 else INF\n ret0 = cost(index+1, a,b,c)\n ret1 = cost(index+1, a+l[index],b,c) + 10\n ret2 = cost(i...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s847427926', 's872895066', 's223496701']
[3064.0, 3064.0, 3064.0]
[72.0, 73.0, 72.0]
[449, 429, 444]
p03111
u923270446
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic poi...
['n,a,b,c=map(int,input().split())\nl=[int(input())for i in range(n)]\ndef dfs(i,x,y,z):\n if i==n:return abs(a-x)+abs(b-y)+abs(c-z)-30if a+b+c>=3else 10**9+7\n A,B,C,D=dfs(i+1,x,y,z),dfs(i+1,x+l[i],y,z)+10,dfs(i+1,x,y+l[i],z)+10,dfs(i+1,x,y,z+l[i])+10\n return min(A,B,C,D)\nprint(dfs(0,0,0,0)', 'n,a,b,c=map(int,input(...
['Runtime Error', 'Accepted']
['s666381530', 's252371409']
[8864.0, 9160.0]
[24.0, 67.0]
[286, 272]
p03111
u932719058
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic poi...
['# review\nimport copy\nn, a, b, c = map(int, input().split())\nlList = []\n\nfor _ in range(n) :\n lList.append(int(input()))\n\nlList.sort()\ngoal = [a, b, c]\ngoal.sort()\n\ndef removed(i,j) :\n goal.remove(i)\n lList.remove(j)\n\nmp = 0\ndef pick(x, y) : # if same value & goal < lList\n ...
['Runtime Error', 'Accepted']
['s600541325', 's469067706']
[3444.0, 3064.0]
[22.0, 69.0]
[1614, 397]
p03111
u932868243
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic poi...
["import itertools\nA,B,C,n=map(int,input(),split())\nl=[int(input()) for i in range(n)]\nll=[]\nfor p in itertools.product(['A','B','C','Z'].repeat=n):\n ans=0\n a=0\n b=0\n c=0\n for i in range(n):\n if p[i]=='A':\n a+=l[i]\n elif p[i]=='B':\n b+=l[i]\n elif p[i]=='C':\n c+=l[i]\n ans+=(...
['Runtime Error', 'Runtime Error', 'Accepted']
['s015798759', 's303304112', 's645785780']
[3064.0, 3064.0, 5040.0]
[17.0, 18.0, 321.0]
[363, 462, 498]
p03111
u933341648
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic poi...
['N, A, B, C = map(int, input().split())\nl = [int(input() for i in range(n))]\ninf = 10**4\n\ndef bamboo_connect(i, a, b, c):\n if i == N:\n if all(a, b, c):\n return abs(a-A) + abs(b-B) + abs(c-C) - 30\n else:\n return inf\n no_connect = bamboo_connect(i+1, a, b, c)\n choi...
['Runtime Error', 'Accepted']
['s622177042', 's541967856']
[3064.0, 3064.0]
[17.0, 64.0]
[552, 554]
p03111
u934868410
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic poi...
['n,a,b,c = map(int,input().split())\nl = [int(input()) for _ in range(n)]\nans = 10000\nfor i in range(2 ** (2*n)):\n v = [0,0,0,0]\n assign = [(i>>(2*j)) & 3 for j in range(n)]\n for j in range(n):\n v[assign[j]] += l[j] + (v[assign[j]] > 0) * 10\n if v[1] == 0 or v[2] == 0 or v[3] == 0:\n continue\n ans =...
['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s019915668', 's530384853', 's804632595', 's972445983']
[3064.0, 3064.0, 2940.0, 3064.0]
[406.0, 321.0, 17.0, 458.0]
[369, 343, 403, 421]
p03111
u941434715
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic poi...
['#coding: utf-8\nimport math\nimport heapq\nimport bisect\nimport numpy as np\n#from scipy.misc import comb\n\nN,A,B,C = map(int, input().split())\n\nL = []\nfor i in range(N):\n l = int(input())\n L.append(l)\n\nans = 10**9\n\nfor i in range(1<<(2*N)):\n a = b = c = 0\n tmp = 0\n for j in range(N):\n ...
['Wrong Answer', 'Accepted']
['s235691381', 's113394773']
[19436.0, 12932.0]
[1009.0, 572.0]
[800, 781]
p03111
u941753895
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic poi...
['import itertools\n\nn,a,b,c=map(int,input().split())\nl0=[a,b,c]\nl0.sort()\nl02=l0[:]\nl02.reverse()\nl=[]\nfor i in range(n):\n x=int(input())\n if l0.count(x)>0:\n l0.remove(x)\n else:\n l.append(x)\nif len(l0)==0:\n print(0)\n exit()\nl.sort()\nll=l[:]\n\ncst1=0\nl2=[]\nfor i in l0:\n if i<l[0]:\n ...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s134330745', 's160415984', 's831100989', 's910506996']
[3064.0, 3188.0, 3064.0, 10712.0]
[18.0, 18.0, 18.0, 71.0]
[622, 1032, 619, 861]
p03111
u953237709
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic poi...
["from sys import setrecursionlimit\nsetrecursionlimit(1000000)\n\ndef permute(a, idx):\n if idx == len(a):\n permutations.append(a[::])\n for i in range(idx, len(a)):\n a[i], a[idx] = a[idx], a[i]\n permute(a, idx + 1)\n a[i], a[idx] = a[idx], a[i]\n\ndef doit(a, b, c, idx):\n if (...
['Runtime Error', 'Accepted']
['s034570178', 's976114978']
[3064.0, 3188.0]
[17.0, 326.0]
[1152, 938]
p03111
u955251526
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic poi...
['n, k = map(int, input().split())\nx = list(map(int, input().split()))\nmintime = 10**20\nfor i in range(n-k+1):\n left = x[i]\n right = x[i+k-1]\n abss = (abs(left), abs(right))\n if left * right >= 0:\n mintime = min(mintime, max(abss))\n else:\n mintime = min(mintime, min(abss) * 2 + ma...
['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s574568941', 's750487335', 's883896473', 's774013452']
[3060.0, 3064.0, 3060.0, 3064.0]
[19.0, 420.0, 17.0, 66.0]
[332, 657, 332, 453]
p03111
u963903527
2,000
1,048,576
You have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively. Your objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number: * Extension Magic: Consumes 1 _MP_ (magic poi...
['N, A, B, C = map(int, input().split())\nl = [int(input()) for _ in range(N)]\ndef dfs(cur, a, b, c):\n if cur == N:\n return abs(a-A)+abs(b-B)+abs(c-C) if min(a,b,c) > 0 else return 10**8\n ret0 = dfs(cur+1, a, b, c)\n ret1 = dfs(cur+1, a+l[cur], b, c) + 10\n ret2 = dfs(cur+1, a, b+l[cur], c) + 10\n ret3 = df...
['Runtime Error', 'Accepted']
['s858785348', 's971028043']
[2940.0, 3064.0]
[18.0, 72.0]
[401, 393]