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
p03128
u067729694
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
['N, M = map(int, input().split())\nA = list(map(int, input().split()))\n\nimport sys\nINT_MIN = sys.maxsize * -1\nmatch = [-100,2,5,5,4,5,6,3,7,6]\nCHOICES = []\nfor i in A:\n if (i == 6) and (9 in A):\n continue\n if (i == 3) and (5 in A):\n continue\n if (i == 2) and (3 in A or 5 in A):\n ...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s139713402', 's376444936', 's686837800']
[7028.0, 3956.0, 14820.0]
[276.0, 2104.0, 119.0]
[730, 814, 814]
p03128
u067983636
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
['N, M = map(int, input().split())\nA = list(map(int, input().split()))\ncost = [-1, 2, 5, 5, 4, 5, 6, 3, 7, 6]\ncan_cost = sorted([cost[a] for a in A])\nD = {}\nfor a in A:\n c = cost[a]\n D[c] = max(a, D.setdefault(c, -1))\n\nmin_cost = can_cost[0]\nmin_cost_num = D[min_cost]\n\n\ndef f2(v, l, num):\n L = li...
['Runtime Error', 'Accepted']
['s178419022', 's860106078']
[3064.0, 3192.0]
[18.0, 22.0]
[1197, 1210]
p03128
u069602573
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
['n,m=map(int, input().split()) \na=list(map(int, input().split())) \nneedNum = {1:2, 2:5, 3:5, 4:4, 5:5, 6:6, 7:3, 8:7, 9:6}\n\na.sort()\nneed = list()\nfor i in range(m):\n need.append(needNum[a[i]])\n\nminNum = a[need.index(min(need))] \nminNeed = min(need) の必要数\n\ndigit = n//minNeed\nremain = n % minNeed\n\n\...
['Wrong Answer', 'Accepted']
['s875724196', 's554570081']
[3956.0, 3308.0]
[30.0, 86.0]
[957, 787]
p03128
u075012704
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
['\nN, M = map(int, input().split())\nCosts = {1: 2, 2: 5, 3: 5, 4: 4, 5: 5, 6: 6, 7: 3, 8: 7, 9: 6}\nA = sorted(list(map(int, input().split())), reverse=True) \n\n\n\ndp = [-float(\'inf\')] * (N + 1)\ndp[0] = 0\n\n\nfor a in A:\n cost = Costs[a]\n for j in range(N + 1):\n if cost > j:\n contin...
['Wrong Answer', 'Accepted']
['s503100386', 's190566320']
[3316.0, 3316.0]
[61.0, 81.0]
[1180, 1178]
p03128
u077337864
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
["n, m = map(int, input().split())\nalist = list(sorted(map(int, input().split())))[::-1]\nmd = {1:2, 2:5, 3:5, 4:4, 5:5, 6:6, 7:3, 8:7, 9:6}\n\ndp = [[0, []] for _ in range(n + 1)]\n\nfor i in range(2, n+1):\n maxn = 0\n maxt = []\n for a in alist:\n if i - md[a] < 0:\n continue\n if maxn < dp[i-md[a]][0...
['Wrong Answer', 'Accepted']
['s695849212', 's728169159']
[225612.0, 3316.0]
[624.0, 74.0]
[470, 479]
p03128
u085717502
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
['\n# coding: utf-8\n\n# In[46]:\n\n\ndef main():\n N,M = map(int, input().split())\n A = list(map(int, input().split()))\n \n match = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6]\n \n result = [-1 for _ in range(N+1)]\n result[0] = 0\n \n print(result)\n \n for i in range(1, N+1):\n for a in ...
['Runtime Error', 'Accepted']
['s440622103', 's090941326']
[134940.0, 14388.0]
[2063.0, 121.0]
[533, 534]
p03128
u087917227
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
['N,M = map(int, input().split())\nam = list(map(int, input().split()))\nc = [0,2,5,5,4,5,6,3,7,6]\nf = [-1]*10010\nf[0]=0\nfor i in range(1,N+1):\n for x in am:\n if i-c[x] >= 0:\n f[i] = max(f[i], f[i-c[x]]*10 +x)\n \nprint(f[n])', 'N,M = map(int, input().split())\nam = list(map(int, i...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s044692153', 's572510261', 's694331947', 's030881309']
[14388.0, 3064.0, 3064.0, 14388.0]
[157.0, 17.0, 17.0, 154.0]
[251, 251, 250, 251]
p03128
u102278909
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
['# coding: utf-8\n\nimport sys\ninput = sys.stdin.readline\n\nN, M = map(int, input().split())\nA = list(map(int, input().split()))\n\nneed = [0,2,5,5,4,5,6,3,7,6]\n\ndp = [-1] * (N + 1)\ndp[0] = 0\n\nfor i in range(N + 1):\n for a in A:\n if i + need[a] <= N:\n dp[i + need...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s479969051', 's561849446', 's398277742']
[88068.0, 14448.0, 14692.0]
[1542.0, 142.0, 171.0]
[358, 446, 362]
p03128
u102461423
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
["import itertools\n\nN,M = map(int,input().split())\nA = [int(x) for x in input().split()]\nL = [100,2,5,5,4,5,6,3,7,6]\n\nlen_set = set(L[x] for x in A)\n\nINF = 10**18\ncan_make = [INF]*(N+1)\ncan_make[0] = 0 \n\nfor n in range(1,N+1):\n for x in len_set:\n if n-x >= 0 and can_make[n] > can_make[n-x] + 1:\n ...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s554104372', 's897196507', 's119615489']
[3432.0, 3436.0, 3676.0]
[39.0, 117.0, 40.0]
[648, 656, 650]
p03128
u138486156
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
['n, m = map(int, input().split())\na = list(map(int, input().split()))\ndp = [0] * (n+1)\nfor i in range(1, n+1):\n for j in a:\n cost_j = int("0255456376"[j])\n if i- cost_j >= 0:\n dp[i] = max(dp[i], j+dp[i-cost_j]*10)\nprint(dp[n])\n', 'n, m = map(int, input().split())\na = list(map(int,...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s183004101', 's207688540', 's193866374']
[14388.0, 134720.0, 14388.0]
[170.0, 2104.0, 169.0]
[254, 343, 326]
p03128
u139112865
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
["#118_D\nch={1:2,2:5,3:5,4:4,5:5,6:6,7:3,8:7,9:6}\n\ndef max_num(x,y):\n if x==-1:\n return -1\n if x==0:\n return y\n l=list(str(x))+[str(y)]\n l.sort(reverse=True)\n return int(''.join(l))\n\nn,m=map(int,input().split())\na=list(map(int,input().split()))\n\ndp=[-1 for _ in range(n+1)]\nd...
['Wrong Answer', 'Accepted']
['s885323713', 's972069410']
[31664.0, 14516.0]
[2104.0, 146.0]
[469, 294]
p03128
u141786930
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
['# D - Match Matching\n\nN, M = map(int, input().split())\nA = list(int(x) for x in input().split())\nmatch_list = [(0, 6), (1, 2), (2, 5), (3, 5), (4, 4), (5, 5), (6, 6), (7, 3), (8, 7), (9, 6)]\nMA = []\nfor a in A:\n MA.append(MATCH[a])\nMA.sort(key=lambda x: x[1])\n\ndef dfs(tmp, s):\n global ans\n if s =...
['Runtime Error', 'Accepted']
['s165433579', 's418017551']
[3064.0, 3420.0]
[18.0, 92.0]
[513, 921]
p03128
u160244242
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
["n, m = map(int, input().split())\nlst = list(map(int, input().split()))\nlst = sorted(lst, key = lambda x:-x)\ndic = {1:2, 2:5, 3:5, 4:4, 5:5, 6:6, 7:3, 8:7, 9:6}\n\ns = set()\nfor i in lst:\n s.add(dic[i])\ns = list(sorted(s))\n\ndp = [0] * (n+1)\nfor i in range(0, n+1):\n a = 0\n max_a = -1\n for j in s...
['Runtime Error', 'Runtime Error', 'Accepted']
['s036235691', 's741839321', 's757069466']
[3188.0, 3316.0, 3408.0]
[44.0, 37.0, 76.0]
[1001, 871, 917]
p03128
u166696759
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
['N, M = map(int, input().split())\nA = list(map(int, input().split()))\nK = [0, 2, 5, 5, 4, 5 ,6, 3, 7, 6]\ndp = [[-1,[]]for i in range(50000)]\ndef clc(B):\n B.sort(reverse=True)\n res = 0\n for b in B:\n res *= 10\n res += b\n return res\nfor i in range(N):\n for a in A:\n li = dp...
['Wrong Answer', 'Accepted']
['s498818770', 's831547163']
[70268.0, 30196.0]
[2108.0, 177.0]
[483, 480]
p03128
u169138653
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
['import sys\ninput=sys.stdin.readline\nn,m=map(int,input().split())\na=list(map(int,input().split()))\nd=dict()\nneed=[0,2,5,5,4,5,6,3,7,6]\nfor i in range(m):\n if need[a[i]] not in d:\n d[need[a[i]]]=a[i]\n else:\n if a[i]>d[need[a[i]]]:\n d[need[a[i]]]=a[i]\nd=list(d.items())\nd.sort(...
['Wrong Answer', 'Accepted']
['s998242870', 's077506914']
[5324.0, 5324.0]
[135.0, 147.0]
[1504, 1539]
p03128
u170077602
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
['import sys\ninput = sys.stdin.readline\n\n#import fractions #fractions.gcd() python~3.4\nsys.setrecursionlimit(1000000)\n\nN, M = map(int,input().split())\nA = list(map(int, input().split()))\nINF = 1e+10\ndef f(x):\n if x == 1:\n return 2\n if x == 2:\n return 5\n if x == 3:\n return 5\...
['Time Limit Exceeded', 'Time Limit Exceeded', 'Accepted']
['s755518337', 's860509644', 's207266238']
[3308.0, 3308.0, 3424.0]
[2104.0, 2104.0, 138.0]
[950, 949, 950]
p03128
u171366497
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
["N,M=map(int,input().split())\nA=list(map(int,input().split()))\nmatch=[0,2,5,5,4,5,6,3,7,6]\nmake=dict()\nfor a in A:\n make[a]=match[a]\ndp=[-1]*(N+1)\ndp[0]=0\nfor k in range(1,1+N):\n for d,m in make.items():\n if k-m<0 or dp[k-m]==-1:continue\n dp[k]=max(dp[k],dp[k-m]+1)\n \nans=''\nnow...
['Runtime Error', 'Accepted']
['s908761504', 's683501858']
[3064.0, 3416.0]
[17.0, 95.0]
[525, 451]
p03128
u174394352
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
["d=[0,2,5,5,4,5,6,3,7,6]\nN,M=map(int,input().split())\nA=list(map(int,input().split()))\nl=[]\nfor a in A:\n l.append([a,d[a]])\nl.sort(key=lambda x:x[0],reverse=True)\nl.sort(key=lambda x:x[1])\nmin_val,min_match=l[0]\n\nans=[]\nif N%min_match==0:\n ans.append(int(str(min_val)*(N//min_match)))\nfrom itertools ...
['Runtime Error', 'Accepted']
['s491710907', 's361560783']
[3064.0, 3320.0]
[17.0, 90.0]
[781, 467]
p03128
u175743386
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
['dic = {\n 1: 2,\n 2: 5,\n 3: 5,\n 4: 4,\n 5: 5,\n 6: 6,\n 7: 3,\n 8: 7,\n 9: 6\n}\n\nN, M = map(int, input().split())\nA = list(map(int, input().split()))\nA = sorted(A, reverse=True)\ndic2 = {}\nfor i in A:\n try:\n dic2[dic[i]]\n except:\n dic2[dic[i]] = i \nresult_list = []\nitems = sorted...
['Runtime Error', 'Accepted']
['s352488391', 's064144668']
[3064.0, 14668.0]
[17.0, 229.0]
[515, 314]
p03128
u179169725
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
['\n\n\n\n\nN, M = map(int, input().split())\nA = list(map(int, input().split()))\n\nA.sort(reverse=True) \n\n\nnum = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6]\n\n\n\n\ndp = [-1 * float("inf")] * (N + 1)\n\n\ndp[0] = 0\nfor a in A:\n if num[a] <= N: \n dp[num[a]] = 1\n\n\nfor i in range(1, N + 1): \n for a in A: ...
['Runtime Error', 'Accepted']
['s846470173', 's453351862']
[3064.0, 3308.0]
[18.0, 89.0]
[2030, 2028]
p03128
u181526702
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
["from sys import stdin\n\nN, M, *A = map(int, stdin.read().split())\nreq = {1: 2,\n 2: 5,\n 3: 5,\n 4: 4,\n 5: 5,\n 6: 6,\n 7: 3,\n 8: 7,\n 9: 6}\n\nB = sorted([(a, req[a]) for a in A], key=lambda x: x[0], reverse=True)\na_min, n_min = min(B, key=lambda x: x[1])\ng = [(a...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s020767769', 's427173892', 's651266219', 's687599756', 's796298682', 's839328393', 's900163927', 's969036244', 's587413984']
[3316.0, 3064.0, 3316.0, 3064.0, 3064.0, 3316.0, 3316.0, 3188.0, 3316.0]
[19.0, 17.0, 19.0, 20.0, 21.0, 2104.0, 19.0, 17.0, 19.0]
[842, 711, 716, 754, 614, 972, 562, 1100, 994]
p03128
u188745744
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
['N,M=map(int,input().split())\nl=list(map(int,input().split()))\nw=[2,5,5,4,5,6,3,7,6]\ndp=[0]*(N+1)\nfor i in range(N):\n for j in l:\n if w[j-1]+i<=N:\n dp[i+w[j-1]]=max(dp[i+w[j-1]],dp[i]*10+j)\nprint(dp[N])', 'N,M=map(int,input().split())\nl=list(map(int,input().split()))\nw=[2,5,5,4,5,6,3,7,6]\nl.s...
['Wrong Answer', 'Accepted']
['s278391928', 's203743366']
[20376.0, 20480.0]
[135.0, 134.0]
[216, 285]
p03128
u189479417
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
['N, M = map(int,input().split())\nA = list(map(int,input().split()))\nA.sort(reverse = True)\nd = [0,2,5,5,4,5,6,3,7,6]\nS = set()\nfor a in A:\n S.add(d[a])\n\nINF = 10 ** 8\ndp = [-INF for _ in range(N+1)]\ndp[0] = 0\n\nfor i in range(N+1):\n for s in S:\n if i - s >= 0:\n dp[i] = max(dp[i], ...
['Wrong Answer', 'Accepted']
['s753739225', 's775205157']
[3572.0, 3444.0]
[61.0, 65.0]
[655, 644]
p03128
u190185531
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
['import math\nimport copy\nimport bisect\n\n\n\n\n\n\n\ndef nCast(number):\n if type(number)==str:\n return int(number)\n for idx in range(0,len(number)):\n if type(number[idx])==str:\n\n number[idx]=int(number[idx])\n else:\n nCast(number[idx])\n return number\n ...
['Wrong Answer', 'Accepted']
['s728188626', 's750706175']
[4328.0, 285288.0]
[2104.0, 1091.0]
[1677, 1923]
p03128
u197300773
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
['N,M=map(int,input().split())\nx=[0,2,5,5,4,5,6,3,7,6]\na=list(map(int,input().split()))\na.sort()\nx=[ x[a[i]] for i in range(M) ]\n\n\np=[[-1 for j in range(M)] for i in range(N+10)]\np[0]=[0 for j in range(M)]\n\nfor i in range(N+1):\n for j in range(M):\n if p[i][0]>-1 and sum(p[i])+1>sum(p[i+x[j]]):\n ...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer',...
['s043474771', 's105314488', 's115222748', 's167904041', 's222073270', 's243752927', 's275889057', 's285673849', 's296855449', 's332610481', 's377417749', 's442477267', 's462536288', 's495054585', 's530945983', 's585024521', 's620683287', 's637001698', 's644372733', 's673069737', 's717475243', 's717995963', 's725354210...
[6120.0, 3956.0, 5512.0, 4084.0, 3956.0, 5544.0, 5492.0, 6196.0, 4648.0, 5512.0, 6132.0, 5544.0, 3436.0, 5512.0, 5520.0, 5544.0, 5572.0, 6128.0, 5572.0, 4084.0, 5544.0, 5512.0, 5108.0, 6144.0, 5572.0, 5544.0, 3956.0, 4084.0, 6120.0, 3436.0, 5572.0, 5544.0, 3436.0]
[435.0, 24.0, 211.0, 41.0, 24.0, 219.0, 237.0, 422.0, 254.0, 225.0, 420.0, 224.0, 69.0, 216.0, 218.0, 213.0, 226.0, 406.0, 238.0, 40.0, 235.0, 220.0, 29.0, 434.0, 221.0, 227.0, 32.0, 40.0, 415.0, 66.0, 230.0, 219.0, 70.0]
[755, 680, 1027, 972, 679, 910, 916, 797, 1008, 929, 757, 919, 772, 961, 942, 939, 917, 760, 927, 971, 992, 1039, 772, 800, 936, 938, 685, 1267, 788, 795, 1002, 938, 766]
p03128
u198440493
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
["n, m = map(int, input().split(' '))\na = list(map(int, input().split(' ')))\na = sorted(a, reverse=True)\nl = [2, 5, 5, 4, 5, 6, 3, 7, 6]\n_min = 10\nind = 10\nfor x in a:\n _ind = x-1\n if l[_ind] < _min:\n _min = l[_ind]\n ind = x\n \nl = list(map(lambda x: x-_min, l))\nmod = n % _min\nk = n // _min\nans...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s120283453', 's309230252', 's004718964']
[3064.0, 3064.0, 3064.0]
[23.0, 31.0, 18.0]
[606, 582, 544]
p03128
u201234972
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
['N, M = map( int, input().split())\nA = list( map( int, input().split()))\nC = [0,2,5,5,4,5,6,3,7,6]\ndp = [(0,0)]*(N+1)\nfor a in A:\n dp[C[a]] = (1,0)\nZ = list( set( C[a] for a in A))\nZ.sort()\n', 'N, M = map( int, input().split())\nA = list( map( int, input().split()))\nC = [0,2,5,5,4,5,6,3,7,6]\ndp = [(0,0)]*...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s083973964', 's089743134', 's330318841', 's396433918', 's443397805', 's697398237', 's818913428', 's852766220', 's110768367']
[3060.0, 3060.0, 66164.0, 3064.0, 3060.0, 3956.0, 3440.0, 3064.0, 3312.0]
[17.0, 20.0, 2104.0, 17.0, 18.0, 24.0, 2104.0, 18.0, 57.0]
[192, 610, 604, 639, 116, 604, 630, 643, 735]
p03128
u201856486
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
['# coding: utf-8\nimport sys\n\n\n# import math\n# import itertools\n\n# import numpy as np\n\n\n"""Template"""\n\n\nclass IP:\n \n\n def __init__(self):\n self.input = sys.stdin.readline\n\n def I(self):\n \n return int(self.input())\n\n def S(self):\n \n return self.inp...
['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s548369968', 's611550373', 's840645342', 's864304429', 's526513304']
[14500.0, 22336.0, 87968.0, 14388.0, 14388.0]
[133.0, 144.0, 1499.0, 151.0, 152.0]
[4894, 5077, 4914, 690, 691]
p03128
u207707177
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
['n,m = [int(i) for i in input().split()]\na = list(map(int,input().split()))\n\nmatch = [0,2,5,5,4,5,6,3,7,6]\n\ndig = [0] * (n+1)\n\ninf = 10**9\n\n\nfor i in range(1,n+1):\n lst = []\n for j in range(len(a)):\n num = a[j]\n mat = match[num]\n bef = i-mat\n if bef >= 0:\n ...
['Runtime Error', 'Accepted']
['s622909391', 's344574227']
[4392.0, 7768.0]
[157.0, 134.0]
[752, 1087]
p03128
u218494572
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
["import numpy as np\nimport math\n\nINF = 1000000\n\nN,M = map(int, input().split())\nmatch = {1:2, 2:5, 3:5, 4:4, 5:5, 6:6, 7:3, 8:7, 9:6}\nA = list(map(int, input().split()))\n\nmatch = {a:match[a] for a in A}\n\ndp = []\n\nfor i in range(N+1):\n if i == 0:\n dp.append(0)\n else:\n tmp = [dp[i-m]...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s523423940', 's928105906', 's458454263']
[18960.0, 12528.0, 21268.0]
[304.0, 181.0, 318.0]
[738, 706, 722]
p03128
u219015402
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
['N, M = map(int, input().split())\nlistA = list(map(int, input().split()))\nc = [0,2,5,5,4,5,6,3,7,6]\ndp = [-1]*10010\ndp[0] = 0\nfor j in range(1, N+1):\n\tfor a in listA:\n\t\tif j-c[a] >= 0:\n\t\t\tdp[j] = max(dp[j], a*10 + dp[j-c[a]])\nprint(dp[N])', 'N, M = map(int, input().split())\nlistA = list(map(int, input(...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s250691966', 's969961419', 's429370595']
[3384.0, 14388.0, 14516.0]
[69.0, 158.0, 151.0]
[237, 231, 235]
p03128
u259418313
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
['N, M = map(int, input().split())\nA = [int(a) for a in input().split()]\nL = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6]\nA.sort(reverse = True)\n\ndp = [0] + ([-1]*N)\nfor i in range(1, N+1):\n for a in A:\n if L[a] <= i:\n dp[i] = max(dp[i], dp[i-L[a]] * 10 + a)\n print(dp)\nprint(dp[-1])', 'N, M = map(i...
['Runtime Error', 'Accepted']
['s917762988', 's644989959']
[135292.0, 14692.0]
[1546.0, 152.0]
[291, 277]
p03128
u261646994
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
["N, M = list(map(int, input().split()))\nA = list(map(int, input().split()))\n\nnum_dict = {\n 1: 2,\n 2: 5,\n 3: 5,\n 4: 4,\n 5: 5,\n 6: 6,\n 7: 3,\n 8: 7,\n 9: 6\n}\n\n\ncount_list = [num_dict[a] for a in A]\n\n\nmin_matches = min(count_list)\n\n\nmin_num_list = []\n[min_num_list.append(a)...
['Runtime Error', 'Accepted']
['s585037341', 's784335230']
[7872.0, 4720.0]
[2104.0, 56.0]
[1331, 667]
p03128
u263830634
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
["import sys\nsys.setrecursionlimit(4 * (10 ** 9))\nlst = [[1,2], [2, 5], [3, 5], [4, 4], [5, 5], [6, 6], [7, 3], [8, 7], [9, 6]]\nN, M = map(int, input().split())\nA = list(map(int, input().split()))\nA.sort(reverse = True)\n# print (A)\n\ndef num(k):\n return lst[k-1][1]\n\n\n # print (num(i), end = ', ')\n# pr...
['Runtime Error', 'Runtime Error', 'Accepted']
['s338005330', 's419349836', 's206959770']
[3064.0, 3064.0, 5364.0]
[18.0, 18.0, 114.0]
[1074, 1069, 1112]
p03128
u272557899
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
['n, m = map(int, input().split())\na = [int(m) for m in input().split()]\na.sort(reverse=True)\ndp = []\nfor i in range(10 * n):\n dp.append(0)\n\nb = [0,2,5,5,4,5,6,3,7,6]\nfor i in range(1, n + 1):\n for j in range(len(a)):\n if i - b[a[j]] >= 0:\n dp[i] = max(dp[i], dp[i - b[a[j]]] + a[j])\n...
['Wrong Answer', 'Accepted']
['s813689131', 's180283128']
[15276.0, 15272.0]
[135.0, 176.0]
[385, 473]
p03128
u280512618
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
["import sys\n\nmp = [6, 2, 5, 5, 4, 5, 6, 3, 7, 6]\n\nif __name__ == '__main__':\n n, m = map(int, input().split())\n a = sorted(input().split(), reverse=True)\n\n dp = [-10007] * (n + 1)\n dp[0] = 0\n for i in a:\n step = mp[int(i)]\n for j in range(step, n + 1):\n dp[j] = max(...
['Wrong Answer', 'Accepted']
['s055667752', 's735306485']
[3956.0, 3828.0]
[81.0, 87.0]
[574, 560]
p03128
u284854859
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
['def f(x):\n if x == 1:\n return 2\n if x == 2:\n return 5\n if x == 3:\n return 5\n if x == 4:\n return 4\n if x == 5:\n return 5\n if x == 6:\n return 6\n if x == 7:\n return 3\n if x == 8:\n return 7\n if x == 9:\n return 6\nn...
['Runtime Error', 'Accepted']
['s294040482', 's767148732']
[4340.0, 4788.0]
[23.0, 126.0]
[1135, 1301]
p03128
u307842323
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
['import sys\nsys.setrecursionlimit(1000000)\n\nN,M = map(int,input().split())\nma = list(map(int,input().split()))\nn = len(a)\nma_map = [ -1, 2, 5, 5, 4, 5, 6, 3, 7, 6 ]\nmemo = [-1] * 100000\n\ndef dp(num):\n\tif memo[num] != -1: return memo[num]\n\tif num == 0: return 0\n\n\tret = -1\n\tfor p in ma:\n\t\tif 0 <= nu...
['Runtime Error', 'Accepted']
['s289180450', 's455292054']
[3064.0, 17116.0]
[18.0, 153.0]
[414, 427]
p03128
u316386814
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
["n, m = list(map(int, input().split()))\nli = list(map(int, input().split()))\ndi = {}\nfor i, d in enumerate([2,5,5,4,5,6,3,7,6], 1):\n di[i] = d\nli.sort(reverse=True)\nhons = set(di[a] for a in li)\ndd = {}\nfor a in li:\n hon = di[a]\n if hon not in dd:\n dd[hon] = a\n\nh2d = [0]\npre = [None]\nfor...
['Wrong Answer', 'Accepted']
['s355263010', 's774700556']
[5144.0, 4724.0]
[63.0, 60.0]
[695, 635]
p03128
u333190709
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
['import numpy as np\n\nN, M = [int(n) for n in input().split()]\nA = sorted([int(n) for n in input().split()])\nB = [2, 5, 5, 4, 5, 6, 3, 7, 6]\nC = [B[a - 1] for a in A]\n\nketa = N // min(C)\n\na = ""\n\nfor i in range(keta):\n res = N - min(C) * (keta - i)\n if res == 0:\n b = A[C.index(min(C))]\n ...
['Wrong Answer', 'Accepted']
['s794887355', 's345250962']
[12416.0, 16692.0]
[160.0, 226.0]
[544, 1078]
p03128
u334712262
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
['# -*- coding: utf-8 -*-\nimport bisect\nimport heapq\nimport math\nimport random\nimport sys\nimport copy\nfrom collections import Counter, defaultdict, deque\nfrom decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal\nfrom functools import lru_cache, reduce\nfrom itertools import combinations, combinations_with_repl...
['Wrong Answer', 'Accepted']
['s459746899', 's341884826']
[9816.0, 17084.0]
[867.0, 157.0]
[2215, 1872]
p03128
u338225045
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
['N, M = map( int, input().split() )\nA = list( map( int, input().split() ) )\n\n\n\ndp = [-float(\'inf\')] * (N+1) \ncost = [ 0, 2, 5, 5, 4, 5, 6, 3, 7, 6 ] \n\ndp[0] = 0\nfor num_match in range( 2, N+1 ):\n for Aj in A:\n if num_match >= cost[Aj]:\n dp[num_match] = max( dp[num_match]...
['Runtime Error', 'Time Limit Exceeded', 'Accepted']
['s446336652', 's725406557', 's618285917']
[3568.0, 3380.0, 3440.0]
[84.0, 2104.0, 90.0]
[783, 813, 778]
p03128
u346851130
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
["#!/usr/bin/env python\n# -*- coding: utf-8 -*-\nimport itertools\n\nCOSTS = (99, 2, 5, 5, 4, 5, 6, 3, 7, 6)\n\n\ndef main():\n remain, _ = list(map(int, input().split()))\n\n costs = list(map(int, input().split()))\n costs = [(c, COSTS[c]) for c in costs]\n costs.sort(key=lambda x:x[1])\n\n num, cost = costs[0]\...
['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted']
['s016585815', 's092203647', 's171995760', 's185060034', 's300699616', 's468867807', 's599847626', 's637395430', 's817915484', 's891611101', 's925774693', 's954544783', 's984530156', 's818263631']
[3316.0, 3444.0, 3444.0, 3316.0, 3316.0, 3444.0, 3316.0, 3444.0, 3348.0, 3444.0, 3316.0, 3444.0, 3340.0, 3444.0]
[19.0, 22.0, 19.0, 19.0, 20.0, 19.0, 19.0, 2104.0, 20.0, 20.0, 20.0, 19.0, 19.0, 20.0]
[1436, 851, 1701, 909, 1461, 1556, 903, 803, 1725, 867, 906, 1657, 899, 1733]
p03128
u350049649
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
["match_num=[0,2,5,5,4,5,6,3,7,6]\nN,M=map(int, input().split())\nnums=sorted(list(map(int, input().split())),reverse=True)\nINF=1000000\n\ndp = [-INF for _ in range(N+1)]\ndp[0]=0\nusables=[]\nfor n in nums:\n usables.append(match_num[n])\n\nfor i in range(min(usables), N+1):\n tmp=[]\n for u in usables:\n if(i-...
['Runtime Error', 'Accepted']
['s184988644', 's921870432']
[3572.0, 14672.0]
[61.0, 158.0]
[597, 247]
p03128
u352558780
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
['pair = [[1, 2], [2, 5], [3, 5], [4, 4], [5, 5], [6, 6], [7, 3], [8, 7], [9, 6]]\nn, m = [int(x) for x in input().split()]\ngiven = sorted([int(i) for i in input().split()])\ngiven_pair = sorted([pair[x - 1] for x in given], reverse=True)\n\ndp = (1 + n) * [0]\nmax_dp = 0\nfor i in range(n + 1):\n if i == 0:\n ...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s063008825', 's091188668', 's095517376', 's110391019', 's142619817', 's527509468', 's538827541', 's124935542']
[4308.0, 8948.0, 4476.0, 8016.0, 3064.0, 3432.0, 4500.0, 3392.0]
[118.0, 2108.0, 118.0, 2104.0, 17.0, 97.0, 123.0, 104.0]
[1151, 817, 1180, 819, 322, 643, 1155, 634]
p03128
u360116509
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
['costs = [2, 5, 5, 4, 5, 6, 3, 7, 6]\n\n\ndef main():\n N, M = map(int, input().split())\n A = list(map(int, input().split()))\n dp = [-1 for _ in range(N + 1)]\n dp[0] = 0\n for i in range(1, N + 1):\n for a in A:\n if i < costs[a - 1]:\n continue\n dp[i] = m...
['Wrong Answer', 'Accepted']
['s802781416', 's441986047']
[87840.0, 14388.0]
[1503.0, 130.0]
[370, 373]
p03128
u368780724
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
["def inpl(): return list(map(int, input().split()))\n\nN, M = inpl()\nA = inpl()\nA.sort(reverse = True)\n\ninf = float('inf')\nmatch = (inf, 2, 5, 5, 4, 5, 6, 3, 7, 6)\nmatnum = set([match[a] for a in A])\ndp = [0]+[-inf]*N\n\nfor i in range(1, N+1):\n dp[i] = max([10*dp[i-a] + a for a in A])\n\nprint(''.join(sort...
['Runtime Error', 'Wrong Answer', 'Accepted']
['s060357796', 's875383142', 's523600556']
[26356.0, 3700.0, 14964.0]
[190.0, 61.0, 139.0]
[338, 304, 305]
p03128
u368796742
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
['n,m = map(int,input().split())\na = list(map(int,input().split()))\na.sort(reverse = True)\nl = [0,2,5,5,4,5,6,3,7,6]\nINF = 10**18\ndp = [[[-INF]*2 for i in range(n+1)] for j in range(m+1)]\ndp[0][0] = [0,0]\nfor i in range(m):\n for j in range(n+1):\n x = l[a[i]]\n dp[i+1][j] = dp[i][j]\n if...
['Wrong Answer', 'Accepted']
['s461425131', 's719341335']
[16756.0, 4324.0]
[217.0, 68.0]
[912, 466]
p03128
u375616706
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
['# python template for atcoder1\nimport sys\nsys.setrecursionlimit(10**9)\ninput = sys.stdin.readline\nN, M = map(int, input().split())\nA = list(map(int, input().split()))\nA = sorted(A, reverse=True)\n\nnums = {}\nnums[1] = 2\nnums[2] = 5\nnums[3] = 5\nnums[4] = 4\nnums[5] = 5\nnums[6] = 6\nnums[7] = 3\nnums[8] = 7\...
['Runtime Error', 'Runtime Error', 'Accepted']
['s757171687', 's862478309', 's832680040']
[3396.0, 3396.0, 3424.0]
[2104.0, 2104.0, 88.0]
[689, 683, 645]
p03128
u391731808
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
['N,M = map(int,input().split())\n*A, = map(int,input().split())\nB = sorted((([2,5,5,4,5,6,3,7,6][a-1],a) for a in A),key = lambda x:(x[0],-x[1]))\ni = 1\nwhile i<len(B):\n if B[i][0]==B[i-1][0]:\n B.pop(i)\n else:\n i+=1\ni = [0]*(len(B)-1)\nans_tmp = (0,[])\nwhile i[-1]<B[0][0]:\n tmp = N - su...
['Runtime Error', 'Runtime Error', 'Accepted']
['s900447096', 's955975297', 's495858597']
[3192.0, 3312.0, 3188.0]
[18.0, 37.0, 21.0]
[709, 614, 716]
p03128
u392319141
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
["from bisect import bisect_left\nN, M = map(int, input().split())\nnums = list(map(int, input().split()))\nnums.sort(reverse=True)\n\nmatchNum = {\n 1 : 2,\n 2 : 5,\n 3 : 5,\n 4 : 4,\n 5 : 5,\n 6 : 6,\n 7 : 3,\n 8 : 7,\n 9 : 6,\n}\n\nmakeDigit = [0] * (N + 1)\nfor n in range(1, N + 1):\n ...
['Runtime Error', 'Runtime Error', 'Accepted']
['s618637638', 's849594095', 's132237370']
[3696.0, 8436.0, 3680.0]
[72.0, 2104.0, 75.0]
[731, 797, 566]
p03128
u393512980
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
["import sys\nsys.setrecursionlimit(100001)\ndef input():\n return sys.stdin.readline()[:-1]\nimport copy\n\nN, M = map(int, input().split())\nA = sorted(list(map(int, input().split())), reverse = True)\nx = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6]\ndp = [0 for i in range(N+1)]\ncnt = [[0] * 10 for i in range(N+1)]\nfor i in ...
['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s533356977', 's908458926', 's963363804', 's895593689']
[6308.0, 7496.0, 3424.0, 3336.0]
[92.0, 103.0, 2104.0, 82.0]
[565, 576, 533, 512]
p03128
u413165887
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
["n , m = map(int, input().split(' '))\ns = [0,2,5,5,4,5,6,3,7,6]\na = list(map(int, input().split(' ')))\na.sort()\nd = [0]\nfor i in range(n):\n d.append(-1)\n\nfor i in range(n+1):\n j = 0\n while j < len(a):\n if d[i-s[a[j]]] >= 0:\n d[i] = d[i-s[a[j]]] +1\n break\n else...
['Runtime Error', 'Wrong Answer', 'Accepted']
['s516483893', 's882132038', 's704529108']
[3700.0, 3700.0, 4084.0]
[28.0, 29.0, 38.0]
[603, 702, 915]
p03128
u426108351
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
['N, M = map(int, input().split())\nA = list(map(int, input().split()))\nmatchlist = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6]\nnumberlist = []\nfor i in range(M):\n numberlist.append([matchlist[A[i]], A[i]])\nnumberlist.sort(key = lambda x: (x[0], -x[1]))\n\nans = []\nwhile N > 0:\n print(N)\n ans.append(numberlist[0])\...
['Runtime Error', 'Accepted']
['s561757897', 's563337229']
[3700.0, 3696.0]
[23.0, 73.0]
[501, 657]
p03128
u440161695
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
['解説放送の1つめ\nN,M = map(int, input().split())\nA = list(map(int, input().split()))\nf = [-1, 2,5,5,4,5,6,3,7,6] # 1-indexed\n \n\ndp = [None]*(N+1)\ndp[0] = ""\n \n\ndef max_str(s1:str, s2:str)->str:\n """return bigger one"""\n l1, l2 = len(s1), len(s2)\n if l1 != l2:\n return s1 if l1>l2 else s2\n if ...
['Runtime Error', 'Accepted']
['s078445653', 's806372580']
[3064.0, 3356.0]
[17.0, 83.0]
[771, 726]
p03128
u451017206
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
["N, M = map(int, input().split())\nA = [i for i in input().split()]\n\n\n\ndef mx(a, b):\n if len(a) != len(b):\n if len(a) > len(b):\n return a\n else:\n return b\n return max(a, b)\n\n\nh = {'1':2, '2':5, '3':5, '4':4, '5':5, '6':6, '7':3, '8':7, '9':6}\n\n\ndp = [''] * (N +...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s068170755', 's265593534', 's712680191', 's815345886', 's555594210']
[28120.0, 3064.0, 29680.0, 29680.0, 3388.0]
[117.0, 95.0, 122.0, 134.0, 91.0]
[535, 589, 556, 630, 678]
p03128
u456353530
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
['\nimport copy\n\nN, M = list(map(int, input().split()))\nA = list(map(int, input().split()))\n\nt = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6]\nL = {}\nfor i in A:\n if t[i] in L:\n if L[t[i]] < i:\n L[t[i]] = i\n else:\n L[t[i]] = i', 'import copy\n\nN, M = list(map(int, input().split()))\nA = list(map(int, input()...
['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted']
['s016841917', 's480610684', 's594927570', 's765023346', 's871966773', 's474539931']
[3444.0, 5920.0, 5620.0, 5748.0, 5620.0, 5748.0]
[22.0, 715.0, 33.0, 720.0, 35.0, 724.0]
[243, 759, 292, 713, 337, 826]
p03128
u464397170
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
['import sys\nsys.setrecursionlimit(100000)\n\nN, M = map(int, input().split())\nnumbers = list(map(int, input().split()))\ncosts = [2,5,5,4,5,6,3,7,6] # <- 1,2,3,4,5,6,7,8,9\ncostmap = {}\nfor num in numbers:\n cost = costs[num-1]\n if cost in costmap and num < costmap[cost]:\n continue\n costmap[cost] = num\n\n...
['Wrong Answer', 'Accepted']
['s788794265', 's994154716']
[25060.0, 25060.0]
[157.0, 163.0]
[619, 671]
p03128
u466331465
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
['import fractions\nN = int(input())\nA = [int(x) for x in input().split()]\na = A[0]\nfor i in range(1,N):\n a =fractions.gcd(a,A[i])\nprint(a)', 'N,M= map(int,input().split())\n\nA = list(map(int,input().split()))\nsorted(A)\nB =[0,2,5,5,4,5,6,3,7,6]\nC =[]\nfor i in A:\n C.append(B[i])\ndp = [-1]*(N+1)\ndp[0] =...
['Runtime Error', 'Accepted']
['s446730578', 's240224623']
[5048.0, 14692.0]
[36.0, 184.0]
[137, 317]
p03128
u475329018
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
['n, m = map(int, input().split())\na = list(map(int, input().split()))\n\nmaxnum = [-1] * (n+1)\ncost = [0,2,5,5,4,5,6,3,7,6]\nmaxnum[0] = 0\nfor i in range(n+1):\n for num in a:\n if ( i+cost[num] < n+1 ):\n maxnum[i+cost[num]] = max(maxnum[i+cost[num]], num + maxnum[i]*10)\n\nprint(maxnum)', 'n,...
['Wrong Answer', 'Accepted']
['s604641553', 's358620215']
[88084.0, 14692.0]
[1530.0, 173.0]
[301, 304]
p03128
u475442247
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
["import numpy as np\n\n\nnmatch = np.array([0,2,5,5,4,5,6,3,7,6])\nN,M = map(int,input().split())\ndp = [-1]*(N+1) # contains the number of digits it can make\ndp[0] = 0\nff = np.array(list(map(int,input().split()))).reshape(-1,1)\nfg = nmatch[ff].reshape(-1,1)\nAtemp = np.concatenate([ff,fg],axis=1)\nprint(Atemp)\nin...
['Runtime Error', 'Accepted']
['s678286609', 's434027615']
[14412.0, 22016.0]
[597.0, 1762.0]
[1271, 1223]
p03128
u475503988
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
['N, M = map(int, input().split())\nA = list(map(int, input().split()))\n\nnumbers = [None, 2, 5, 5, 4, 5, 6, 3, 7, 6]\ndp = [0] * (N+1)\ndp[0] = 0\nfor i in range(N+1):\n for a in A:\n j = i + numbers[a]\n if j <= N:\n dp[j] = max(dp[j], dp[i]*10 + a)\nprint(dp[N])', 'N, M = map(int, input(...
['Wrong Answer', 'Accepted']
['s929903354', 's875126645']
[14692.0, 14692.0]
[161.0, 157.0]
[281, 282]
p03128
u476604182
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
['N, M = map(int, input().split())\na = [int(i) for i in input().split()]\n\ndic = {}\ndic[1] = 2\ndic[2] = 5\ndic[3] = 5\ndic[4] = 4\ndic[5] = 5\ndic[6] = 6\ndic[7] = 3\ndic[8] = 7\ndic[9] = 6\n\nls = [-1]*8\ndp = [-1]*(N+1)\ndp[0] = 0\nfor i in a:\n j = dic[i]\n if ls[j]<i:\n ls[j] = i\n\ntag = []\nfor i in rang...
['Runtime Error', 'Wrong Answer', 'Accepted']
['s048395808', 's108390112', 's179999492']
[3064.0, 3064.0, 14820.0]
[48.0, 57.0, 124.0]
[427, 444, 471]
p03128
u488401358
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
["N,M=map(int,input().split())\nA=list(map(int,input().split()))\nA.sort()\nB=[[] for i in range(0,10)]\nfor i in range(0,M):\n if 1 in A:\n B[2].append(1)\n if 2 in A:\n B[5].append(2)\n if 3 in A:\n B[5].append(3)\n if 4 in A:\n B[4].append(4)\n if 5 in A:\n B[5].appe...
['Wrong Answer', 'Accepted']
['s771943395', 's396460660']
[3360.0, 16052.0]
[18.0, 921.0]
[2090, 3371]
p03128
u497046426
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
["numbers = {'1': 2, '2': 5, '3': 5, '4': 4, '5': 5, '6': 6, '7': 3, '8': 7, '9': 6}\n\nN, M = map(int, input().split())\nA = list(input().split())\ncands = [(a, numbers[a]) for a in A]\n\ndp = {i: None for i in range(1, N+1)}\nfor c in cands:\n dp[c[1]] = int(c[0])\nfor i in range(2, N+1):\n for c in cands:\n ...
['Runtime Error', 'Accepted']
['s611952171', 's887443308']
[8188.0, 15332.0]
[2104.0, 163.0]
[785, 297]
p03128
u505830998
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
['import sys\nimport queue\n\n#+++++\n\ndef sa(v, p):\n\treturn v //p, v %p\n\ndef ggg(value, p_list, ctv):\n\tdd=p_list[:]\n\t#print(\'gfg\',dd)\n\tif len(dd)==0:\n\t\treturn None\n\ta=dd.pop(0)\n\tif a > value:\n\t\treturn None\n\t\n\tm,p=sa(value, a)\n\tif p == 0:\n\t\taa= [max(ctv[a])]*(m)\n\t\treturn aa\n\telse:\n...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s121419545', 's931342469', 's069028579']
[49800.0, 4336.0, 4336.0]
[2106.0, 35.0, 35.0]
[1897, 1896, 1896]
p03128
u506858457
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
['n,m=map(int,input().split())\nx=[2,5,5,4,5,6,3,7,6]\na=[]\nfor i in map(int,input().split()):\n a.append([i,x[i-1]])\n \na.sort(reverse=True)\n\n\n\ndp=[0]*(n+1)\n\n\nfor i in range(m):\n\n for j in range(n+1):\n if j==0 or dp[j]!=0:\n \n if j+a[i][1]<=n:\n print(dp[j+...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s039796944', 's569956258', 's907076681', 's749042981']
[74928.0, 75060.0, 75056.0, 16488.0]
[2105.0, 2105.0, 2105.0, 162.0]
[1363, 1216, 1481, 1131]
p03128
u511401499
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
['ma_map = [ -1, 2, 5, 5, 4, 5, 6, 3, 7, 6 ]\nN, M = (int(i) for i in input().split())\nma = list(int(i) for i in input().split())\nmemo = [-1] * 100000\n\ndef dfs(num):\n\tif memo[num] != -1: return memo[num]\n\tif num == 0: return 0\n\n\tret = -1\n\tfor p in ma:\n\t\tif 0 <= num - ma_map[p]:\n\t\t\td = dfs(num - ma_m...
['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s103408646', 's103882006', 's134941119', 's155111114', 's238522139', 's832294560', 's919807448']
[5236.0, 5236.0, 17116.0, 3828.0, 17116.0, 3064.0, 17116.0]
[82.0, 77.0, 178.0, 19.0, 171.0, 18.0, 152.0]
[448, 396, 504, 506, 491, 432, 427]
p03128
u512007680
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
['def num(k):\n if k == 1:\n return 1\n elif k == 7:\n return 3\n elif k == 4:\n return 4\n elif k == 2 or k == 3 or k == 5:\n return 5\n elif k == 6 or k == 9:\n return 6\n elif k == 8:\n return 7\n\nn, m = map(int,input().split())\nl = list(map(int,input().s...
['Wrong Answer', 'Accepted']
['s054418140', 's898323225']
[4028.0, 3444.0]
[843.0, 224.0]
[1184, 1231]
p03128
u532966492
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
['N,M=map(int,input().split())\nA=list((map(int,input().split())))\n \nm=[[1,2],[2,5],[3,5],[4,4],[5,5],[6,6],[7,3],[8,7],[9,6]]\nB=[]\n \nfor a in A:\n B.append(m[a-1])\n\nif [5,5] in B:\n if [2,5] in B:\n B.remove([2,5])\n if [3,5] in B: \n B.remove([3,5])\n\nif [3,5] in B and [2,5] in B:...
['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted']
['s236151593', 's512429186', 's679733185', 's920878504', 's687222556']
[28912.0, 7900.0, 3064.0, 2940.0, 5252.0]
[2104.0, 2104.0, 18.0, 17.0, 394.0]
[1442, 429, 431, 1698, 955]
p03128
u543954314
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
['n,m = map(int,input().split())\ndp = [-10**5]*(n+1)\ndp[0] = 0\nt = [0,2,5,5,4,5,6,3,7,6]\na = set(map(int,input().split()))\nfor i in range(2,n+1):\n for x in a:\n if i-t[x] >= 0 and dp[i] < dp[i-t[x]] + 1:\n dp[i] = dp[i-t[x]] + 1\na = list(a)\na.sort(reverse=True)\ncur = ""\nidx = n\nwhile idx:\n for x i...
['Wrong Answer', 'Accepted']
['s987383391', 's469875542']
[3380.0, 3380.0]
[68.0, 68.0]
[428, 425]
p03128
u550943777
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
["INF = 10**10\narr = [INF,2,5,5,4,5,6,3,7,6]\nN,M = map(int,input().split())\nsrc = sorted(list(map(int,input().split())))\n\ndp = [-INF]*(N+1)\ndp[0] = 0\nfor i in range(N):\n for j in src:\n if i + arr[j] <= N:\n dp[i + arr[j]] = max(dp[i + arr[j]], dp[i] + 1)\nans = ''\nwhile(N>0):\n for i i...
['Time Limit Exceeded', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s004143335', 's155273223', 's210589822', 's441546976', 's489136105', 's793533108', 's920770855', 's566654482']
[3424.0, 3312.0, 3308.0, 3312.0, 3312.0, 3312.0, 3312.0, 3312.0]
[2104.0, 80.0, 80.0, 99.0, 75.0, 98.0, 75.0, 93.0]
[467, 473, 521, 469, 483, 490, 483, 468]
p03128
u556225812
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
['N, M = map(int, input().split())\nA = list(map(int, input().split()))\n\ndp = [-1] * (N+1)\nneed = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6]\ndp[0] = 0\n\nfor i in range(N+1):\n for j in A:\n if i + need[j] > N:\n continue\n dp[i+need[j]] = max(dp[i+need[j]], dp[i]*10+j])\nprint(dp[N])', 'N, M = map(...
['Runtime Error', 'Accepted']
['s098208871', 's897553039']
[2940.0, 14692.0]
[17.0, 165.0]
[291, 290]
p03128
u561339958
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
['N, M = map(int, input().split())\nA = [int(a) for a in input().split()]\nL = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6]\nA.sort(reverse = True)\nprint(A)\ndp = [0] + ([-1]*N)\nprint(dp)\nfor i in range(1, N+1):\n for a in A:\n if L[a] <= i:\n dp[i] = max(dp[i], dp[i-L[a]] * 10 + a)\nprint(dp)\nprint(dp[-1])'...
['Wrong Answer', 'Accepted']
['s976299158', 's360906923']
[88160.0, 14692.0]
[1518.0, 148.0]
[305, 309]
p03128
u565035185
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
['#encoding: utf-8\n\nN, M = map(int, input().split())\nA = list(map(int, input().split()))\nmatch = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6]\n\nA.sort()\nA.reverse()\n\ndp = [-1] * (N + 1)\ndp[0] = 0\n\nfor i in range(N + 1):\n for a in A:\n if i - match[a] >= 0:\n dp[i] = max(dp[i - match[a]] * 10 + a, dp[...
['Runtime Error', 'Accepted']
['s305875117', 's950546719']
[135184.0, 14692.0]
[1550.0, 151.0]
[335, 321]
p03128
u580093517
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
['N,M = map(int,input().split())\nA = list(map(int,input().split()))\nweight = [2,5,5,4,5,6,3,7,6]\ndp=[-1]*(N+1)\ndp[0] = 0\nfor i in range(N+1):\n if dp[i] == -1:continue\n for a in A:\n if i+weight[a]<N+1:\n dp[i+weight[a]] = max(dp[i+weight[a]],dp[i]*10+a)\nprint(dp[-1])', '\nN,M=map(int,inp...
['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s574240213', 's873254294', 's969336050', 's781452865']
[7900.0, 6116.0, 3064.0, 14692.0]
[68.0, 75.0, 17.0, 182.0]
[287, 932, 1175, 289]
p03128
u580327099
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
["#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\nimport sys\n\ninput = sys.stdin.readline\n\nMATCH_NUM = [-1, 2, 5, 5, 4, 5, 6, 3, 7, 6]\n\ndef main():\n N, M = map(int, input().split())\n A = list(map(int, input().split()))\n A.sort(reverse=True)\n\n \n dp = [-1 for _ in range(N+1)]\n dp[0] = 0\n...
['Wrong Answer', 'Accepted']
['s324591993', 's150691728']
[3312.0, 3380.0]
[65.0, 59.0]
[838, 799]
p03128
u600402037
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
['N, M = map(int, input().split())\nA = set(map(int, input().split()))\n\ndp = [-1] * (N+1)\nweights = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6]\n\ndp[0] = 0\n\nfor i in range(N+1):\n for a in A:\n if i + weights[a] > N:\n continue\n dp[i + weights[a]] = max(dp[i + weights[a]], dp[i] * 10 + weights[a])...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s835458324', 's903138063', 's697275329']
[14700.0, 199412.0, 14692.0]
[175.0, 736.0, 172.0]
[373, 1023, 363]
p03128
u631277801
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
['import sys\nstdin = sys.stdin\n\nsys.setrecursionlimit(10 ** 7)\n\ndef li(): return map(int, stdin.readline().split())\ndef li_(): return map(lambda x: int(x) - 1, stdin.readline().split())\ndef lf(): return map(float, stdin.readline().split())\ndef ls(): return stdin.readline().split()\ndef ns(): return stdin.readli...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s116600748', 's164673513', 's258965654', 's549462875', 's653824573']
[28008.0, 4596.0, 30196.0, 3064.0, 4596.0]
[2105.0, 43.0, 2104.0, 17.0, 122.0]
[1275, 1895, 1245, 1006, 1849]
p03128
u652057333
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
["# D\nn, m = map(int, input().split())\na = list(map(int, input().split()))\nmatch_list = [[1,2],[2,5],[3,5],[4,4],[5,5],[6,6],[7,3],[8,7],[9,6]]\n\nuse_list = []\n\n# if i[0] in a:\n# use_list.append(i)\nuse_list = match_list\nuse_list.sort(key=lambda x:x[1])\nprint(use_list)\nans_list = []\nnum = n // us...
['Runtime Error', 'Runtime Error', 'Accepted']
['s791633739', 's799606260', 's738835357']
[3064.0, 3064.0, 14516.0]
[18.0, 17.0, 162.0]
[660, 660, 287]
p03128
u667084803
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
["N, M = map(int, input().split())\nA = list(map(int, input().split()))\nhonsuu = [0,2,5,5,4,5,6,3,7,6]\naval = []\nfor a in A:\n aval += [honsuu[a]]\naval.sort()\n\ndp = [0] \n\nfor i in range(1,N+1):\n for b in aval:\n if i < b:\n continue\n else:\n dp += [dp[i-b] + 1]\n break\n else:\n dp ...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s184868623', 's500399730', 's010798688']
[3700.0, 3692.0, 3700.0]
[39.0, 41.0, 41.0]
[810, 812, 728]
p03128
u684120680
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
["import math\n\nn,m = [int(i) for i in input().split()]\na = [int(i) for i in input().split()]\n\nset = [[1,2],[7,3],[4,4],[5,5],[3,5],[2,5],[9,6],[6,6],[8,7]]\n\nif 3 in a:\n if 5 in a:\n a.remove(3)\n m -= 1\n a.remove(2)\n m -= 1\n\nif 9 in a:\n a.remove(6)\n m -= 1\n \nexist = [i for i in set if i[0] i...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s561974241', 's602130711', 's855480214', 's077788232']
[3308.0, 3280.0, 3192.0, 3316.0]
[2104.0, 21.0, 2104.0, 22.0]
[1764, 3027, 1733, 4017]
p03128
u686036872
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
['N, M = map(int, input().split())\n\nA = list(map(int, input().split()))\nB = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6]\n\nDP = [-1]*(N+1)\nDP[0] = 0 \n\nfor i in range(N):\n for j in A:\n if i+B[j] <= N:\n DP[i+B[j]] = max(DP[i]*10+j, DP[i+B[j]])\n\nprint(DP[N+1]) ', 'N, M = map(int, input().split())\n\nA =...
['Runtime Error', 'Runtime Error', 'Accepted']
['s032675649', 's468781152', 's844162698']
[14692.0, 14684.0, 14692.0]
[177.0, 165.0, 177.0]
[262, 261, 260]
p03128
u687053495
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
['\nfrom heapq import heappop, heappush\nN, M = map(int, input().split())\nA = list(map(int, input().split()))\n\nqueue = []\n\nfor a in A:\n if a == 1:\n heappush(queue, (2, 1))\n elif a == 2:\n heappush(queue, (5, 2))\n elif a == 3:\n heappush(queue, (5, 3))\n elif a == 4:\n heappush(queue, (4, 4))\n ...
['Runtime Error', 'Runtime Error', 'Accepted']
['s412485094', 's615903934', 's826589306']
[4084.0, 135472.0, 30196.0]
[24.0, 2011.0, 161.0]
[746, 294, 445]
p03128
u690536347
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
['N, M = map(int, input().split())\n*A, = map(int, input().split())\n\ndp = [""] * (N+1)\nd = {\n 1: 2,\n 2: 5,\n 3: 5,\n 4: 4,\n 5: 5,\n 6: 6,\n 7: 3,\n 8: 7,\n 9: 6\n}\n\nc = [(i, d[i]) for i in A]\nc.sort(key=lambda x:(-x[1], -x[0]))\ndp[0] = ""\ndp[1] = ""\n\nfor i in range(2, N+1):\n ...
['Wrong Answer', 'Accepted']
['s376641137', 's979620808']
[23024.0, 4316.0]
[2105.0, 86.0]
[543, 386]
p03128
u692453235
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
['from collections import defaultdict\nfrom itertools import product, permutations, combinations, combinations_with_replacement\n\nN, M = map(int, input().split())\nA = list(map(int, input().split()))\nL = {1: 2, 2: 5, 3: 5, 4: 4, 5: 5, 6: 6, 7: 3, 8: 7, 9: 6}\nD = defaultdict(int)\n\nfor i in A:\n if D[L[i]] < i:\n ...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s572956339', 's761110129', 's274662133']
[9468.0, 9524.0, 9560.0]
[31.0, 35.0, 51.0]
[858, 883, 646]
p03128
u695811449
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
['import sys\nsys.setrecursionlimit(10**9)\n\nN,M=map(int,input().split())\nA=list(map(int,input().split()))\nM=[0,2,5,5,4,5,6,3,7,6]\n\ndef match(i):\n ANS=0\n for s in str(i):\n ANS+=M[int(s)]\n\n return ANS\n \nANSLIST=set()\ndef dfs(i,NOW):\n if NOW==N:\n L=sorted(list(i),reverse=Tr...
['Wrong Answer', 'Accepted']
['s562300928', 's238499191']
[20456.0, 20168.0]
[2105.0, 62.0]
[654, 2153]
p03128
u721316601
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
["def search(N, idx):\n global a, M, count\n\n if N == 0:\n return True\n elif N < 0:\n return False\n elif idx == M:\n return False\n\n loop = N // a[idx][0]\n for i in range(loop, -1, -1):\n flag = search(N-a[idx][0]*i, idx+1)\n if flag:\n if i:\n ...
['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s226553839', 's495961512', 's765705192', 's823109765', 's904545502', 's466490481']
[3064.0, 4276.0, 3192.0, 4196.0, 3064.0, 14388.0]
[18.0, 69.0, 19.0, 66.0, 18.0, 163.0]
[704, 525, 852, 530, 857, 315]
p03128
u726615467
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
['N, M = map(int, input().split())\nA = list(map(int, input().split()))\n\ntab = [6, 2, 5, 5, 4, 5, 6, 3, 7, 6]\nA_cmp = {}\nfor Ai in sorted(A):\n A_cmp[tab[Ai]] = Ai\nA = list(A_cmp.values())\nA = A[::-1]\n# print("#", A)\n\nmemo = [None] * (N + 1)\nmemo[0] = 0\n\nimport sys\nsys.setrecursionlimit(100000)\n\ndef d...
['Runtime Error', 'Accepted']
['s583171657', 's410398153']
[4980.0, 4980.0]
[46.0, 68.0]
[791, 756]
p03128
u729133443
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
["n,m,*a=map(int,open(0).read().split())\nd=[0]*n*9\nfor i in range(n):d[i+1]=max(j+d[i-int('0144345265'[j])]*10for j in a)\nprint(d[n])", 'n,m,*a=map(int,open(0).read().split())\nd=[0]*n*9\nfor i in range(n):\n for j in a:c=i+(0,2,5,5,4,5,6,3,7,6)[j];d[c]=max(d[c],(d[i]*10+j)*(d[i]or i<1))\nprint(d[n])', "n,m,*a=map(i...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s101914378', 's760930438', 's710744146']
[15028.0, 10640.0, 15092.0]
[135.0, 2112.0, 137.0]
[131, 160, 136]
p03128
u733814820
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
['# ABC 118 D\n\ndef resolve():\n N, M = map(int, input().split())\n A = list(map(int, input().split()))\n A.sort(reverse=True)\n\n costs = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6]\n\n dp = [0] * (N+1)\n for i in range(1, N+1):\n for a in A:\n if i - costs[a] < 0:\n continue\n ...
['Time Limit Exceeded', 'Accepted']
['s074174035', 's516473124']
[3388.0, 3388.0]
[2104.0, 67.0]
[750, 853]
p03128
u761320129
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
["from collections import defaultdict\nfrom copy import copy\n\nN,M = map(int,input().split())\nA = list(map(int,input().split()))\n\nms = [2,5,5,4,5,6,3,7,6]\ndic = defaultdict(lambda: 0)\nfor a in A:\n dic[ms[a-1]] = max(dic[ms[a-1]], a)\n\nsd = sorted(dic.items())\n\ndp = [None] * (N+1)\ndp[0] = defaultdict(lambd...
['Runtime Error', 'Accepted']
['s441373735', 's103015832']
[3572.0, 7068.0]
[38.0, 1120.0]
[920, 1066]
p03128
u774539708
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
['n,m=map(int,input().split())\nA=reversed(sorted(map(int,input().split())))\nM=[2,5,5,4,5,6,3,7,6]\nD={}\nE={}\nfor a in A:\n if M[a-1] in D:\n continue\n else:\n D[M[a-1]]=a\n E[a]=M[a-1]\nS=list(reversed(sorted(E)))\n \ndp=[0]*(n+2)\nfor i in range(1,n+2):\n cnt=-1\n for d in ...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s153423998', 's699730819', 's453758133']
[3560.0, 3412.0, 3412.0]
[72.0, 68.0, 65.0]
[589, 626, 617]
p03128
u782685137
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
['cost=[0,2,5,5,4,5,6,3,7,6]\nN,M=map(int,input().split())\nA=sorted(map(int,input().split()))\nlowcost_i=A[0];lowcost=cost[A[0]]\nfor a in A:\n if cost[a]<lowcost:lowcost_i=a;lowcost=cost[a]\ns=str(lowcost_i)*(N//lowcost)\nl=N%lowcost\nbefore_l=l\ndisit=0\n\nwhile l>0:\n lll = {a:cost[a] for a in A if cost[a]<=l...
['Wrong Answer', 'Accepted']
['s565584040', 's344001810']
[3664.0, 3408.0]
[2104.0, 70.0]
[775, 302]
p03128
u785578220
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
['from operator import itemgetter\ntik = [[1,2],[7,3],[4,4],[5,5],[3,5],[2,5],[9,6],[8,7],[6,6]]\ndic = {"1":2,"7":3,"4":4,"5":5,"3":5,"2":5,"9":6,"8":7,"6":6}\n\nn,k = map(int, input().split())\nx = list(map(int, input().split()))\ndp = [0]+[-1]*(n+10)\nq = []\nfor i in range(k):\n q.append([x[i],dic[str(x[i])]])\n...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s544931583', 's801052017', 's803884567']
[12008.0, 3804.0, 14708.0]
[215.0, 191.0, 229.0]
[889, 889, 856]
p03128
u794543767
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
['\ndef get_input():\n N,K = [int(_) for _ in input().split()]\n S = [int(_) for _ in list(input())]\n return N,K,S\n\ndef solve(N,K,S):\n length = len(S)\n array = count_array(S)\n start_char = S[0]\n ans = find_max(array,K,start_char)\n return ans\n\ndef find_max(array,K,start_char):\n if ...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s159985338', 's388019042', 's454244189', 's883991562', 's901410151', 's803445543']
[3184.0, 3572.0, 5700.0, 3700.0, 3444.0, 3700.0]
[18.0, 56.0, 2104.0, 56.0, 54.0, 60.0]
[1436, 1057, 1114, 1124, 1004, 1113]
p03128
u798129018
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
['n,m = map(int,input().split())\nl = [2,5,5,4,5,6,3,7,6]\nA = list(map(int, input().split()))\nmina = [0,9]\nfor a in A:\n if l[a-1] < mina[1]:\n mina[0] = a\n mina[1] = l[a-1]\n elif l[a-1] == mina[1] and mina[0] < a:\n mina[0] = a\n else:\n continue\nketa = n // mina[1]\nk = keta...
['Wrong Answer', 'Accepted']
['s133109318', 's508065312']
[3316.0, 14388.0]
[29.0, 153.0]
[584, 247]
p03128
u814986259
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
['import bisect\nN, M = map(int, input().split())\nA = list(map(int, input().split()))\nnum = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6]\nnum = [(i, num[i]) for i in range(10) if i in A]\nnum.sort(key=lambda x: x[0], reverse=True)\nnum.sort(key=lambda x: x[1])\ndp = ["" for i in range(N+1)]\nans = 0\ntmp = set()\nfor x in num:\n ...
['Runtime Error', 'Accepted']
['s827760998', 's813420581']
[3188.0, 4692.0]
[18.0, 51.0]
[791, 704]
p03128
u820351940
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
['import sys\nsys.setrecursionlimit(1000000)\n\nn, m = map(int, input().split())\na = list(map(int, input().split()))\ncost = [None, 2, 5, 5, 4, 5, 6, 3, 7, 6]\n\ndp = [None] * (n + 1)\ndef dfs(at):\n if dp[at] is not None:\n return dp[at]\n r = max([0] + [dfs(at - cost[v]) * 10 + v for v in a if at - cost...
['Wrong Answer', 'Accepted']
['s741866502', 's762019856']
[22772.0, 21620.0]
[158.0, 142.0]
[362, 427]
p03128
u820839927
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
["import os, sys, re, math\n\nN,M = list(map(int,input().split(' ')))\nA = list(map(int,input().split(' ')))\nprint(A)\n\nmatch = [-1,2,5,5,4,5,6,3,7,6]\nmemo = {}\n\ndef doit(m):\n if m in memo:\n return memo[m]\n\n max_v = 0\n for a in A:\n if m - match[a] == 0:\n max_v = max(int(max...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s245545769', 's334402184', 's916595327', 's675707453']
[7960.0, 7836.0, 7904.0, 33836.0]
[302.0, 347.0, 352.0, 130.0]
[549, 570, 550, 705]