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
u821588465
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, respectively.
["N, M = map(int, input().split())\nA = list(map(int, input().split()))\nweight = [0,2,5,5,4,5,6,3,7,6]\ninf = float('inf')\ndp = [-inf] * (N+1)\ndp[0] = 0\nfor i in range(N+1):\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)\n", 'N, M = map(int, input().split())\nA = list(map(int, input().split()))\nweight = [0,2,5,5,4,5,6,3,7,6]\ndp = [-1] * (N+1)\ndp[0] = 0\n\nfor i in range(N+1):\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])\n']
['Wrong Answer', 'Accepted']
['s023130059', 's747366749']
[88816.0, 20592.0]
[1254.0, 140.0]
[297, 282]
p03128
u832039789
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, respectively.
['import sys\nfrom fractions import gcd\nfrom itertools import groupby as gb\nfrom itertools import permutations as perm\nfrom collections import Counter as C\nfrom collections import defaultdict as dd\nsys.setrecursionlimit(10**5)\n\nn,m = map(int,input().split())\n\nb = list(map(int,input().split()))\nhonsuu = [-1,2,5,5,4,5,6,3,7,6]\nenabled = [False] * 10\nfor bb in b:\n enabled[bb] = True\n# if (enabled[6] & enabled[9]):\n# enabled[6] = False;\n# if (enabled[5] & (enabled[2] | enabled[3])):\n# enabled[2] = enabled[3] = False;\n# if (enabled[2] & enabled[3]):\n# enabled[2] = False\n\na = []\nfor i in range(10):\n if (enabled[i]):\n a.append(i)\n\nif enabled[1]:\n if n % 2 == 1:\n if enabled[7]:\n res = "7" + ((n - 3) // 2) * "1"\n elif enabled[5]:\n res = "5" + ((n - 5) // 2) * "1"\n elif enabled[3]:\n res = "3" + ((n - 5) // 2) * "1"\n elif enabled[2]:\n res = "2" + ((n - 5) // 2) * "1"\n else:\n res = "8" + ((n - 7) // 2) * "1"\n print(res)\n else:\n print("1" * (n // 2))\n exit()\n\nif enabled[7]:\n if n % 3 == 1:\n if enabled[4]:\n res = "7" * ((n - 4) // 3) + "4"\n elif enabled[8]:\n res = "8" + "7" * ((n - 7) // 3)\n elif enabled[5]:\n res = "7" * ((n - 10) // 3) + "55"\n elif enabled[3]:\n res = "7" * ((n - 10) // 3) + "33"\n elif enabled[2]:\n res = "7" * ((n - 10) // 3) + "22"\n print(res)\n elif n % 3 == 0:\n print("7" * (n // 3))\n else:\n if enabled[5]:\n res = "7" * ((n - 5) // 3) + "5"\n elif enabled[3]:\n res = "7" * ((n - 5) // 3) + "3"\n elif enabled[2]:\n res = "7" * ((n - 5) // 3) + "2"\n elif enabled[4]:\n res = "7" * ((n - 8) // 3) + "44"\n elif enabled[8]:\n res = "88" + "7" * ((n - 14) // 3)\n print(res)\n exit()\n\nif enabled[4]:\n if n % 4 == 0:\n print("4" * (n // 4))\n elif n % 4 == 1:\n if enabled[5]:\n res = "5" + "4" * ((n - 5) // 4)\n elif enabled[3]:\n res = "4" * ((n - 5) // 4) + "3"\n elif enabled[2]:\n res = "4" * ((n - 5) // 4) + "2"\n elif enabled[8]:\n if enabled[9]:\n res = "98" + ((n - 13) // 4) * "4"\n elif enabled[6]:\n res = "86" + ((n - 13) // 4) * "4"\n else:\n res = "888" + ((n - 21) // 4) * "4"\n print(res)\n elif n % 4 == 2:\n if enabled[9]:\n res = "9" + "4" * ((n - 6) // 4)\n elif enabled[6]:\n res = "6" + "4" * ((n - 6) // 4)\n elif enabled[5]:\n res = "55" + "4" * ((n - 10) // 4)\n elif enabled[3]:\n res = "4" * ((n - 10) // 4) + "33"\n elif enabled[2]:\n res = "4" * ((n - 10) // 4) + "22"\n elif enabled[8]:\n res = "88" + ((n - 14) // 4) * "4"\n print(res)\n else:\n if enabled[8]:\n res = "8" + "4" * ((n - 7) // 4)\n elif enabled[9]:\n if enabled[5]:\n res = "95" + "4" * ((n - 11) // 4)\n elif enabled[3]:\n res = "9" + "4" * ((n - 11) // 4) + "3"\n elif enabled[2]:\n res = "9" + "4" * ((n - 11) // 4) + "2"\n elif enabled[6]:\n if enabled[5]:\n res = "65" + "4" * ((n - 11) // 4)\n elif enabled[3]:\n res = "6" + "4" * ((n - 11) // 4) + "3"\n elif enabled[2]:\n res = "6" + "4" * ((n - 11) // 4) + "2"\n elif enabled[5]:\n res = "555" + "4" * ((n - 15) // 4)\n elif enabled[3]:\n res = "4" * ((n - 15) // 4) + "333"\n else:\n res = "4" * ((n - 15) // 4) + "222"\n print(res)\n exit()\n\nfor i in [5, 3, 2]:\n c = str(i)\n if enabled[i]:\n if n % 5 == 0:\n print(c * (n // 5))\n elif n % 5 == 1:\n if enabled[9]:\n res = "9" + c * ((n - 6) // 5)\n elif enabled[6]:\n res = "6" + c * ((n - 6) // 5)\n else:\n res = "888" + c * ((n - 21) // 5)\n print(res)\n elif n % 5 == 2:\n if enabled[9]:\n res = "99" + c * ((n - 12) // 5)\n elif enabled[8]:\n res = "8" + c * ((n - 7) // 5)\n else:\n res = "66" + c * ((n - 12) // 5)\n print(res)\n elif n % 5 == 3:\n if enabled[9]:\n res = "999" + c * ((n - 18) // 5)\n elif enabled[6]:\n if enabled[8]:\n res = "86" + c * ((n - 13) // 5)\n else:\n res = "666" + c * ((n - 18) // 5)\n else:\n res = "8888" + c * ((n - 28) // 5)\n print(res)\n else:\n if enabled[9]:\n res = "9999" + c * ((n - 24) // 5)\n elif enabled[8]:\n res = "88" + c * ((n - 14) // 5)\n else:\n res = "6666" + c * ((n - 24) // 5)\n print(res)\n exit()\n\nif enabled[9]:\n c = "9"\n if n % 6 == 0:\n print(c * (n // 6))\n elif n % 6 == 1:\n print(c * ((n - 7) // 6) + "8")\n elif n % 6 == 2:\n print(c * ((n - 14) // 6) + "88")\n elif n % 6 == 3:\n print(c * ((n - 21) // 6) + "888")\n elif n % 6 == 4:\n print(c * ((n - 28) // 6) + "8888")\n else:\n print(c * ((n - 35) // 6) + "88888")\n exit()\n\nif enabled[6]:\n c = "6"\n if n % 6 == 0:\n print(c * (n // 6))\n elif n % 6 == 1:\n print("8" + c * ((n - 7) // 6))\n elif n % 6 == 2:\n print("88" + c * ((n - 14) // 6))\n elif n % 6 == 3:\n print("888" + c * ((n - 21) // 6))\n elif n % 6 == 4:\n print("8888" + c * ((n - 28) // 6))\n else:\n print("88888" + c * ((n - 35) // 6))\n exit()\n\nprint("8" * (n // 7))\n', 'import sys\nfrom fractions import gcd\nfrom itertools import groupby as gb\nfrom itertools import permutations as perm\nfrom collections import Counter as C\nfrom collections import defaultdict as dd\nsys.setrecursionlimit(10**5)\n\nn,m = map(int,input().split())\n\nb = list(map(int,input().split()))\nhonsuu = [-1,2,5,5,4,5,6,3,7,6]\nenabled = [False] * 10\nfor bb in b:\n enabled[bb] = True\nif (enabled[6] & enabled[9]):\n enabled[6] = False;\nif (enabled[5] & (enabled[2] | enabled[3])):\n enabled[2] = enabled[3] = False;\nif (enabled[2] & enabled[3]):\n enabled[2] = False\n\na = []\nfor i in range(10):\n if (enabled[i]):\n a.append(i)\n\nif enabled[1]:\n if n % 2 == 1:\n if enabled[7]:\n res = "7" + ((n - 3) // 2) * "1"\n elif enabled[5]:\n res = "5" + ((n - 5) // 2) * "1"\n elif enabled[3]:\n res = "3" + ((n - 5) // 2) * "1"\n elif enabled[2]:\n res = "2" + ((n - 5) // 2) * "1"\n else:\n res = "8" + ((n - 7) // 2) * "1"\n print(res)\n else:\n print("1" * (n // 2))\n exit()\n\nif enabled[7]:\n if n % 3 == 1:\n if enabled[4]:\n res = "7" * ((n - 4) // 3) + "4"\n elif enabled[8]:\n res = "8" + "7" * ((n - 7) // 3)\n elif enabled[5]:\n res = "7" * ((n - 10) // 3) + "55"\n elif enabled[3]:\n res = "7" * ((n - 10) // 3) + "33"\n elif enabled[2]:\n res = "7" * ((n - 10) // 3) + "22"\n print(res)\n elif n % 3 == 0:\n print("7" * (n // 3))\n else:\n if enabled[5]:\n res = "7" * ((n - 5) // 3) + "5"\n elif enabled[3]:\n res = "7" * ((n - 5) // 3) + "3"\n elif enabled[2]:\n res = "7" * ((n - 5) // 3) + "2"\n elif enabled[4]:\n res = "7" * ((n - 8) // 3) + "44"\n elif enabled[8]:\n res = "88" + "7" * ((n - 14) // 3)\n print(res)\n exit()\n\nif enabled[4]:\n if n % 4 == 0:\n print("4" * (n // 4))\n elif n % 4 == 1:\n if enabled[5]:\n res = "5" + "4" * ((n - 5) // 4)\n elif enabled[3]:\n res = "4" * ((n - 5) // 4) + "3"\n elif enabled[2]:\n res = "4" * ((n - 5) // 4) + "2"\n elif enabled[8]:\n if enabled[9]:\n res = "98" + ((n - 13) // 4) * "4"\n elif enabled[6]:\n res = "86" + ((n - 13) // 4) * "4"\n else:\n res = "888" + ((n - 21) // 4) * "4"\n print(res)\n elif n % 4 == 2:\n if enabled[9]:\n res = "9" + "4" * ((n - 6) // 4)\n elif enabled[6]:\n res = "6" + "4" * ((n - 6) // 4)\n elif enabled[5]:\n res = "55" + "4" * ((n - 10) // 4)\n elif enabled[3]:\n res = "4" * ((n - 10) // 4) + "33"\n elif enabled[2]:\n res = "4" * ((n - 10) // 4) + "22"\n elif enabled[8]:\n res = "88" + ((n - 14) // 4) * "4"\n print(res)\n else:\n if enabled[8]:\n res = "8" + "4" * ((n - 7) // 4)\n elif enabled[9]:\n if enabled[5]:\n res = "95" + "4" * ((n - 11) // 4)\n elif enabled[3]:\n res = "9" + "4" * ((n - 11) // 4) + "3"\n elif enabled[2]:\n res = "9" + "4" * ((n - 11) // 4) + "2"\n elif enabled[6]:\n if enabled[5]:\n res = "65" + "4" * ((n - 11) // 4)\n elif enabled[3]:\n res = "6" + "4" * ((n - 11) // 4) + "3"\n elif enabled[2]:\n res = "6" + "4" * ((n - 11) // 4) + "2"\n elif enabled[5]:\n res = "555" + "4" * ((n - 15) // 4)\n elif enabled[3]:\n res = "4" * ((n - 15) // 4) + "333"\n else:\n res = "4" * ((n - 15) // 4) + "222"\n print(res)\n exit()\n\nfor i in [5, 3, 2]:\n c = str(i)\n if enabled[i]:\n if n % 5 == 0:\n print(c * (n // 5))\n elif n % 5 == 1:\n if enabled[9]:\n res = "9" + c * ((n - 6) // 5)\n elif enabled[6]:\n res = "6" + c * ((n - 6) // 5)\n else:\n res = "888" + c * ((n - 21) // 5)\n print(res)\n elif n % 5 == 2:\n if enabled[8]:\n res = "8" + c * ((n - 7) // 5)\n elif enabled[9]:\n res = "99" + c * ((n - 12) // 5)\n else:\n res = "66" + c * ((n - 12) // 5)\n print(res)\n elif n % 5 == 3:\n if enabled[9]:\n res = "999" + c * ((n - 18) // 5)\n elif enabled[6]:\n if enabled[8]:\n res = "86" + c * ((n - 13) // 5)\n else:\n res = "666" + c * ((n - 18) // 5)\n else:\n res = "8888" + c * ((n - 28) // 5)\n print(res)\n else:\n if enabled[9]:\n res = "9999" + c * ((n - 24) // 5)\n elif enabled[8]:\n res = "88" + c * ((n - 14) // 5)\n else:\n res = "6666" + c * ((n - 24) // 5)\n print(res)\n exit()\n\nif enabled[9]:\n c = "9"\n if n % 6 == 0:\n print(c * (n // 6))\n elif n % 6 == 1:\n print(c * ((n - 7) // 6) + "8")\n elif n % 6 == 2:\n print(c * ((n - 14) // 6) + "88")\n elif n % 6 == 3:\n print(c * ((n - 21) // 6) + "888")\n elif n % 6 == 4:\n print(c * ((n - 28) // 6) + "8888")\n else:\n print(c * ((n - 35) // 6) + "88888")\n exit()\n\nif enabled[6]:\n c = "6"\n if n % 6 == 0:\n print(c * (n // 6))\n elif n % 6 == 1:\n print("8" + c * ((n - 7) // 6))\n elif n % 6 == 2:\n print("88" + c * ((n - 14) // 6))\n elif n % 6 == 3:\n print("888" + c * ((n - 21) // 6))\n elif n % 6 == 4:\n print("8888" + c * ((n - 28) // 6))\n else:\n print("88888" + c * ((n - 35) // 6))\n exit()\n\nprint("8" * (n // 7))\n', 'import sys\nfrom fractions import gcd\nfrom itertools import groupby as gb\nfrom itertools import permutations as perm\nfrom collections import Counter as C\nfrom collections import defaultdict as dd\nsys.setrecursionlimit(10**5)\n\nn,m = map(int,input().split())\n\nb = list(map(int,input().split()))\nhonsuu = [-1,2,5,5,4,5,6,3,7,6]\nenabled = [False] * 10\nfor bb in b:\n enabled[bb] = True\nif (enabled[6] & enabled[9]):\n enabled[6] = False;\nif (enabled[5] & (enabled[2] | enabled[3])):\n enabled[2] = enabled[3] = False;\nif (enabled[2] & enabled[3]):\n enabled[2] = False\n\n\ndef printf(str):\n l = list(str)\n l = sorted(l, reverse=True)\n print("".join(l))\n\na = []\nfor i in range(10):\n if (enabled[i]):\n a.append(i)\n\nif enabled[1]:\n if n % 2 == 1:\n if enabled[7]:\n res = "7" + ((n - 3) // 2) * "1"\n elif enabled[5]:\n res = "5" + ((n - 5) // 2) * "1"\n elif enabled[3]:\n res = "3" + ((n - 5) // 2) * "1"\n elif enabled[2]:\n res = "2" + ((n - 5) // 2) * "1"\n else:\n res = "8" + ((n - 7) // 2) * "1"\n printf(res)\n else:\n printf("1" * (n // 2))\n exit()\n\nif enabled[7]:\n if n % 3 == 1:\n if enabled[4]:\n res = "7" * ((n - 4) // 3) + "4"\n elif enabled[8]:\n res = "8" + "7" * ((n - 7) // 3)\n elif enabled[5]:\n res = "7" * ((n - 10) // 3) + "55"\n elif enabled[3]:\n res = "7" * ((n - 10) // 3) + "33"\n elif enabled[2]:\n res = "7" * ((n - 10) // 3) + "22"\n printf(res)\n elif n % 3 == 0:\n printf("7" * (n // 3))\n else:\n if enabled[5]:\n res = "7" * ((n - 5) // 3) + "5"\n elif enabled[3]:\n res = "7" * ((n - 5) // 3) + "3"\n elif enabled[2]:\n res = "7" * ((n - 5) // 3) + "2"\n elif enabled[4]:\n res = "7" * ((n - 8) // 3) + "44"\n elif enabled[8]:\n res = "88" + "7" * ((n - 14) // 3)\n printf(res)\n exit()\n\nif enabled[4]:\n if n % 4 == 0:\n printf("4" * (n // 4))\n elif n % 4 == 1:\n if enabled[5]:\n res = "5" + "4" * ((n - 5) // 4)\n elif enabled[3]:\n res = "4" * ((n - 5) // 4) + "3"\n elif enabled[2]:\n res = "4" * ((n - 5) // 4) + "2"\n elif enabled[8]:\n if enabled[9]:\n res = "98" + ((n - 13) // 4) * "4"\n elif enabled[6]:\n res = "86" + ((n - 13) // 4) * "4"\n else:\n res = "888" + ((n - 21) // 4) * "4"\n printf(res)\n elif n % 4 == 2:\n if enabled[9]:\n res = "9" + "4" * ((n - 6) // 4)\n elif enabled[6]:\n res = "6" + "4" * ((n - 6) // 4)\n elif enabled[5]:\n res = "55" + "4" * ((n - 10) // 4)\n elif enabled[3]:\n res = "4" * ((n - 10) // 4) + "33"\n elif enabled[2]:\n res = "4" * ((n - 10) // 4) + "22"\n elif enabled[8]:\n res = "88" + ((n - 14) // 4) * "4"\n printf(res)\n else:\n if enabled[8]:\n res = "8" + "4" * ((n - 7) // 4)\n elif enabled[9]:\n if enabled[5]:\n res = "95" + "4" * ((n - 11) // 4)\n elif enabled[3]:\n res = "9" + "4" * ((n - 11) // 4) + "3"\n elif enabled[2]:\n res = "9" + "4" * ((n - 11) // 4) + "2"\n elif enabled[6]:\n if enabled[5]:\n res = "65" + "4" * ((n - 11) // 4)\n elif enabled[3]:\n res = "6" + "4" * ((n - 11) // 4) + "3"\n elif enabled[2]:\n res = "6" + "4" * ((n - 11) // 4) + "2"\n elif enabled[5]:\n res = "555" + "4" * ((n - 15) // 4)\n elif enabled[3]:\n res = "4" * ((n - 15) // 4) + "333"\n else:\n res = "4" * ((n - 15) // 4) + "222"\n printf(res)\n exit()\n\nfor i in [5, 3, 2]:\n c = str(i)\n if enabled[i]:\n if n % 5 == 0:\n printf(c * (n // 5))\n elif n % 5 == 1:\n if enabled[9]:\n res = "9" + c * ((n - 6) // 5)\n elif enabled[6]:\n res = "6" + c * ((n - 6) // 5)\n else:\n res = "888" + c * ((n - 21) // 5)\n printf(res)\n elif n % 5 == 2:\n if enabled[9]:\n res = "99" + c * ((n - 12) // 5)\n elif enabled[8]:\n res = "8" + c * ((n - 7) // 5)\n else:\n res = "66" + c * ((n - 12) // 5)\n printf(res)\n elif n % 5 == 3:\n if enabled[9]:\n res = "999" + c * ((n - 18) // 5)\n elif enabled[6]:\n if enabled[8]:\n res = "86" + c * ((n - 13) // 5)\n else:\n res = "666" + c * ((n - 18) // 5)\n else:\n res = "8888" + c * ((n - 28) // 5)\n printf(res)\n else:\n if enabled[9]:\n res = "9999" + c * ((n - 24) // 5)\n elif enabled[8]:\n res = "88" + c * ((n - 14) // 5)\n else:\n res = "6666" + c * ((n - 24) // 5)\n printf(res)\n exit()\n\nif enabled[9]:\n c = "9"\n if n % 6 == 0:\n printf(c * (n // 6))\n elif n % 6 == 1:\n printf(c * ((n - 7) // 6) + "8")\n elif n % 6 == 2:\n printf(c * ((n - 14) // 6) + "88")\n elif n % 6 == 3:\n printf(c * ((n - 21) // 6) + "888")\n elif n % 6 == 4:\n printf(c * ((n - 28) // 6) + "8888")\n else:\n printf(c * ((n - 35) // 6) + "88888")\n exit()\n\nif enabled[6]:\n c = "6"\n if n % 6 == 0:\n printf(c * (n // 6))\n elif n % 6 == 1:\n printf("8" + c * ((n - 7) // 6))\n elif n % 6 == 2:\n printf("88" + c * ((n - 14) // 6))\n elif n % 6 == 3:\n printf("888" + c * ((n - 21) // 6))\n elif n % 6 == 4:\n printf("8888" + c * ((n - 28) // 6))\n else:\n printf("88888" + c * ((n - 35) // 6))\n exit()\n\nprintf("8" * (n // 7))\n', 'import sys\nfrom fractions import gcd\nfrom itertools import groupby as gb\nfrom itertools import permutations as perm\nfrom collections import Counter as C\nfrom collections import defaultdict as dd\nsys.setrecursionlimit(10**5)\n\nn,m = map(int,input().split())\n\nb = list(map(int,input().split()))\nhonsuu = [-1,2,5,5,4,5,6,3,7,6]\nenabled = [False] * 10\nfor bb in b:\n enabled[bb] = True\nif (enabled[6] & enabled[9]):\n enabled[6] = False;\nif (enabled[5] & (enabled[2] | enabled[3])):\n enabled[2] = enabled[3] = False;\nif (enabled[2] & enabled[3]):\n enabled[2] = False\n\na = []\nfor i in range(10):\n if (enabled[i]):\n a.append(i)\n\nif enabled[1]:\n if n % 2 == 1:\n if enabled[7]:\n res = "7" + ((n - 3) // 2) * "1"\n elif enabled[5]:\n res = "5" + ((n - 5) // 2) * "1"\n elif enabled[3]:\n res = "3" + ((n - 5) // 2) * "1"\n elif enabled[2]:\n res = "2" + ((n - 5) // 2) * "1"\n else:\n res = "8" + ((n - 7) // 2) * "1"\n print(res)\n else:\n print("1" * (n // 2))\n exit()\n\nif enabled[7]:\n if n % 3 == 1:\n if enabled[4]:\n res = "7" * ((n - 4) // 3) + "4"\n elif enabled[8]:\n res = "8" + "7" * ((n - 7) // 3)\n elif enabled[5]:\n res = "7" * ((n - 10) // 3) + "55"\n elif enabled[3]:\n res = "7" * ((n - 10) // 3) + "33"\n elif enabled[2]:\n res = "7" * ((n - 10) // 3) + "22"\n print(res)\n elif n % 3 == 0:\n print("7" * (n // 3))\n else:\n if enabled[5]:\n res = "7" * ((n - 5) // 3) + "5"\n elif enabled[3]:\n res = "7" * ((n - 5) // 3) + "3"\n elif enabled[2]:\n res = "7" * ((n - 5) // 3) + "2"\n elif enabled[4]:\n res = "7" * ((n - 8) // 3) + "44"\n elif enabled[8]:\n res = "88" + "7" * ((n - 14) // 3)\n print(res)\n exit()\n\nif enabled[4]:\n if n % 4 == 0:\n print("4" * (n // 4))\n elif n % 4 == 1:\n if enabled[5]:\n res = "5" + "4" * ((n - 5) // 4)\n elif enabled[3]:\n res = "4" * ((n - 5) // 4) + "3"\n elif enabled[2]:\n res = "4" * ((n - 5) // 4) + "2"\n elif enabled[8]:\n if enabled[9]:\n res = "98" + ((n - 13) // 4) * "4"\n elif enabled[6]:\n res = "86" + ((n - 13) // 4) * "4"\n else:\n res = "888" + ((n - 21) // 4) * "4"\n print(res)\n elif n % 4 == 2:\n if enabled[9]:\n res = "9" + "4" * ((n - 6) // 4)\n elif enabled[6]:\n res = "6" + "4" * ((n - 6) // 4)\n elif enabled[5]:\n res = "55" + "4" * ((n - 10) // 4)\n elif enabled[3]:\n res = "4" * ((n - 10) // 4) + "33"\n elif enabled[2]:\n res = "4" * ((n - 10) // 4) + "22"\n elif enabled[8]:\n res = "88" + ((n - 14) // 4) * "4"\n print(res)\n else:\n if enabled[8]:\n res = "8" + "4" * ((n - 7) // 4)\n elif enabled[9]:\n if enabled[5]:\n res = "95" + "4" * ((n - 11) // 4)\n elif enabled[3]:\n res = "9" + "4" * ((n - 11) // 4) + "3"\n elif enabled[2]:\n res = "9" + "4" * ((n - 11) // 4) + "2"\n elif enabled[6]:\n if enabled[5]:\n res = "65" + "4" * ((n - 11) // 4)\n elif enabled[3]:\n res = "6" + "4" * ((n - 11) // 4) + "3"\n elif enabled[2]:\n res = "6" + "4" * ((n - 11) // 4) + "2"\n elif enabled[5]:\n res = "555" + "4" * ((n - 15) // 4)\n elif enabled[3]:\n res = "4" * ((n - 15) // 4) + "333"\n else:\n res = "4" * ((n - 15) // 4) + "222"\n print(res)\n exit()\n\nfor i in [5, 3, 2]:\n c = str(i)\n if enabled[i]:\n if n % 5 == 0:\n print(c * (n // 5))\n elif n % 5 == 1:\n if enabled[9]:\n res = "9" + c * ((n - 6) // 5)\n elif enabled[6]:\n res = "6" + c * ((n - 6) // 5)\n else:\n res = "888" + c * ((n - 21) // 5)\n print(res)\n elif n % 5 == 2:\n if enabled[9]:\n res = "99" + c * ((n - 12) // 5)\n elif enabled[8]:\n res = "8" + c * ((n - 7) // 5)\n else:\n res = "66" + c * ((n - 12) // 5)\n print(res)\n elif n % 5 == 3:\n if enabled[9]:\n res = "999" + c * ((n - 18) // 5)\n elif enabled[6]:\n if enabled[8]:\n res = "86" + c * ((n - 13) // 5)\n else:\n res = "666" + c * ((n - 18) // 5)\n else:\n res = "8888" + c * ((n - 28) // 5)\n print(res)\n else:\n if enabled[9]:\n res = "9999" + c * ((n - 24) // 5)\n elif enabled[8]:\n res = "88" + c * ((n - 14) // 5)\n else:\n res = "6666" + c * ((n - 24) // 5)\n print(res)\n exit()\n\nif enabled[9]:\n c = "9"\n if n % 6 == 0:\n print(c * (n // 6))\n elif n % 6 == 1:\n print(c * ((n - 7) // 6) + "8")\n elif n % 6 == 2:\n print(c * ((n - 14) // 6) + "88")\n elif n % 6 == 3:\n print(c * ((n - 21) // 6) + "888")\n elif n % 6 == 4:\n print(c * ((n - 28) // 6) + "8888")\n else:\n print(c * ((n - 35) // 6) + "88888")\n exit()\n\nif enabled[6]:\n c = "6"\n if n % 6 == 0:\n print(c * (n // 6))\n elif n % 6 == 1:\n print("8" + c * ((n - 7) // 6))\n elif n % 6 == 2:\n print("88" + c * ((n - 14) // 6))\n elif n % 6 == 3:\n print("888" + c * ((n - 21) // 6))\n elif n % 6 == 4:\n print("8888" + c * ((n - 28) // 6))\n else:\n print("88888" + c * ((n - 35) // 6))\n exit()\n\nprint("8" * (n // 7))\n', 'import sys\nfrom fractions import gcd\nfrom itertools import groupby as gb\nfrom itertools import permutations as perm\nfrom collections import Counter as C\nfrom collections import defaultdict as dd\nsys.setrecursionlimit(10**5)\n\nn,m = map(int,input().split())\n\nb = list(map(int,input().split()))\nhonsuu = [-1,2,5,5,4,5,6,3,7,6]\nenabled = [False] * 10\nfor bb in b:\n enabled[bb] = True\nif (enabled[6] & enabled[9]):\n enabled[6] = False;\nif (enabled[5] & (enabled[2] | enabled[3])):\n enabled[2] = enabled[3] = False;\nif (enabled[2] & enabled[3]):\n enabled[2] = False\n\na = []\nfor i in range(10):\n if (enabled[i]):\n a.append(i)\n\nif enabled[1]:\n if n % 2 == 1:\n if enabled[7]:\n res = "7" + ((n - 3) // 2) * "1"\n else:\n res = ""\n if enabled[5]:\n res += "5"\n elif enabled[3]:\n res += "3"\n else:\n res += "2"\n res += ((n - 5) // 2) * "1"\n print(res)\n else:\n print("1" * (n // 2))\n exit()\n\nif enabled[7]:\n if n % 3 == 1:\n if enabled[4]:\n res = "7" * ((n - 4) // 3) + "4"\n elif enabled[8]:\n res = "8" + "7" * ((n - 7) // 3)\n elif enabled[5]:\n res = "7" * ((n - 10) // 3) + "55"\n elif enabled[3]:\n res = "7" * ((n - 10) // 3) + "33"\n elif enabled[2]:\n res = "7" * ((n - 10) // 3) + "22"\n print(res)\n elif n % 3 == 0:\n print("7" * (n // 3))\n else:\n if enabled[5]:\n res = "7" * ((n - 5) // 3) + "5"\n elif enabled[3]:\n res = "7" * ((n - 5) // 3) + "3"\n elif enabled[2]:\n res = "7" * ((n - 5) // 3) + "2"\n elif enabled[4]:\n res = "7" * ((n - 8) // 3) + "44"\n elif enabled[8]:\n res = "88" + "7" * ((n - 14) // 3)\n print(res)\n exit()\n\nif enabled[4]:\n if n % 4 == 0:\n print("4" * (n // 4))\n elif n % 4 == 1:\n if enabled[5]:\n res = "5" + "4" * ((n - 5) // 4)\n elif enabled[3]:\n res = "4" * ((n - 5) // 4) + "3"\n elif enabled[2]:\n res = "4" * ((n - 5) // 4) + "2"\n elif enabled[8]:\n if enabled[9]:\n res = "98" + ((n - 13) // 4) * "4"\n elif enabled[6]:\n res = "86" + ((n - 13) // 4) * "4"\n else:\n res = "888" + ((n - 21) // 4) * "4"\n print(res)\n elif n % 4 == 2:\n if enabled[9]:\n res = "9" + "4" * ((n - 6) // 4)\n elif enabled[6]:\n res = "6" + "4" * ((n - 6) // 4)\n elif enabled[5]:\n res = "55" + "4" * ((n - 10) // 4)\n elif enabled[3]:\n res = "4" * ((n - 10) // 4) + "33"\n elif enabled[2]:\n res = "4" * ((n - 10) // 4) + "22"\n elif enabled[8]:\n res = "88" + ((n - 14) // 4) * "4"\n print(res)\n else:\n if enabled[8]:\n res = "8" + "4" * ((n - 7) // 4)\n elif enabled[9]:\n if enabled[5]:\n res = "95" + "4" * ((n - 11) // 4)\n elif enabled[3]:\n res = "9" + "4" * ((n - 11) // 4) + "3"\n elif enabled[2]:\n res = "9" + "4" * ((n - 11) // 4) + "2"\n elif enabled[6]:\n if enabled[5]:\n res = "65" + "4" * ((n - 11) // 4)\n elif enabled[3]:\n res = "6" + "4" * ((n - 11) // 4) + "3"\n elif enabled[2]:\n res = "6" + "4" * ((n - 11) // 4) + "2"\n elif enabled[5]:\n res = "555" + "4" * ((n - 15) // 4)\n elif enabled[3]:\n res = "4" * ((n - 15) // 4) + "333"\n else:\n res = "4" * ((n - 15) // 4) + "222"\n print(res)\n exit()\n\nfor i in [5, 3, 2]:\n c = str(i)\n if enabled[i]:\n if n % 5 == 0:\n print(c * (n // 5))\n elif n % 5 == 1:\n if enabled[9]:\n res = "9" + c * ((n - 6) // 5)\n elif enabled[6]:\n res = "6" + c * ((n - 6) // 5)\n else:\n res = "888" + c * ((n - 21) // 5)\n print(res)\n elif n % 5 == 2:\n if enabled[8]:\n res = "8" + c * ((n - 7) // 5)\n elif enabled[9]:\n res = "99" + c * ((n - 12) // 5)\n else:\n res = "66" + c * ((n - 12) // 5)\n print(res)\n elif n % 5 == 3:\n if enabled[9]:\n res = "999" + c * ((n - 18) // 5)\n elif enabled[6]:\n if enabled[8]:\n res = "86" + c * ((n - 13) // 5)\n else:\n res = "666" + c * ((n - 18) // 5)\n else:\n res = "8888" + c * ((n - 28) // 5)\n print(res)\n else:\n if enabled[9]:\n res = "9999" + c * ((n - 24) // 5)\n elif enabled[8]:\n res = "88" + c * ((n - 14) // 5)\n else:\n res = "6666" + c * ((n - 24) // 5)\n print(res)\n exit()\n\nfor i in [9, 6]:\n c = str(i)\n if enabled[i]:\n if n % 6 == 0:\n print(c * (n // 6))\n elif n % 6 == 1:\n print("8" + c * ((n - 7) // 6))\n elif n % 6 == 2:\n print("88" + c * ((n - 14) // 6))\n elif n % 6 == 3:\n print("888" + c * ((n - 21) // 6))\n elif n % 6 == 4:\n print("8888" + c * ((n - 28) // 6))\n else:\n print("88888" + c * ((n - 35) // 6))\n exit()\n\nprint("8" * (n // 7))\n', 'import sys\nfrom fractions import gcd\nfrom itertools import groupby as gb\nfrom itertools import permutations as perm\nfrom collections import Counter as C\nfrom collections import defaultdict as dd\nsys.setrecursionlimit(10**5)\n\nn,m = map(int,input().split())\n\nb = list(map(int,input().split()))\nhonsuu = [-1,2,5,5,4,5,6,3,7,6]\nenabled = [False] * 10\nfor bb in b:\n enabled[bb] = True\nif (enabled[6] & enabled[9]):\n enabled[6] = False;\nif (enabled[5] & (enabled[2] | enabled[3])):\n enabled[2] = enabled[3] = False;\nif (enabled[2] & enabled[3]):\n enabled[2] = False\n\na = []\nfor i in range(10):\n if (enabled[i]):\n a.append(i)\n\nif enabled[1]:\n if n % 2 == 1:\n if enabled[7]:\n res = "7" + ((n - 3) // 2) * "1"\n elif enabled[5]:\n res = "5" + ((n - 5) // 2) * "1"\n elif enabled[3]:\n res = "3" + ((n - 5) // 2) * "1"\n elif enabled[2]:\n res = "2" + ((n - 5) // 2) * "1"\n else:\n res = "8" + ((n - 7) // 2) * "1"\n print(res)\n else:\n print("1" * (n // 2))\n exit()\n\nif enabled[7]:\n if n % 3 == 1:\n if enabled[4]:\n res = "7" * ((n - 4) // 3) + "4"\n elif enabled[8]:\n res = "8" + "7" * ((n - 7) // 3)\n elif enabled[5]:\n res = "7" * ((n - 10) // 3) + "55"\n elif enabled[3]:\n res = "7" * ((n - 10) // 3) + "33"\n elif enabled[2]:\n res = "7" * ((n - 10) // 3) + "22"\n print(res)\n elif n % 3 == 0:\n print("7" * (n // 3))\n else:\n if enabled[5]:\n res = "7" * ((n - 5) // 3) + "5"\n elif enabled[3]:\n res = "7" * ((n - 5) // 3) + "3"\n elif enabled[2]:\n res = "7" * ((n - 5) // 3) + "2"\n elif enabled[4]:\n res = "7" * ((n - 8) // 3) + "44"\n elif enabled[8]:\n res = "88" + "7" * ((n - 14) // 3)\n print(res)\n exit()\n\nif enabled[4]:\n if n % 4 == 0:\n print("4" * (n // 4))\n elif n % 4 == 1:\n if enabled[5]:\n res = "5" + "4" * ((n - 5) // 4)\n elif enabled[3]:\n res = "4" * ((n - 5) // 4) + "3"\n elif enabled[2]:\n res = "4" * ((n - 5) // 4) + "2"\n elif enabled[8]:\n if enabled[9]:\n res = "98" + ((n - 13) // 4) * "4"\n elif enabled[6]:\n res = "86" + ((n - 13) // 4) * "4"\n else:\n res = "888" + ((n - 21) // 4) * "4"\n print(res)\n elif n % 4 == 2:\n if enabled[9]:\n res = "9" + "4" * ((n - 6) // 4)\n elif enabled[6]:\n res = "6" + "4" * ((n - 6) // 4)\n elif enabled[5]:\n res = "55" + "4" * ((n - 10) // 4)\n elif enabled[3]:\n res = "4" * ((n - 10) // 4) + "33"\n elif enabled[2]:\n res = "4" * ((n - 10) // 4) + "22"\n elif enabled[8]:\n res = "88" + ((n - 14) // 4) * "4"\n print(res)\n else:\n if enabled[8]:\n res = "8" + "4" * ((n - 7) // 4)\n elif enabled[9]:\n if enabled[5]:\n res = "95" + "4" * ((n - 11) // 4)\n elif enabled[3]:\n res = "9" + "4" * ((n - 11) // 4) + "3"\n elif enabled[2]:\n res = "9" + "4" * ((n - 11) // 4) + "2"\n elif enabled[6]:\n if enabled[5]:\n res = "65" + "4" * ((n - 11) // 4)\n elif enabled[3]:\n res = "6" + "4" * ((n - 11) // 4) + "3"\n elif enabled[2]:\n res = "6" + "4" * ((n - 11) // 4) + "2"\n elif enabled[5]:\n res = "555" + "4" * ((n - 15) // 4)\n elif enabled[3]:\n res = "4" * ((n - 15) // 4) + "333"\n else:\n res = "4" * ((n - 15) // 4) + "222"\n print(res)\n exit()\n\nfor i in [5, 3, 2]:\n c = str(i)\n if enabled[i]:\n if n % 5 == 0:\n print(c * (n // 5))\n elif n % 5 == 1:\n if enabled[9]:\n res = "9" + c * ((n - 6) // 5)\n elif enabled[6]:\n res = "6" + c * ((n - 6) // 5)\n else:\n res = "888" + c * ((n - 21) // 5)\n print(res)\n elif n % 5 == 2:\n if enabled[8]:\n res = "8" + c * ((n - 7) // 5)\n elif enabled[9]:\n res = "99" + c * ((n - 12) // 5)\n else:\n res = "66" + c * ((n - 12) // 5)\n print(res)\n elif n % 5 == 3:\n if enabled[9]:\n res = "999" + c * ((n - 18) // 5)\n elif enabled[6]:\n if enabled[8]:\n res = "86" + c * ((n - 13) // 5)\n else:\n res = "666" + c * ((n - 18) // 5)\n else:\n res = "8888" + c * ((n - 28) // 5)\n print(res)\n else:\n if enabled[9]:\n res = "9999" + c * ((n - 24) // 5)\n elif enabled[8]:\n res = "88" + c * ((n - 14) // 5)\n else:\n res = "6666" + c * ((n - 24) // 5)\n print(res)\n exit()\n\nfor i in [9, 6]:\n c = str(i)\n if enabled[i]:\n if n % 6 == 0:\n print(c * (n // 6))\n elif n % 6 == 1:\n print("8" + c * ((n - 7) // 6))\n elif n % 6 == 2:\n print("88" + c * ((n - 14) // 6))\n elif n % 6 == 3:\n print("888" + c * ((n - 21) // 6))\n elif n % 6 == 4:\n print("8888" + c * ((n - 28) // 6))\n else:\n print("88888" + c * ((n - 35) // 6))\n exit()\n\nprint("8" * (n // 7))\n', 'n,m = map(int,input().split())\na = list(map(int,input().split()))\nenabled = [(i in a) for i in range(10)]\n\nif enabled[1]:\n if n % 2 == 1:\n if enabled[7]:\n res = "7" + ((n - 3) // 2) * "1"\n elif enabled[5]:\n res = "5" + ((n - 5) // 2) * "1"\n elif enabled[3]:\n res = "3" + ((n - 5) // 2) * "1"\n elif enabled[2]:\n res = "2" + ((n - 5) // 2) * "1"\n else:\n res = "8" + ((n - 7) // 2) * "1"\n else:\n res = "1" * (n // 2)\nelif enabled[7]:\n if n % 3 == 1:\n if enabled[4]:\n res = "7" * ((n - 4) // 3) + "4"\n elif enabled[8]:\n res = "8" + "7" * ((n - 7) // 3)\n elif enabled[5]:\n res = "7" * ((n - 10) // 3) + "55"\n elif enabled[3]:\n res = "7" * ((n - 10) // 3) + "33"\n elif enabled[2]:\n res = "7" * ((n - 10) // 3) + "22"\n elif n % 3 == 0:\n res = "7" * (n // 3)\n else:\n if enabled[5]:\n res = "7" * ((n - 5) // 3) + "5"\n elif enabled[3]:\n res = "7" * ((n - 5) // 3) + "3"\n elif enabled[2]:\n res = "7" * ((n - 5) // 3) + "2"\n elif enabled[4]:\n res = "7" * ((n - 8) // 3) + "44"\n elif enabled[8]:\n res = "88" + "7" * ((n - 14) // 3)\nelif enabled[4]:\n if n % 4 == 0:\n res = "4" * (n // 4)\n elif n % 4 == 1:\n if enabled[5]:\n res = "5" + "4" * ((n - 5) // 4)\n elif enabled[3]:\n res = "4" * ((n - 5) // 4) + "3"\n elif enabled[2]:\n res = "4" * ((n - 5) // 4) + "2"\n elif enabled[8]:\n if enabled[9]:\n res = "98" + ((n - 13) // 4) * "4"\n elif enabled[6]:\n res = "86" + ((n - 13) // 4) * "4"\n else:\n res = "888" + ((n - 21) // 4) * "4"\n elif n % 4 == 2:\n if enabled[9]:\n res = "9" + "4" * ((n - 6) // 4)\n elif enabled[6]:\n res = "6" + "4" * ((n - 6) // 4)\n elif enabled[5]:\n res = "55" + "4" * ((n - 10) // 4)\n elif enabled[3]:\n res = "4" * ((n - 10) // 4) + "33"\n elif enabled[2]:\n res = "4" * ((n - 10) // 4) + "22"\n elif enabled[8]:\n res = "88" + ((n - 14) // 4) * "4"\n else:\n if enabled[9]:\n if enabled[5]:\n res = "95" + "4" * ((n - 11) // 4)\n elif enabled[3]:\n res = "9" + "4" * ((n - 11) // 4) + "3"\n elif enabled[2]:\n res = "9" + "4" * ((n - 11) // 4) + "2"\n elif enabled[8]:\n res = "8" + "4" * ((n - 7) // 4)\n elif enabled[6]:\n if enabled[5]:\n res = "65" + "4" * ((n - 11) // 4)\n elif enabled[3]:\n res = "6" + "4" * ((n - 11) // 4) + "3"\n elif enabled[2]:\n res = "6" + "4" * ((n - 11) // 4) + "2"\n elif enabled[5]:\n res = "555" + "4" * ((n - 15) // 4)\n elif enabled[3]:\n res = "4" * ((n - 15) // 4) + "333"\n else:\n res = "4" * ((n - 15) // 4) + "222"\nelse:\n for i in [5, 3, 2]:\n c = str(i)\n if enabled[i]:\n if n % 5 == 0:\n res = c * (n // 5)\n elif n % 5 == 1:\n if enabled[9]:\n res = "9" + c * ((n - 6) // 5)\n elif enabled[6]:\n res = "6" + c * ((n - 6) // 5)\n else:\n res = "888" + c * ((n - 21) // 5)\n elif n % 5 == 2:\n if enabled[9]:\n res = "99" + c * ((n - 12) // 5)\n elif enabled[8]:\n res = "8" + c * ((n - 7) // 5)\n else:\n res = "66" + c * ((n - 12) // 5)\n elif n % 5 == 3:\n if enabled[9]:\n res = "999" + c * ((n - 18) // 5)\n elif enabled[6]:\n if enabled[8]:\n res = "86" + c * ((n - 13) // 5)\n else:\n res = "666" + c * ((n - 18) // 5)\n else:\n res = "8888" + c * ((n - 28) // 5)\n else:\n if enabled[9]:\n res = "9999" + c * ((n - 24) // 5)\n elif enabled[8]:\n res = "88" + c * ((n - 14) // 5)\n else:\n res = "6666" + c * ((n - 24) // 5)\n print(res)\n exit()\n if enabled[9]:\n if n % 6 == 0:\n res = "9" * (n // 6)\n elif n % 6 == 1:\n res = "9" * ((n - 7) // 6) + "8"\n elif n % 6 == 2:\n res = "9" * ((n - 14) // 6) + "88"\n elif n % 6 == 3:\n res = "9" * ((n - 21) // 6) + "888"\n elif n % 6 == 4:\n res = "9" * ((n - 28) // 6) + "8888"\n else:\n res = "9" * ((n - 35) // 6) + "88888"\n elif enabled[6]:\n if n % 6 == 0:\n res = "6" * (n // 6)\n elif n % 6 == 1:\n res = "8" + "6" * ((n - 7) // 6)\n elif n % 6 == 2:\n res = "88" + "6" * ((n - 14) // 6)\n elif n % 6 == 3:\n res = "888" + "6" * ((n - 21) // 6)\n elif n % 6 == 4:\n res = "8888" + "6" * ((n - 28) // 6)\n else:\n res = "88888" + "6" * ((n - 35) // 6)\n else:\n res = "8" * (n // 7)\nprint(res)\n']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s021338693', 's062435088', 's142127009', 's486632579', 's630152142', 's941426708', 's498294594']
[5172.0, 5172.0, 5208.0, 5172.0, 5340.0, 5172.0, 3572.0]
[37.0, 38.0, 37.0, 37.0, 40.0, 38.0, 19.0]
[5956, 5944, 6062, 5944, 5587, 5626, 5438]
p03128
u848504701
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, respectively.
['import math\n\nN,M=map(int,input().split())\nA=list(map(int,input().split()))\nA.sort(reverse=True)\nnum=[0,2,5,5,4,5,6,3,7,6]\ndp=[0]\nketa=[0]\ntmp=0\ntmp1=0\ntmp_keta=-1\ntmp1_keta=-1\nfor i in range(1,N+1):\n tmp=0\n for j in A:\n tmp1=-100000000000000000000\n if(i-num[j]>=0):\n if(dp[i-num[j]]!=0):\n tmp1=dp[i-num[j]]+j*(10**keta[i-num[j]])\n tmp1_keta=keta[i-num[j]]+1\n else:\n tmp1=j\n tmp1_keta=1\n if(tmp1>tmp):\n tmp=tmp1\n tmp_keta=tmp1_keta\n dp.append(tmp)\n keta.append(tmp_keta)\nans=dp[N]\nprint(ans)', 'ort math\n\nN,M=map(int,input().split())\nA=list(map(int,input().split()))\nA.sort(reverse=True)\nnum=[0,2,5,5,4,5,6,3,7,6]\ndp=[0]\nketa=[0]\ntmp=0\ntmp1=0\ntmp_keta=-1\ntmp1_keta=-1\nfor i in range(1,N+1):\n tmp=-100000000000000000000\n tmp_keta=-1\n for j in A:\n tmp1=-100000000000000000000\n tmp1_keta=-1\n if(i-num[j]>=0):\n if(dp[i-num[j]]!=0):\n tmp1=dp[i-num[j]]+j*(10**keta[i-num[j]])\n tmp1_keta=keta[i-num[j]]+1\n else:\n tmp1=j\n tmp1_keta=1\n if(tmp1>tmp):\n tmp=tmp1\n tmp_keta=tmp1_keta\n dp.append(tmp)\n keta.append(tmp_keta)\nans=dp[N]\nprint(ans)', 'N,M=map(int,input().split())\nA=list(map(int,input().split()))\nA.sort(reverse=True)\nnum=[0,2,5,5,4,5,6,3,7,6]\ndp=[0]\ntmp=0\ntmp1=0\nfor i in range(1,N+1):\n tmp=0\n for j in A:\n tmp1=-100000000000000000000\n if(i-num[j]>=0):\n if(dp[i-num[j]]!=0):\n tmp1=dp[i-num[j]]+j*(10**len(str(dp[i-num[j]])))\n else:\n tmp1=j\n if(tmp1>tmp):\n tmp=tmp1\n dp.append(tmp)\nans=dp[N]\nprint(ans)', 'import math\n\nN,M=map(int,input().split())\nA=list(map(int,input().split()))\nA.sort(reverse=True)\nnum=[0,2,5,5,4,5,6,3,7,6]\ndp=[0]\ntmp=0\ntmp1=0\nfor i in range(1,N+1):\n tmp=0\n for j in A:\n tmp1=-100000000000000000000\n if(i-num[j]>=0):\n if(dp[i-num[j]]!=0):\n tmp1=dp[i-num[j]]+j*(10**int(math.log10(dp[i-num[j]]) + 1))\n else:\n tmp1=j\n if(tmp1>tmp):\n tmp=tmp1\n dp.append(tmp)\nans=dp[N]\nprint(ans)\n \n', 'N,M=map(int,input().split())\nA=list(map(int,input().split()))\nif(1 in A):\n if(4 in A):\n A.remove(4)\n if(9 in A):\n A.remove(9)\n if(6 in A):\n A.remove(6)\nif(5 in A):\n if(3 in A):\n A.remove(3)\n if(2 in A):\n A.remove(2)\nif(3 in A):\n if(2 in A):\n A.remove(2)\nif(9 in A):\n if(6 in A):\n A.remove(6)\nif(7 in A):\n if(9 in A):\n A.remove(9)\n if(6 in A):\n A.remove(6)\nnum=[0,2,5,5,4,5,6,3,7,6]\ndp=[0]\nketa=[0]\ntmp=0\ntmp1=0\ntmp_keta=-1\ntmp1_keta=-1\nfor i in range(1,N+1):\n tmp=-1\n tmp_keta=-1\n for j in A:\n tmp1=-1\n tmp1_keta=-1\n if(i-num[j]>=0):\n if(dp[i-num[j]]>0):\n tmp1=dp[i-num[j]]+j*(10**keta[i-num[j]])\n tmp1_keta=keta[i-num[j]]+1\n elif(dp[i-num[j]]==0):\n tmp1=j\n tmp1_keta=1\n\n if(tmp1>tmp):\n tmp=tmp1\n tmp_keta=tmp1_keta\n \n dp.append(tmp)\n keta.append(tmp_keta)\nprint(dp[N])']
['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s069023913', 's122732102', 's287261827', 's982051814', 's962794254']
[14664.0, 2940.0, 11044.0, 14176.0, 15088.0]
[2104.0, 17.0, 2104.0, 2104.0, 1031.0]
[639, 694, 468, 498, 1033]
p03128
u853952087
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, respectively.
["a,b=list(map(int,input().split()))\nX={1:2,2:5,3:5,4:4,5:5,6:6,7:3,8:7,9:6}\nA=list(map(int,input().split()))\nB=[v for k,v in X.items() if k in A]\nprint(B)\nDP=[0]+[[] for i in range(10**4+1)]\nL=[[] for i in range(10**4+1)]\nfor i in range(10):\n if i in B:\n DP[i]=1\n L[i].append(i)\n#print(DP)\nfor i in range(1,10**4+1):\n if [DP[i-j] for j in B if i-j>=0 and not DP[i-j]==[]]==[]:\n DP[i]=[]\n else:\n# print(i,[DP[i-j] for j in B if i-j>=0 and not DP[i-j]==[]])\n M=[DP[i-j] for j in B if i-j>=0 and not DP[i-j]==[]]\n DP[i]=max([DP[i-j] for j in B if i-j>=0 and not DP[i-j]==[]])+1\n l=[0]\n for t in B:\n if not DP[i-t]==[] and DP[i]==DP[i-t]+1:\n l=l+[k for k,v in X.items() if v==t and k in A]\n L[i]=L[i-t]+[max(l)]\nL[a].sort(reverse=True)\ns='0'\nfor i in L[a]:\n s+=str(i)\nprint(int(s))", "a,b=list(map(int,input().split()))\nX={1:2,2:5,3:5,4:4,5:5,6:6,7:3,8:7,9:6}\nA=list(map(int,input().split()))\nB=[v for k,v in X.items() if k in A]\n\nDP=[0]+[[] for i in range(10**4+1)]\nL=[[] for i in range(10**4+1)]\nfor i in range(10):\n if i in B:\n DP[i]=1\n L[i].append(i)\n#print(DP)\nfor i in range(1,10**4+1):\n if [DP[i-j] for j in B if i-j>=0 and not DP[i-j]==[]]==[]:\n DP[i]=[]\n else:\n# print(i,[DP[i-j] for j in B if i-j>=0 and not DP[i-j]==[]])\n M=[DP[i-j] for j in B if i-j>=0 and not DP[i-j]==[]]\n DP[i]=max([DP[i-j] for j in B if i-j>=0 and not DP[i-j]==[]])+1\n l=[0]\n for t in B:\n if not DP[i-t]==[] and DP[i]==DP[i-t]+1:\n l=l+[k for k,v in X.items() if v==t and k in A]\n L[i]=L[i-t]+[max(l)]\nL[a].sort(reverse=True)\ns='0'\nfor i in L[a]:\n s+=str(i)\nprint(int(s))"]
['Wrong Answer', 'Accepted']
['s538421327', 's559429866']
[248692.0, 248692.0]
[714.0, 722.0]
[885, 886]
p03128
u859897687
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, respectively.
['nn=[[1,2],[7,3],[4,4],[5,5],[3,5],[2,5],[9,6],[6,6],[8,7]]\nn,m=map(int,input().split())\na=input().split()\nfor i in range(m):\n a[i]=int(a[i])\nb=[]\nfor i in range(9):\n if nn[i][0] in a:\n b.append(nn[i])\n \nc=[b[0]]\ndel b[0]\nfor i in range(len(b)):\n t=0\n for j in range(len(c)):\n if b[i][1] == c[j][1]:\n t=1\n break\n if t==1:\n continue\n c.append(b[i])\n \nt=n//c[0][1]\nn-=c[0][1]*t\na=c[0]\ndel c[0]\nfor i in range(len(c)):\n c[i][1]-=a[1]\n\nans=""\nwhile c[0][1] <= n:\n for i in range(len(c)):\n i=len(c)-1-i\n if c[i][1]<=n:\n ans+=str(c[i][0])\n n-=c[i][1]\n t-=1\n break\n \nans+=str(a[0])*t\nprint(ans)', 'nn=[2,5,5,4,5,6,3,7,6]\nn,m=map(int,input().split())\na=input().split()\nb=[]\nfor i in range(m):\n a[i]=int(a[i])\n \nif 5 in a:\n if 2 in a:\n a.remove(2)\n if 3 in a:\n a.remove(3)\nelif 3 in a:\n if 2 in a:\n a.remove(2)\nif 9 in a:\n if 6 in a:\n a.remove(6)\n \na.sort(reverse=True)\nfor i in range(len(a)):\n b.append(nn[a[i]-1])\n \ndp=[-10*18 for _ in range(n)]\ndp[0]=0\nfor i in range(n):\n for j in range(len(b)):\n if i+b[j]>n-1:\n continue\n dp[i+b[j]]=max(dp[i+b[j]],dp[i]+1)\n \nk=dp[n-1]\nans=""\nfor i in range(k):\n for j in range(len(b)):\n if dp[n-1-b[j]]==dp[n-1]-1:\n ans+=str(a[j])\n n-=b[j];\n break\n \nprint(ans)\n\n', 'nn=[2,5,5,4,5,6,3,7,6]\nn,m=map(int,input().split())\na=input().split()\nb=[]\nfor i in range(m):\n a[i]=int(a[i])\n \nif 5 in a:\n if 2 in a:\n a.remove(2)\n if 3 in a:\n a.remove(3)\nelif 3 in a:\n if 2 in a:\n a.remove(2)\nif 9 in a:\n if 6 in a:\n a.remove(6)\n \na.sort(reverse=True)\nfor i in range(len(a)):\n b.append(nn[a[i]-1])\n \ndp=[-10*18 for _ in range(n+1)]\ndp[0]=0\nfor i in range(n):\n for j in range(len(b)):\n if i+b[j]>n:\n continue\n dp[i+b[j]]=max(dp[i+b[j]],dp[i]+1)\n \nk=dp[n]\nans=""\nfor i in range(k):\n for j in range(len(b)):\n if n-b[j]<0:\n continue\n if dp[n-b[j]]==dp[n]-1:\n ans+=str(a[j])\n n-=b[j]\n break\n \nprint(ans)\n\n']
['Runtime Error', 'Wrong Answer', 'Accepted']
['s134354726', 's366902249', 's186343374']
[3064.0, 3416.0, 3432.0]
[17.0, 75.0, 76.0]
[646, 663, 688]
p03128
u864013199
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, respectively.
['N,M = map(int,input().split())\nA = list(map(int,input().split()))\nA.sort()\nINF = float("inf")\nnum = [INF,2,5,5,4,5,6,3,7,6]\nif N==2, and M==9:\n print(1)\n exit()\n\ndp = [0]+[-INF]*N\n\nfor i in range(1,N+1):\n ins = -INF\n for a in A:\n try:\n tmp = dp[i-num[a]]+1\n ins = max(ins,tmp)\n except:\n continue\n dp[i] = ins\n\n\nA.sort(reverse=True)\ndigit = ["0"]*dp[N]\nmat = 0\nfor i in range(dp[N]):\n for a in A:\n try:\n t1 = dp[N-mat-num[a]]\n t2 = dp[N-mat]-1\n except:\n continue\n if t1 == t2:\n digit[i] = str(a)\n mat += num[a]\n break\nprint("".join(digit))\n', 'N,M = map(int,input().split())\nA = list(map(int,input().split()))\nA.sort()\nINF = float("inf")\nnum = [INF,2,5,5,4,5,6,3,7,6]\nif N,M = 2,9:\n print(1)\n exit()\n\ndp = [0]+[-INF]*N\n\nfor i in range(1,N+1):\n ins = -INF\n for a in A:\n try:\n tmp = dp[i-num[a]]+1\n ins = max(ins,tmp)\n except:\n continue\n dp[i] = ins\n\n\nA.sort(reverse=True)\ndigit = ["0"]*dp[N]\nmat = 0\nfor i in range(dp[N]):\n for a in A:\n try:\n t1 = dp[N-mat-num[a]]\n t2 = dp[N-mat]-1\n except:\n continue\n if t1 == t2:\n digit[i] = str(a)\n mat += num[a]\n break\nprint("".join(digit))\n', 'N,M = map(int,input().split())\nA = list(map(int,input().split()))\nA.sort()\nINF = float("inf")\nnum = [INF,2,5,5,4,5,6,3,7,6]\nif N==2 and M==9:\n print(1)\n exit()\n\ndp = [0]+[-INF]*N\n\nfor i in range(1,N+1):\n ins = -INF\n for a in A:\n try:\n tmp = dp[i-num[a]]+1\n ins = max(ins,tmp)\n except:\n continue\n dp[i] = ins\n\n\nA.sort(reverse=True)\ndigit = ["0"]*dp[N]\nmat = 0\nfor i in range(dp[N]):\n for a in A:\n try:\n t1 = dp[N-mat-num[a]]\n t2 = dp[N-mat]-1\n except:\n continue\n if t1 == t2:\n digit[i] = str(a)\n mat += num[a]\n break\nprint("".join(digit))\n']
['Runtime Error', 'Runtime Error', 'Accepted']
['s535264719', 's653833227', 's042417267']
[3064.0, 2940.0, 3688.0]
[17.0, 17.0, 79.0]
[740, 735, 739]
p03128
u864197622
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, respectively.
['def intlog10(n):\n if n <= 0:\n return -1\n i = 0\n while 10**i <= n:\n i += 1\n return i-1\n\nN, M = map(int, input().split())\nA = [int(a) for a in input().split()]\nif True:\n N = 10000\n M = 9\n A = [1, 2, 3, 4, 5, 6, 7, 8, 9]\n \nL = [2, 5, 5, 4, 5, 6, 3, 7, 6]\nB = [[A[i], L[A[i]-1]] for i in range(M)]\n\n\n\nbest = sorted(B, key = lambda x: x[1]*10-x[0])[0]\n\nadj = 0\nif N > 500:\n adj = (N - 500)//best[1]\n N -= best[1] * adj\n\n\n\n# print(best)\nX = [0] + [-10**9] * N\nbpre = -1\nll = 1\nfor i in range(1, N+1):\n if i > 50 and i < N-50:\n X[i] = X[i-best[1]]*10 + best[0]\n else:\n for b in B:\n if b[1] <= i:\n if X[i-b[1]] == 0:\n if b[0] > X[i]:\n X[i] = b[0]\n bpre = b\n ll = 0\n else:\n if X[i-b[1]]*10 + b[0] < X[i-b[1]] + b[0] * (10**intlog10(X[i-b[1]])):\n lll = 1\n\n if max(X[i-b[1]]*10 + b[0], X[i-b[1]] + b[0] * (10**intlog10(X[i-b[1]]))) > X[i]:\n X[i] = max(X[i-b[1]]*10 + b[0], X[i-b[1]] + b[0] * (10**intlog10(X[i-b[1]])))\n ll = lll\n bpre = b\n \n\nans = str(X[N])\nif adj > 0:\n ans = ans[:50] + str(best[0]) * adj + ans[50:]\n\nprint(ans)\n# print(len(ans))', 'N, M = map(int, input().split())\nA = [int(a) for a in input().split()] \nL = [2, 5, 5, 4, 5, 6, 3, 7, 6]\nB = [[A[i], L[A[i]-1]] for i in range(M)]\n\nX = [0] + [-1] * N\nfor i in range(1, N+1):\n for b in B:\n if b[1] <= i:\n X[i] = max(X[i], X[i-b[1]]*10 + b[0])\n\nprint(X[N])']
['Wrong Answer', 'Accepted']
['s479391897', 's856525665']
[3192.0, 14516.0]
[157.0, 146.0]
[1377, 293]
p03128
u892251744
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, respectively.
['N,M=map(int, input().split())\nA=list(map(int, input().split()))\ninf = float(\'inf\')\n\nnumber = [6,2,5,5,4,5,6,3,7,6]\n\n\ndp = [-1*inf]*(N+1)\ndp[0] = 0\nfor i in range(1,N+1):\n dp_new = 0\n for j in A:\n if i - number[j] >= 0:\n if dp[i-number[j]] +1 > dp_new:\n dp[i] = dp[i-number[j]] +1\n\nA.sort(reverse=True)\nans = ""\nwhile N > 0:\n for j in A:\n if dp[N] == dp[N-number[j]] + 1:\n ans += str(j)\n N -= number[j]\n break\n\nprint(int(ans))', 'import sys\nimport math\nimport copy\n\ninput = sys.stdin.readline\nN,M=map(int,input().split())\nA=list(map(int, input().split()))\n\nmatch_num=[6,2,5,5,4,5,6,3,7,6]\nuse_A_dict = {}\nfor a in A:\n if a in use_A_dict.values():\n use_A_dict[match_num[a]] = max(a,use_A_dict[match_num[a]])\n else:\n use_A_dict[match_num[a]] = a\n\nmatch = list(use_A_dict.keys())\nmatch.sort()\nnumber = [use_A_dict[m] for m in match]\nuse_num = [0]*len(number)\ncurrent_use_num = [-1]*len(number)\nuse_num_cand = []\nN_left = N\nindex = -1\nuse_num_sum = 0\nfinish_flag = 0\nwhile finish_flag == 0:\n index += 1\n if index < len(number):\n use_num[index] = math.floor(N_left/match[index])\n N_left = N_left % match[index]\n if N_left == 0:\n if use_num_sum <= sum(use_num):\n if use_num != current_use_num:\n use_num_cand.append(copy.deepcopy(use_num))\n use_num_sum = sum(use_num)\n current_use_num = copy.deepcopy(use_num)\n else:\n finish_flag = 1\n else:\n index -= 1\n while use_num[index] == 0:\n if index != 0:\n index -= 1\n else:\n finish_flag = 1\n break\n use_num[index] -= 1\n N_left += match[index]\n\nans_cand = []\nans_list = []\nprint(use_num_cand)\nfor j in range(len(use_num_cand)):\n ans_list = []\n for i in range(len(number)):\n ans_list.extend([number[i]]*use_num_cand[j][i])\n ans_list.sort(reverse=True)\n ans = ""\n for i in ans_list:\n ans += str(i)\n ans_cand.append(int(ans))\nprint(max(ans_cand))', 'N,M=map(int, input().split())\nA=list(map(int, input().split()))\ninf = float(\'inf\')\n\nnumber = [6,2,5,5,4,5,6,3,7,6]\n\n\ndp = [-1*inf]*(N+1)\ndp[0] = 0\nfor i in range(1,N+1):\n dp_new = 0\n for j in A:\n if i - number[j] >= 0:\n if dp[i-number[j]] +1 > dp_new:\n dp[i] = dp[i-number[j]] +1\n dp_new = dp[i]\n\nA.sort(reverse=True)\nans = ""\nwhile N > 0:\n for j in A:\n if N - number[j] >= 0:\n if dp[N] == dp[N-number[j]] + 1:\n ans += str(j)\n N -= number[j]\n break\n\nprint(int(ans))']
['Runtime Error', 'Wrong Answer', 'Accepted']
['s505750604', 's579991701', 's014687350']
[3364.0, 3540.0, 3348.0]
[62.0, 25.0, 67.0]
[461, 1473, 519]
p03128
u894258749
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, respectively.
["import numpy as np\n\ncosts=np.array([6,2,5,5,4,5,6,3,7,6],dtype=np.int)\n\n(N,M) = map(int,input().split())\nA = np.array(list(map(int,input().split())))\n\ncost_table = np.vstack((costs[A],A)).transpose()\ntb1=np.array(sorted(list(cost_table),key=lambda x:(x[0],-x[1])))\ntb2=np.array(sorted(list(cost_table),key=lambda x:(-x[1],x[0])))\n\nc = tb1[0,0]\nd = tb1[0,1]\ntb1[:,0] -= c\ntb2[:,0] -= c\n\nn = N // c\nr = N % c\n\ndd = np.ones(n,dtype=np.int)*d\n\nupperlist=[]\nlowerlist=[]\nwhile r > 0:\n k = np.where(tb2[:,0] <= r)[0][0]\n if tb2[k,1] > d:\n upperlist.append(tb2[k,1])\n r -= tb2[k,0]\n else:\n k = np.where(tb1[:,0] <= r)[0][-1]\n lowerlist.append(tb1[k,1])\n r -= tb1[k,0]\n\nfor u in upperlist:\n print(u,end='')\nfor i in range(n-len(lowerlist)-len(upperlist)):\n print(dd[i],end='')\nfor u in lowerlist:\n print(u,end='')\n", 'import numpy as np\n\n(N,M) = map(int,input().split())\nA = list(map(int,input().split()))\ncosts = [0,2,5,5,4,5,6,3,7,6]\n\nmatch = [-1]*(N+1)\nmatch[0] = 0\nfor i in range(1,N+1):\n for a in A:\n if i < costs[a]:\n continue\n else:\n match[i] = max(match[i],match[i-costs[a]]*10+a)\n\nprint(match[N])']
['Wrong Answer', 'Accepted']
['s047665456', 's037393835']
[18152.0, 23352.0]
[2109.0, 281.0]
[859, 304]
p03128
u905582793
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, respectively.
['n,m=map(int,input().split())\na=list(map(int,input().split()))\nb=[0,2,5,5,4,5,6,3,7,6]\nwv=[]\nfor i in a:\n wv.append((b[i],i))\nwv.sort()\ndp=[-1 for i in range(n+1)]\ndp[0]=0\nfor i in range(1,n+1):\n for w,v in wv:\n if dp[i-w]==-1:\n continue\n dp[i]=max(dp[i],dp[i-w]*10+v)', 'n,m=map(int,input().split())\na=list(map(int,input().split()))\nb=[0,2,5,5,4,5,6,3,7,6]\nwv=[]\nfor i in a:\n wv.append((b[i],i))\nwv.sort()\ndp=[-1 for i in range(n+1)]\ndp[0]=0\nfor i in range(1,n+1):\n for w,v in wv:\n if i-w<0:\n continue\n if dp[i-w]==-1:\n continue\n dp[i]=max(dp[i],dp[i-w]*10+v)\nprint(dp[n])']
['Runtime Error', 'Accepted']
['s186477749', 's963705121']
[14388.0, 14516.0]
[145.0, 160.0]
[280, 322]
p03128
u916908463
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, respectively.
['import time\nn, m = map(int, input().split())\nnumbers = list(map(int, input().split()))\ncosts = [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 numbers:\n if i-costs[x] >= 0:\n f[i] = max(f[i], f[i-costs[x]]*10+x)\nprint(f)', 'import time\nn, m = map(int, input().split())\nnumbers = list(map(int, input().split()))\ncosts = [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 numbers:\n if i-costs[x] >= 0:\n f[i] = max(f[i], f[i-costs[x]]*10+x)\nprint(f[n])']
['Wrong Answer', 'Accepted']
['s073987973', 's489049547']
[87904.0, 14448.0]
[1510.0, 148.0]
[272, 275]
p03128
u919127329
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, respectively.
['#python3.4\nimport math\ndef inpul(): return list(map(int, input().split()))\n\nN, M = inpul()\nA = inpul()\n\nc = [0,2,5,5,4,5,6,3,7,6]\nf = [-1]*10010\n\nf[0] = 0\nfor i in range(1, N+1):\n\tfor x in a:\n\t\tif i-c[x] >= 0:\n\t\t\tf[i] = max(f[i], f[i-c[x]]*10+x)\nprint(f[n])', '#python3.4\nimport math\ndef inpul(): return list(map(int, input().split()))\n\nN, M = inpul()\nA = inpul()\n\nc = [0,2,5,5,4,5,6,3,7,6]\nf = [-1]*10010\n\nf[0] = 0\nfor i in range(1, N+1):\n\tfor x in A:\n\t\tif i-c[x] >= 0:\n\t\t\tf[i] = max(f[i], f[i-c[x]]*10+x)\nprint(f[N])\n']
['Runtime Error', 'Accepted']
['s335270069', 's019664710']
[3064.0, 14444.0]
[18.0, 156.0]
[257, 258]
p03128
u919730120
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, respectively.
['def main():\n n,m=map(int,input().split())\n a=list(map(int,input().split()))\n a.sort(reverse=True)\n cost=[0,2,5,5,4,5,6,3,7,6]\n dp=[-2*n]*(n+10)\n dp[0]=0\n ans=[]\n for i in range(1,n+1):\n for j in cost:\n if i>=j:\n dp[i]=max(dp[i],dp[i-j]+1)\n cnt=n\n while cnt:\n for j in a:\n if cnt>=j and dp[cnt-cost[j]]==dp[cnt]-1:\n ans.append(j)\n cnt-=cost[j]\n break\n for j in ans:\n print(j, end="")\n print("")\n\nif __name__ == \'__main__\':\n main()', 'n,m=map(int,input().split())\na=list(map(int,input().split()))\na.sort(reverse=True)\ncost=[0,2,5,5,4,5,6,3,7,6]\ndp=[-2*n]*(n+10)\ndp[0]=0\nans=[]\nfor i in range(1,n+1):\n for j in cost:\n if i>=j:\n dp[i]=max(dp[i],dp[i-j]+1)\ncnt=n\nwhile cnt:\n for j in a:\n if cnt>=j and dp[cnt-cost[j]]==dp[cnt]-1:\n ans.append(j)\n cnt-=cost[j]\n break\nfor j in ans:\n print(j, end="")\nprint("")', "def main():\n n,m=map(int,input().split())\n a=list(map(int,input().split()))\n a.sort(reverse=True)\n cost=[0,2,5,5,4,5,6,3,7,6]\n dp=[-2*n]*(n+10)\n dp[0]=0\n ans=[]\n for i in range(1,n+1):\n for j in cost:\n if i>=j:\n dp[i]=max(dp[i],dp[i-j]+1)\n cnt=n\n while cnt:\n for j in a:\n if cnt>=j and dp[cnt-cost[j]]==dp[cnt]-1:\n ans.append(j)\n cnt-=cost[j]\n break\n print(''.join(map(str,ans)))\n\nif __name__ == '__main__':\n main()", 'n,m=map(int,input().split())\na=list(map(int,input().split()))\na.sort(reverse=True)\ncost=[0,2,5,5,4,5,6,3,7,6]\ndp=[-2*n]*(n+10)\ndp[0]=0\nans=[]\nfor i in range(1,n+1):\n for j in cost:\n if i>=j:\n dp[i]=max(dp[i],dp[i-j]+1)\ncnt=n\nwhile cnt:\n for j in a:\n if cnt>=j and dp[cnt-cost[j]]==dp[cnt]-1:\n ans.append(j)\n cnt-=cost[j]\n break\nfor j in ans:\n print(j, end="")\n print("")', "def main():\n n,m=map(int,input().split())\n a=list(map(int,input().split()))\n a.sort(reverse=True)\n c=[0,2,5,5,4,5,6,3,7,6]\n cost=[0]*m\n for i,x in enumerate(a):\n cost[i]=c[x]\n dp=[0]*(n+10)\n ans=[]\n for i in range(n+1):\n for j in cost:\n dp[i+j]=max(dp[i]+1,dp[i+j])\n cnt=n\n while cnt>0:\n for i,j in enumerate(cost):\n if cnt>=j and dp[cnt-j]==dp[cnt]-1:\n ans.append(a[i])\n cnt-=j\n break\n print(''.join(map(str,ans)))\n\nif __name__ == '__main__':\n main()", 'def main():\n n,m=map(int,input().split())\n a=list(map(int,input().split()))\n a.sort(reverse=True)\n cost=[0,2,5,5,4,5,6,3,7,6]\n dp=[-n-n]*(n+1)\n dp[0]=0\n ans=[]\n for i in range(1,n+1):\n for j in a:\n if i>=cost[j]:\n dp[i]=max(dp[i],dp[i-cost[j]]+1)\n cnt=n\n while cnt:\n for j in a:\n if cnt>=cost[j] and dp[cnt-cost[j]]==dp[cnt]-1:\n ans.append(j)\n cnt-=cost[j]\n break\n for j in ans:\n print(j, end="")\n print("")\n\nif __name__ == \'__main__\':\n main()']
['Wrong Answer', 'Time Limit Exceeded', 'Time Limit Exceeded', 'Wrong Answer', 'Time Limit Exceeded', 'Accepted']
['s052335625', 's197063346', 's828208552', 's838635988', 's960270088', 's952285962']
[4848.0, 4208.0, 3696.0, 4848.0, 3756.0, 4108.0]
[2104.0, 2104.0, 2108.0, 2104.0, 2104.0, 58.0]
[575, 436, 547, 440, 578, 585]
p03128
u924770834
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, respectively.
['\n\n\ndef solve():\n\t\n\tnum = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6]\n\tN, M = map(int, input().split())\n\tA = [int(i) for i in input().split()]\n\tA.sort(reverse=True)\n\t\n\t\n\tdp = [-1 * float("inf")] * (N + 1)\n\n\t\n\tdp[0] = 0\n\tfor n in range(1, N + 1):\n\t\tfor a in A:\n\t\t\tif n - num[a] >= 0:\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\tdp[n] = max(dp[n], dp[n - num[a]] + 1)\n\tprint(\'各本数丁度で作れる最大桁数\')\n\tprint(dp)\n\n\t\n\tans = \'\'\n\tfor i in range(dp[N]): \n\t\tfor a in A:\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\tif N - num[a] > -1 and dp[N] - 1 == dp[N - num[a]]:\n\t\t\t\tans += str(a)\n\t\t\t\tN -= num[a]\n\t\t\t\tbreak\n\t\t\n\n\tprint(ans)\n\n\nif __name__ == \'__main__\':\n\tsolve()\n', '\n\n\ndef solve():\n\t\n\tnum = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6]\n\tN, M = map(int, input().split())\n\tA = [int(i) for i in input().split()]\n\tA.sort(reverse=True)\n\t\n\t\n\tdp = [-1 * float("inf")] * (N + 1)\n\n\t\n\tdp[0] = 0\n\tfor n in range(1, N + 1):\n\t\tfor a in A:\n\t\t\tif n - num[a] >= 0:\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\tdp[n] = max(dp[n], dp[n - num[a]] + 1)\n\n\t\n\tans = \'\'\n\tfor i in range(dp[N]): \n\t\tfor a in A:\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\tif N - num[a] > -1 and dp[N] - 1 == dp[N - num[a]]:\n\t\t\t\tans += str(a)\n\t\t\t\tN -= num[a]\n\t\t\t\tbreak\n\t\t\n\n\tprint(ans)\n\n\nif __name__ == \'__main__\':\n\tsolve()\n']
['Wrong Answer', 'Accepted']
['s900746583', 's106659015']
[3564.0, 3312.0]
[62.0, 62.0]
[1826, 1765]
p03128
u938486382
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, respectively.
["l = list(map(int, input().split(' ')))\nd = {} # key=match, val=num\nd[2] = [1]\nd[3] = [7]\nd[4] = [4]\nd[5] = [5, 3, 2]\nd[6] = [9, 6]\nd[7] = [8]\nenable = [False] * 10\nfor a in l:\n enable[a] = True\nmemo = {}\n\ndef f(nokori, current):\n k = (nokori, current)\n if k in memo:\n return memo[k]\n if nokori <= 0:\n return current if nokori == 0 else -1\n temps = []\n for key, nums in list(d.items())[::-1]:\n for num in nums:\n if enable[num]:\n temps.append(f(nokori-key, current*10+num))\n break\n memo[k] = max(temps)\n return memo[k]\n \n\nhoge = False\nfor key, nums in list(d.items()):\n for num in nums:\n if enable[num]:\n hoge = True\n break\n if hoge:\n break\ncs = []\nwhile n > 50:\n n -= key\n cs.append(str(num))\n\n\nans = str(f(n, 0))\nprint(''.join(sorted(list(ans) + cs)[::-1]))", "n, m = list(map(int, input().split(' ')))\nl = list(map(int, input().split(' ')))\nd = {} # key=match, val=num\nd[2] = [1]\nd[3] = [7]\nd[4] = [4]\nd[5] = [5, 3, 2]\nd[6] = [9, 6]\nd[7] = [8]\nenable = [False] * 10\nfor a in l:\n enable[a] = True\n\ndef f(nokori, current):\n if nokori == 0:\n return current\n if nokori < 0:\n return -1\n temps = []\n for key, nums in list(d.items())[::-1]:\n for num in nums:\n if enable[num]:\n if nokori-key != 0 and current % 10 != 0 and current % 10 < num:\n \n continue\n temps.append(f(nokori-key, current*10+num))\n break\n return max(temps)\n\n\ndef hoge():\n for key, nums in list(d.items()):\n for num in nums:\n if enable[num]:\n return (num, key)\nnum, key = hoge()\ncs = []\nwhile n > 50:\n n -= key\n cs.append(str(num))\n\n\nnum_ans = str(f(n, 0))\nprint(''.join(sorted(list(num_ans) + cs)[::-1]))\n"]
['Runtime Error', 'Accepted']
['s957821314', 's476249797']
[3064.0, 3444.0]
[17.0, 198.0]
[1116, 1236]
p03128
u945181840
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, respectively.
["N, M = map(int, input().split())\nA = list(map(int, input().split()))\nA.sort(reverse=True)\n\ntable = {1: 2, 2: 5, 3: 5, 4: 4, 5: 5, 6: 6, 7: 3, 8: 7, 9: 6}\na = [table[i] for i in A]\n\n\nINF = float('inf')\ndp = [-INF] * (N + 1)\ndp[0] = 0\ncost = set(a)\n\nfor i in range(1, N + 1):\n for j in cost:\n if i - j >= 0 and dp[i] < dp[i - j] + 1:\n dp[i] = dp[i - j] + 1\n\nanswer = []\nfor i in A:\n x = table[i]\n if N - x >= 0 and dp[N] == dp[N - x] + 1:\n answer.append(i)\n N -= x\n\nprint(''.join(map(str, answer)))", "N, M = map(int, input().split())\nA = list(map(int, input().split()))\nA.sort(reverse=True)\n\ntable = {1: 2, 2: 5, 3: 5, 4: 4, 5: 5, 6: 6, 7: 3, 8: 7, 9: 6}\na = [table[i] for i in A]\n\n\nINF = float('inf')\ndp = [-INF] * (N + 1)\ndp[0] = 0\ncost = set(a)\n\nfor i in range(1, N + 1):\n for j in cost:\n if i - j >= 0 and dp[i] < dp[i - j] + 1:\n dp[i] = dp[i - j] + 1\n\nanswer = []\nfor i in A:\n x = table[i]\n while N - x >= 0 and dp[N] == dp[N - x] + 1:\n answer.append(i)\n N -= x\n\nprint(''.join(map(str, answer)))"]
['Wrong Answer', 'Accepted']
['s505961483', 's443998770']
[3384.0, 3676.0]
[37.0, 43.0]
[639, 642]
p03128
u945228737
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, respectively.
['\n\n\ndef solve():\n \n num = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6]\n N, M = map(int, input().split())\n A = [int(i) for i in input().split()]\n A.sort(reverse=True)\n \n \n dp = [-1 * float("inf")] * (N + 1)\n\n \n for n in range(1, N + 1):\n for a in A:\n if n - num[a] >= 0:\n \n \n \n dp[n] = max(dp[n], dp[n - num[a]] + 1)\n \n # print(dp)\n\n \n ans = \'\'\n for i in range(dp[N]): \n for a in A:\n \n \n \n \n \n \n \n \n if N - num[a] > -1 and dp[N] - 1 == dp[N - num[a]]:\n ans += str(a)\n N -= num[a]\n break\n \n\n print(ans)\n\n\nif __name__ == \'__main__\':\n solve()\n', '\n\n\ndef solve():\n \n num = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6]\n N, M = map(int, input().split())\n A = [int(i) for i in input().split()]\n A.sort(reverse=True)\n \n \n dp = [-1 * float("inf")] * (N + 1)\n\n \n dp[0] = 0\n for n in range(1, N + 1):\n for a in A:\n if n - num[a] >= 0:\n \n \n \n dp[n] = max(dp[n], dp[n - num[a]] + 1)\n \n # print(dp)\n\n \n ans = \'\'\n for i in range(dp[N]): \n for a in A:\n \n \n \n \n \n \n \n \n if N - num[a] > -1 and dp[N] - 1 == dp[N - num[a]]:\n ans += str(a)\n N -= num[a]\n break\n \n\n print(ans)\n\n\nif __name__ == \'__main__\':\n solve()\n']
['Runtime Error', 'Accepted']
['s934603439', 's145907252']
[3188.0, 3312.0]
[57.0, 62.0]
[2062, 2076]
p03128
u955251526
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, respectively.
["def inv(x, ava):\n if x == 2:\n if 1 in ava:\n return 1\n else:\n return -1\n if x == 3:\n if 7 in ava:\n return 7\n else:\n return -1\n if x == 4:\n if 4 in ava:\n return 4\n else:\n return -1\n if x == 5:\n if 5 in ava:\n return 5\n if 3 in ava:\n return 3\n if 2 in ava:\n return 2\n else:\n return -1\n if x == 6:\n if 9 in ava:\n return 9\n if 6 in ava:\n return 6\n else:\n return -1\n if x == 7:\n if 8 in ava:\n return 8\n else:\n return -1\nn, m = map(int, input().split())\nava = list(map(int, input().split()))\ndp = [[] for _ in range(n+1)]\nnumber = [inv(x,ava) for x in range(2,8)]\navapre = []\nfor i in range(6):\n if number[i] != -1:\n avapre.append(i+2)\navapresort = sorted(key = lambda x: number[x-2], avapre)\ndp = [0 for _ in range(n+1)]\nfor i in range(1, n+1):\n if i < avapre[0]:\n dp[i] = -1\n else:\n dp[i] = -1\n for pre in avapre:\n if i - pre >= 0:\n dp[i] = max(dp[i], dp[i-pre]+1)\ni = n\nwhile(i > 0):\n for pre in avapresort:\n if i - pre >= 0 and dp[i] == dp[i-pre] + 1:\n print(number[pre-2], end='')\n i -= pre\n break\nprint()\n", "def inv(x, ava):\n if x == 2:\n if 1 in ava:\n return 1\n else:\n return -1\n if x == 3:\n if 7 in ava:\n return 7\n else:\n return -1\n if x == 4:\n if 4 in ava:\n return 4\n else:\n return -1\n if x == 5:\n if 5 in ava:\n return 5\n if 3 in ava:\n return 3\n if 2 in ava:\n return 2\n else:\n return -1\n if x == 6:\n if 9 in ava:\n return 9\n if 6 in ava:\n return 6\n else:\n return -1\n if x == 7:\n if 8 in ava:\n return 8\n else:\n return -1\nn, m = map(int, input().split())\nava = list(map(int, input().split()))\ndp = [[] for _ in range(n+1)]\nnumber = [inv(x,ava) for x in range(2,8)]\navapre = []\nfor i in range(6):\n if number[i] != -1:\n avapre.append(i+2)\navapresort = sorted(avapre,key = lambda x: number[x-2])\ndp = [0 for _ in range(n+1)]\nfor i in range(1, n+1):\n if i < avapre[0]:\n dp[i] = -1\n else:\n dp[i] = -1\n for pre in avapre:\n if i - pre >= 0:\n dp[i] = max(dp[i], dp[i-pre]+1)\ni = n\nwhile(i > 0):\n for pre in avapresort:\n if i - pre >= 0 and dp[i] == dp[i-pre] + 1:\n print(number[pre-2], end='')\n i -= pre\n break\nprint()\n", "def inv(x, ava):\n if x == 2:\n if 1 in ava:\n return 1\n else:\n return -1\n if x == 3:\n if 7 in ava:\n return 7\n else:\n return -1\n if x == 4:\n if 4 in ava:\n return 4\n else:\n return -1\n if x == 5:\n if 5 in ava:\n return 5\n if 3 in ava:\n return 3\n if 2 in ava:\n return 2\n else:\n return -1\n if x == 6:\n if 9 in ava:\n return 9\n if 6 in ava:\n return 6\n else:\n return -1\n if x == 7:\n if 8 in ava:\n return 8\n else:\n return -1\nn, m = map(int, input().split())\nava = list(map(int, input().split()))\ndp = [[] for _ in range(n+1)]\nnumber = [inv(x,ava) for x in range(2,8)]\navapre = []\nfor i in range(6):\n if number[i] != -1:\n avapre.append(i+2)\navapresort = sorted(avapre,key = lambda x: number[x-2],reverse=True)\ndp = [0 for _ in range(n+1)]\nfor i in range(1, n+1):\n if i < avapre[0]:\n dp[i] = -1\n else:\n dp[i] = -1\n for pre in avapre:\n if i - pre >= 0:\n dp[i] = max(dp[i], dp[i-pre]+1)\ni = n\nwhile(i > 0):\n for pre in avapresort:\n if i - pre >= 0 and dp[i] == dp[i-pre] + 1:\n print(number[pre-2], end='')\n i -= pre\n break\nprint()\n"]
['Runtime Error', 'Wrong Answer', 'Accepted']
['s263968631', 's842193201', 's145041593']
[3064.0, 4340.0, 4340.0]
[17.0, 2104.0, 67.0]
[1397, 1396, 1409]
p03128
u962197874
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, respectively.
['n_dic = {1:2,2:5,3:5,4:4,5:5,6:6,7:3,8:7,9:6}\nn,m = map(int,input().split())\nl = list(map(int,input().split()))\ndic = {}\nfor i in l:\n if n_dic[i] not in dic or dic[n_dic[i]] < i:\n dic[n_dic[i]] = i\nif n % min(dic) == 0:\n ans = str(dic[min(dic)]) * int(n / min(dic))\nelse:\n ans = str(dic[min(dic)]) * int(n / min(dic))\n sub = n - min(dic) * int(n / min(dic))\n ind = 0\n while sub > 0 and ind < len(ans):\n dif = 0\n v = int(ans[ind])\n for i in range(min(dic) + 1,min(dic) + sub + 1):\n if i in dic and int(dic[i]) > v:\n v = dic[i]\n dif = i - min(dic)\n sub -= dif\n ans = ans[:ind] + str(v) + ans[ind+1:]\n ind += 1\nprint(ans)', '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)\ndp = [0]+[-1]*n\nfor i in range(1,n+1):\n for j in a:\n if l[j] <= i:\n dp[i] = max(dp[i], dp[i-l[j]]*10+j)\nprint(dp[-1])']
['Wrong Answer', 'Accepted']
['s866562378', 's176040431']
[3192.0, 14692.0]
[30.0, 148.0]
[726, 255]
p03128
u979823197
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, respectively.
['N,M=map(int,input().split())\nnum={1:2,2:5,3:5,4:4,5:5,6:6,7:3,8:7,9:6}\nA=list(map(int,input().split()))\nA.sort(reverse = True)\ndp = [0]+[-1]*(N+1)\nfor i in range(N):\n for j in A:\n if i+num[j]<=N:\n dp[i+num[j]] = max(dp[i+num[j]],dp[i]+1)\nans = []\nm=N\nwhile m>0:\n for i in A:\n if m-num[i]>=0 and dp[m-num[i]==dp[m]-1:\n m-=num[i]\n ans.append(str(i))\n break\nprint("".join(ans))', "N,M=map(int,input().split())\nA=list(map(int,input().split()))\nA.sort(reverse=True)\nnumk={1:2,2:5,3:5,4:4,5:5,6:6,7:3,8:7,9:6}\ndp=[0]+[-float('inf')]*(N)\nfor i in range(N):\n for j in A:\n if i+numk[j]<=N:\n dp[i+numk[j]]=max(dp[i+numk[j]],dp[i]+1)\nm=N\nans=[]\nwhile m>0:\n for i in range(M):\n if dp[m-numk[A[i]]]+1==dp[m]:\n ans.append(A[i])\n m-=numk[A[i]]\nans.sort(reverse=True)\nfor i in range(len(ans)):\n ans[i]=str(ans[i])\na=''.join(ans)\nprint(a)", "N,M=map(int,input().split())\nA=list(map(int,input().split()))\nA.sort(reverse=True)\nnumk={1:2,2:5,3:5,4:4,5:5,6:6,7:3,8:7,9:6}\ndp=[0]+[-1]*(N+1)\nfor i in range(N):\n for j in A:\n if i+numk[j]<=N:\n dp[i+numk[j]]=max(dp[i+numk[j]],dp[i]+1)\nm=N\nans=[]\nwhile m>0:\n for i in A:\n if m-numk[i]>=0 and dp[m-numk[i]]+1==dp[m]:\n ans.append(str(i))\n m-=numk[i]\n break\nprint(''.join(ans))"]
['Runtime Error', 'Runtime Error', 'Accepted']
['s193971304', 's204532900', 's950815961']
[3064.0, 3696.0, 3696.0]
[17.0, 93.0, 96.0]
[438, 467, 438]
p03128
u989345508
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, respectively.
['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]])\nmi=a[0]\nfor i in range(1,m):\n if mi[1]>a[i][1] or (mi[1]==a[i][1] and a[i][0]>mi[0]):\n mi=a[i]\na=[a[i] for i in range(m) if a[i][0]>=mi[0]]\nm=len(a)\nb=sorted(a,key=lambda x:x[1])\nc=sorted(a,reverse=True)\nd1=n//mi[1]\nans=[mi[0]]*d1\nd2=n%mi[1]\nnow=0\nfor i in range(m-1):\n y=d2//(c[i][1]-mi[1])\n if y!=0:\n for j in range(now,now+y):\n ans[j]=c[i][0]\n now+=y\n d2-=(c[i][1]-mi[1])*y\n if d2==0:\n break\nprint(ans)', '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]])\nmi=a[0]\nfor i in range(1,m):\n if mi[1]>a[i][1] or (mi[1]==a[i][1] and a[i][0]>mi[0]):\n mi=a[i]\na=[a[i] for i in range(m) if a[i][0]>=mi[0]]\nm=len(a)\nb=sorted(a,key=lambda x:x[1])\nc=sorted(a,reverse=True)\nd1=n//mi[1]\nans=[mi[0]]*d1\nd2=n%mi[1]\nnow=0\nfor i in range(m-1):\n y=d2//(c[i][1]-mi[1])\n if y!=0:\n for j in range(now,now+y):\n ans[j]=c[i][0]\n now+=y\n d2-=(c[i][1]-mi[1])*y\n if d2==0:\n break\ncnt=0\nfor i in range(d1):\n cnt=cnt*10+ans[i]\nprint(cnt)', '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]])\na.sort(reverse=True)\ndp=[0]*(n+1)\nfor i in range(m):\n for j in range(n+1):\n if j==0 or dp[j]!=0:\n if j+a[i][1]<=n:\n dp[j+a[i][1]]=max(dp[j+a[i][1]],dp[j]*10+a[i][0])\nprint(dp[n])']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s193610790', 's293442677', 's366917288']
[3188.0, 3188.0, 16492.0]
[17.0, 22.0, 143.0]
[684, 732, 330]
p03128
u997521090
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, respectively.
['n,m,*a=map(int,open(0).read().split())\nd=[0]*n+[-1]*9\nfor i in range(n+1):d[i]=max(d[i-int("0255456376"[j])]*10+j for j in a)\nprint(d[n])', 'n,m,*a=map(int,open(0).read().split());d=[0]*n+[-1]*9\nfor i in range(n):d[i+1]=max(d[i-int("0144345265"[j])]*10+j for j in a)\nprint(d[n])']
['Wrong Answer', 'Accepted']
['s289993203', 's020972911']
[6580.0, 14388.0]
[55.0, 132.0]
[137, 137]
p03135
u201968280
2,000
1,048,576
In order to pass the entrance examination tomorrow, Taro has to study for T more hours. Fortunately, he can _leap_ to World B where time passes X times as fast as it does in our world (World A). While (X \times t) hours pass in World B, t hours pass in World A. How many hours will pass in World A while Taro studies for T hours in World B?
['a,b = int(input())\nprint("%.10f"%(a/b))', 'a,b = map(int,input().split())\nprint("%.10f"%(a/b))']
['Runtime Error', 'Accepted']
['s788983400', 's729670441']
[2940.0, 3316.0]
[17.0, 22.0]
[39, 51]
p03135
u407535999
2,000
1,048,576
In order to pass the entrance examination tomorrow, Taro has to study for T more hours. Fortunately, he can _leap_ to World B where time passes X times as fast as it does in our world (World A). While (X \times t) hours pass in World B, t hours pass in World A. How many hours will pass in World A while Taro studies for T hours in World B?
['all=input().split()\nT=all[0]\nX=all[1]\nround(T/X,10)', 'all=input().split()\nT=int(all[0])\nX=int(all[1])\nround(T/X,10)', 'all=input().split();T=int(all[0]);X=int(all[1]);print(str(round(T/X,10)))']
['Runtime Error', 'Wrong Answer', 'Accepted']
['s784613767', 's793994882', 's057253217']
[2940.0, 2940.0, 2940.0]
[17.0, 18.0, 17.0]
[51, 61, 73]
p03135
u416758623
2,000
1,048,576
In order to pass the entrance examination tomorrow, Taro has to study for T more hours. Fortunately, he can _leap_ to World B where time passes X times as fast as it does in our world (World A). While (X \times t) hours pass in World B, t hours pass in World A. How many hours will pass in World A while Taro studies for T hours in World B?
['a,b = (int(x) for x in input.split())\n \nprint(round((a/b),10))', 'a,b = [int(x) for x in input.split()]\n\nprint(round((a/b),10))', 'a,b = [int(x) for x in input().split()]\n \nprint(round((a/b),10))']
['Runtime Error', 'Runtime Error', 'Accepted']
['s182318617', 's922829628', 's866213965']
[2940.0, 2940.0, 3060.0]
[17.0, 17.0, 20.0]
[62, 61, 64]
p03135
u567847331
2,000
1,048,576
In order to pass the entrance examination tomorrow, Taro has to study for T more hours. Fortunately, he can _leap_ to World B where time passes X times as fast as it does in our world (World A). While (X \times t) hours pass in World B, t hours pass in World A. How many hours will pass in World A while Taro studies for T hours in World B?
['N, M = map(int,input().split())\na = list(map(int, input().split()))\na.sort()\n#print(a)\nif N > M:\n ans = 0\nelse:\n distance = [abs(a[i+1] - a[i]) for i in range(M-1)]\n #print(distance)\n distance.sort()\n #print(distance)\n del distance[M-N:]\n ans = 0 \n for j in distance:\n ans += j\nprint(ans)', 'T,x = map(int, input().split())\nprint(T,x)\nt = T/x\nprint(round(t,10))', 'T,x = map(int, input().split())\n#print(T,x)\nt = T/x\nprint(round(t,10))\n']
['Runtime Error', 'Wrong Answer', 'Accepted']
['s227287886', 's420820020', 's986907822']
[3060.0, 2940.0, 2940.0]
[18.0, 18.0, 18.0]
[319, 69, 71]
p03135
u578489732
2,000
1,048,576
In order to pass the entrance examination tomorrow, Taro has to study for T more hours. Fortunately, he can _leap_ to World B where time passes X times as fast as it does in our world (World A). While (X \times t) hours pass in World B, t hours pass in World A. How many hours will pass in World A while Taro studies for T hours in World B?
[" # -*- coding: utf-8 -*-\n import sys\n # ----------------------------------------------------------------\n # Use Solve Function\n \n def solve(lines):\n T,X = map(float, lines.pop(0).split(' '))\n print('{:.10f}'.format(T/X))\n #\n # main\n #\n \n # 1. use list instead of stdin\n \n # contents = '''\\\n # 99 1\\\n # '''\n \n \n # 2. use stdin\n \n lines = [x.strip() for x in sys.stdin.readlines()]\n \n #\n # solve !!\n #\n solve(lines)", "# -*- coding: utf-8 -*-\nimport sys\n# ----------------------------------------------------------------\n# Use Solve Function\n\ndef solve(lines):\n T,X = map(float, lines.pop(0).split(' '))\n print('{:.10f}'.format(T/X))\n#\n# main\n#\n\n# 1. use list instead of stdin\n\n# contents = '''\\\n# 99 1\\\n# '''\n\n\n# 2. use stdin\n\nlines = [x.strip() for x in sys.stdin.readlines()]\n\n#\n# solve !!\n#\nsolve(lines)"]
['Runtime Error', 'Accepted']
['s612496660', 's717862638']
[2940.0, 2940.0]
[18.0, 18.0]
[538, 424]
p03135
u599832028
2,000
1,048,576
In order to pass the entrance examination tomorrow, Taro has to study for T more hours. Fortunately, he can _leap_ to World B where time passes X times as fast as it does in our world (World A). While (X \times t) hours pass in World B, t hours pass in World A. How many hours will pass in World A while Taro studies for T hours in World B?
['x=input().slice()\na=int(x[0])\nb=int(x[1])\nresult=float(a/b)\nresult=round(result,10)\nprint(result)', 'x=input().split()\na=int(x[0])\nb=int(x[1])\nresult=float(a/b)\nresult=round(result,10)\nprint(result)\n']
['Runtime Error', 'Accepted']
['s668804871', 's018537338']
[2940.0, 3064.0]
[17.0, 18.0]
[97, 98]
p03135
u861077506
2,000
1,048,576
In order to pass the entrance examination tomorrow, Taro has to study for T more hours. Fortunately, he can _leap_ to World B where time passes X times as fast as it does in our world (World A). While (X \times t) hours pass in World B, t hours pass in World A. How many hours will pass in World A while Taro studies for T hours in World B?
['N, M = map(int, input().split( ))\ndatas = list(map(int, input().split( )))\ndatas.sort()\nMs = M - 1\n\ndest = list()\nK = 0\ni = 0\nfor i in range(Ms):\n K = datas[i+1] - datas[i]\n dest.append(K)\n\ndest.sort()\nL = 0\nMN = M - N\nfor j in range(MN):\n L = L + dest[j]\n\nprint(L)\n', 'N, M = map(int, input().split( ))\ndatas = list(map(int, input().split( )))\ndatas.sort()\nMs = M - 1\n\ndest = list()\nK = 0\ni = 0\nfor i in range(Ms):\n K = datas[i+1] - datas[i]\n dest.append(K)\n dest.sort()\n\nL = 0\nMN = M - N\n\nfor j in range(MN):\n L = L + dest[j]\n\nprint(L)', 'N, M = map(int, input().split( ))\n#print(N)\n#print(M)\ndatas = list(map(int, input().split( )))\n\ndatas.sort()\n\nMs = M - 1\n\ndest = list()\nK = 0\ni = 0\nfor i in range(Ms):\n K = datas[i+1] - datas[i]\n dest.append(K)\n dest.sort()\n \n\n#print(dest)\nL = 0\nMN = M - N\nfor j in range(MN):\n L = L + dest[j]\n\nprint(L)', 'a, b = map(int, input().split( ))\nk = round((a / b), 10)\nprint("{0:.10f}".format(k))']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s084277384', 's129855909', 's309904376', 's149232666']
[3064.0, 3064.0, 3064.0, 2940.0]
[19.0, 18.0, 18.0, 17.0]
[269, 271, 343, 84]
p03135
u869154953
2,000
1,048,576
In order to pass the entrance examination tomorrow, Taro has to study for T more hours. Fortunately, he can _leap_ to World B where time passes X times as fast as it does in our world (World A). While (X \times t) hours pass in World B, t hours pass in World A. How many hours will pass in World A while Taro studies for T hours in World B?
["T,X=map(int,input().split())\n\nif __name__ == '__main__':\n value = (T/X)\n roundValue = round(value, 10)\n print('Round = ' + str(roundValue))\n", 'T,X=map(int,input().split())\n\nnum = (T/X)\nprint("{:.10f}".format(num))']
['Wrong Answer', 'Accepted']
['s025173370', 's550912617']
[8984.0, 9052.0]
[27.0, 24.0]
[149, 70]
p03136
u001207659
2,000
1,048,576
Determine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane. You can use the following theorem: **Theorem** : an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.
['a= input()\nb = input().split()\ns = 0\nfor i in range(0,len(b)):\n s+=int(b[i])\nif s-max(b)>max(b):\n print("Yes")\nelse:\n print("No")', 'a= input()\nb = input().split()\nb = [int(s) for s in b]\ns = 0\nfor i in range(0,len(b)):\n s+=int(b[i])\nprint(s)\nif s-int(max(b))>int(max(b)):\n print("Yes")\nelse:\n print("No")', 'a= input()\nb = input().split()\ns = 0\nfor i in range(0,len(b)):\n s+=int(b[i])\nif s-max(b)>max(b):\n print("Yes")\nelse:\n print("No)', 'a= input()\nb = input().split()\nb = [int(s) for s in b]\ns = 0\nfor i in range(0,len(b)):\n s+=int(b[i])\nif s-int(max(b))>int(max(b)):\n print("Yes")\nelse:\n print("No")']
['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s006312872', 's660764827', 's842398656', 's632544182']
[3060.0, 3064.0, 2940.0, 3060.0]
[18.0, 17.0, 19.0, 18.0]
[138, 181, 144, 172]
p03136
u003501233
2,000
1,048,576
Determine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane. You can use the following theorem: **Theorem** : an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.
['N=int(input())\nl=list(map(int,input().split()))\nl=sorted(l)\n\nif l[-1] < sum([:-1]):\n print("Yes")\nelse:\n print("No")\n', 'N=int(input())\nl=list(map(int,input().split()))\nl=sorted(l)\n\nif l[-1] < sum(l[:-1]):\n print("Yes")\nelse:\n print("No")\n']
['Runtime Error', 'Accepted']
['s260945079', 's671124162']
[2940.0, 2940.0]
[18.0, 17.0]
[119, 120]
p03136
u003928116
2,000
1,048,576
Determine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane. You can use the following theorem: **Theorem** : an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.
['n=int(input())\nmax=0\nsum=0\nfor i in range(n):\n a=int(input())\n if a>=max:\n max=a\n sum=sum+a\nif sum-a<a:\n print("Yes")\nelse:\n print("No")\n', 'n=int(input())\nm=0\ns=0\na=list(map(int,input().split()))\nfor i in range(n):\n if a[i] >= m:\n m=a[i]\n s=s+a[i]\nif s-m>m:\n print("Yes")\nelse:\n print("No")\n ']
['Runtime Error', 'Accepted']
['s916877569', 's205657419']
[2940.0, 2940.0]
[18.0, 17.0]
[145, 162]
p03136
u008357982
2,000
1,048,576
Determine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane. You can use the following theorem: **Theorem** : an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.
["n=int(input())\nl=list(map(int,input().split()))\nprint('YNeos'[sum(l)>=max(l)::2])", "n=int(input())\nl=list(map(int,input().split()))\nprint('YNeos'[sum(l)-max(l)<=max(l)::2])"]
['Wrong Answer', 'Accepted']
['s777345141', 's769941363']
[2940.0, 2940.0]
[17.0, 17.0]
[81, 88]
p03136
u013408661
2,000
1,048,576
Determine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane. You can use the following theorem: **Theorem** : an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.
["n=int(input())\narray=[]\nfor i in range(n):\n k=int(input())\n array.append(k)\narray.sorted()\nsum=0\nfor i in range(n-1):\n sum+=array[i]\nif array[n-1]<sum:\n print('Yes')\nelse:\n print('No')", "n=int(input())\narray=[]\nfor i in range(n):\n k=int(input())\n array.append(k)\narray.sort()\nsum=0\nfor i in range(n-1):\n sum+=array[i]\nif array[n-1]<sum:\n print('Yes')\nelse:\n print('No')", "n=int(input())\narray=list(map(int,input().split()))\narray.sort()\nsum=0\nfor i in range(n-1):\n sum+=array[i]\nif array[n-1]<sum:\n print('Yes')\nelse:\n print('No')"]
['Runtime Error', 'Runtime Error', 'Accepted']
['s578350693', 's677049419', 's297072773']
[3060.0, 3060.0, 3060.0]
[17.0, 17.0, 18.0]
[189, 187, 161]
p03136
u015647294
2,000
1,048,576
Determine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane. You can use the following theorem: **Theorem** : an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.
['N = int(input())\nL = list(map(int, input().split()))\nL.sort()\nif L[-1] > (sum(L) - L[-1]):\n print("Yes")\nelse:\n print("No")', 'N = int(input())\nL = list(map(int, int(input())))\nL.sort()\nif L[-1] > (sum(L) - L[-1]):\n print("Yes")\nelse:\n print("No")', 'N = int(input())\nL = list(map(int, input().split()))\nL.sort()\nif L[-1] < (sum(L) - L[-1]):\n print("Yes")\nelse:\n print("No")']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s753378068', 's937116943', 's693768179']
[9132.0, 9168.0, 9116.0]
[30.0, 23.0, 25.0]
[129, 126, 129]
p03136
u017271745
2,000
1,048,576
Determine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane. You can use the following theorem: **Theorem** : an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.
['N = int(input())\nL = list(map(int, input().split()))\n\nL.sort\nif sum(L[:-1]) > L[-1]\n ans = "Yes"\nelse: ans = "No"\n\nprint(ans)', 'N = int(input())\nL = list(map(int, input().split()))\n\nL.sort()\n\nif sum(L[:-1]) > L[-1]:\n ans = "Yes"\nelse: ans = "No"\n\nprint(ans)']
['Runtime Error', 'Accepted']
['s029263414', 's911434737']
[2940.0, 2940.0]
[18.0, 17.0]
[128, 132]
p03136
u021763820
2,000
1,048,576
Determine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane. You can use the following theorem: **Theorem** : an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.
['# -*- coding: utf-8 -*-\nN = int(input())\nL = list(map(int, inpout().split()))\nif max(L) > (sum(L)-max(L)):\n print("Yes")\nelse:\n print("No")', '# -*- coding: utf-8 -*-\nN = int(input())\nL = list(map(int, input().split()))\nif max(L) < (sum(L)-max(L)):\n print("Yes")\nelse:\n print("No")']
['Runtime Error', 'Accepted']
['s044675408', 's827679851']
[2940.0, 2940.0]
[17.0, 17.0]
[145, 144]
p03136
u024782094
2,000
1,048,576
Determine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane. You can use the following theorem: **Theorem** : an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.
['n=int(input())\nl=list(map(int,input().split()))\nfor i in range(n):\n if l[i]*2 <=sum(l):\n print("No")\n exit()\nprint("Yes")', 'n=int(input())\nl=list(map(int,input().split()))\n\nif max(l)*2 <=sum(l):\n print("No")\n exit()\nprint("Yes")', 'n=int(input())\nl=list(map(int,input().split()))\n\nif max(l)*2 >=sum(l):\n print("No")\n exit()\nprint("Yes")']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s026572278', 's557199287', 's767428577']
[2940.0, 2940.0, 3064.0]
[18.0, 17.0, 19.0]
[128, 106, 106]
p03136
u028940452
2,000
1,048,576
Determine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane. You can use the following theorem: **Theorem** : an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.
['N = int(input())\nA = [int(n) for n in input().split()]\nmaxA = max(A)\nif maxA < sum(A) - maxA:\n print("yes")\nelse:\n print("no")', 'N = int(input())\nL = [int(n) for n in input().split()]\nmaxL = max(L)\nif maxL < sum(L) - maxL\n\tprint("yes")\nelse:\n\tprint("no")', 'N = int(input())\nA = [int(n) for n in input().split()]\nmaxA = max(A)\nif maxA < sum(A) - maxA:\n\tprint("yes")\nelse:\n\tprint("no")', 'N=int(input())\nl=list(map(int,input().split()))\nmax=max(l)\nif max<sum(l)-max:\n print("Yes")\nelse:\n print("No") ']
['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s058198643', 's763805860', 's872894022', 's696222245']
[2940.0, 2940.0, 2940.0, 2940.0]
[17.0, 19.0, 17.0, 17.0]
[126, 125, 126, 111]
p03136
u033524082
2,000
1,048,576
Determine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane. You can use the following theorem: **Theorem** : an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.
['n,m=map(int,input().split())\nx=list(map(int,input().split()))\nif n==1:\n print(max(x)-min(x))\nelif m==1 or n>=m:\n print(0)\nelse:\n goukei=0\n l=[0]\n i=0\n x.sort()\n a=0\n b=0\n while i<m-1:\n a=x[i]\n b=x[i+1]\n goukei+=b-a\n l.append(b-a)\n i+=1\n for v in range(n-1):\n goukei-=max(l)\n l.remove(max(l))\n print(goukei)', 'n=int(input())\nl=list(map(int,input().split()))\nl.sort()\nm=l[-1]\ns=0\nfor i in range(n-1):\n s+=l[i]\nprint("Yes" if m<s else "No")']
['Runtime Error', 'Accepted']
['s286960362', 's638821715']
[3064.0, 3060.0]
[17.0, 17.0]
[388, 131]
p03136
u035445296
2,000
1,048,576
Determine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane. You can use the following theorem: **Theorem** : an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.
["N = int(input())\nL = list(map(int, input().split()))\nL.sort(reverse=True)\nif 2*L[0] > sum(L):\n print('Yes')\nelse:\n print('No')", "N = int(input())\nL = list(map(int, input(.split())))\nind = L.index(max(L))\nif sum(L[ind-1:])+sum(L[:ind+1]) < max(L)\n print('Yes')\nelse: \n print('No')", "N = int(input())\nL = list(map(int, input().split()))\nL.sort(reverse=True)\nif max(L) > (sum(L)-max(L)):\n print('Yes')\nelse:\n print('No')", "N = int(input())\nL = list(map(int, input().split()))\nL.sort(reverse=True)\nif L[0] > (sum(L)-L[0]):\n print('Yes')\nelse:\n print('No')", "N = int(input())\nL = list(map(int, input(.split())))\nif sum(L[:N-1]) < max(L):\n print('Yes')\nelse: \n print('No')", "N = int(input())\nL = list(map(int, input().split()))\nL.sort(reverse=True)\nif L[0] > sum(L[1:]):\n print('Yes')\nelse:\n print('No')", "n = int(input())\nl = list(map(int , [input() for i in range(n)]))\nl_max = max(l)\nif (sum(l) - l_max) > 0:\n print('Yes')\nelse :\n print('No')\n", "N = int(input())\nL = list(map(int, input().split()))\nL.sort(reverse=True)\nif 2*max(L) > sum(L):\n print('Yes')\nelse:\n print('No')", "n = int(input())\nl = list(map(int, input().split()))\nprint('Yes' if max(l) < sum(l) - max(l) else 'No')"]
['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s058065871', 's303857021', 's368331605', 's494281729', 's694239045', 's747996174', 's785060661', 's928019091', 's843575002']
[2940.0, 2940.0, 3060.0, 2940.0, 2940.0, 2940.0, 2940.0, 2940.0, 2940.0]
[17.0, 17.0, 17.0, 17.0, 17.0, 17.0, 18.0, 18.0, 17.0]
[132, 161, 141, 137, 123, 134, 142, 134, 103]
p03136
u040320709
2,000
1,048,576
Determine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane. You can use the following theorem: **Theorem** : an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.
['a = int(input())\nl = list(map(int,input().split()))\nmax = max(l)\nsum = sum(l)\nif max < (sum -max) :\n print("yes")\nelse :\n print("no")', 'a = int(input())\nl = list(map(int,input().split()))\nmax = max(l)\nsum = sum(l)\nif max < (sum -max) :\n print("Yes")\nelse :\n print("No")']
['Wrong Answer', 'Accepted']
['s832382621', 's004308468']
[3060.0, 2940.0]
[17.0, 17.0]
[135, 135]
p03136
u044459372
2,000
1,048,576
Determine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane. You can use the following theorem: **Theorem** : an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.
["n=int(input())\nl=list(map(int,imput().split()))\nlmax=max(l)\nif lmax<sum(l)-lmax:\n\tprint('Yes')\nelse:\n\tprint('No')", "n=int(input())\nl=list(map(int,input().split()))\nlmax=max(l)\nif lmax<sum(l)-lmax:\n\tprint('Yes')\nelse:\n\tprint('No')"]
['Runtime Error', 'Accepted']
['s678129543', 's790620623']
[2940.0, 2940.0]
[18.0, 17.0]
[113, 113]
p03136
u045707160
2,000
1,048,576
Determine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane. You can use the following theorem: **Theorem** : an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.
["n = int(input())\nl = list(map(int,input(),split()))\n\nif max(l) < sum(l)-max(l):\n print('Yes')\nelse:\n print('No')", 'N = input()\nL = map(int,raw_input().split())\nif max(L) >= (sum(L)-max(L)):\n print "No"\nelse:\n print "Yes"', "n = int(input())\nl = list(map(int,input(),split())\n\nif max(l) < sum(l)-max(l):\n print('Yes')\nelse:\n print('No')", 'N = int(input())\nl = list(map(int, input().split()))\nif 2 * max(l) < sum(l):\n print("Yes")\nelse:\n print("No")\n']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s103562038', 's663528647', 's906061914', 's456060551']
[2940.0, 2940.0, 2940.0, 2940.0]
[17.0, 17.0, 17.0, 17.0]
[118, 107, 117, 112]
p03136
u053535689
2,000
1,048,576
Determine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane. You can use the following theorem: **Theorem** : an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.
['# 117b\n\ndef atc_117b(N: int, Li_input: str) -> str:\n Li = [int(i) for i in Li_input.split(" ")]\n Li = sorted(Li)\n max_length = Li.pop()\n if max_length < sum(Li):\n return "Yes"\n return "No"\n\nN_input_value = int(input())\nLi_input_Value = input()\nprint(atc_117b(N_input_value, Li_input_value))\n', '# 117b\n\ndef atc_117b(N: int, Li_input: str) -> str:\n Li = [int(i) for i in Li_input.split(" ")]\n Li = sorted(Li)\n max_length = Li.pop()\n if max_length < sum(Li):\n return "Yes"\n return "No"\n\nN_input_value = int(input())\nLi_input_value = input()\nprint(atc_117b(N_input_value, Li_input_value))\n']
['Runtime Error', 'Accepted']
['s950491796', 's104156767']
[9144.0, 9116.0]
[26.0, 30.0]
[313, 313]
p03136
u054871430
2,000
1,048,576
Determine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane. You can use the following theorem: **Theorem** : an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.
["n, *l = map(int, open(0).read().split())\n\nmax = 0\ntotal = 0\nfor i in range(0, n):\n if l[i] > max:\n total += max\n max = l[i]\n else:\n total += l[i]\n\nif max >= total:\n print('NO')\nelse:\n print('YES')", "n, *l = map(int, open(0).read().split())\n\nmax = 0\ntotal = 0\nfor i in range(0, n):\n if l[i] > max:\n total += max\n max = l[i]\n else:\n total += l[i]\n\nif max >= total:\n print('No')\nelse:\n print('Yes')"]
['Wrong Answer', 'Accepted']
['s974364262', 's175721947']
[2940.0, 2940.0]
[17.0, 17.0]
[229, 229]
p03136
u055529891
2,000
1,048,576
Determine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane. You can use the following theorem: **Theorem** : an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.
["N = int(input())\nLli = input().split()\nL = [int(i) for i in Lli]\nsL = sorted(L)\nif sum(sL[:-1]) < sL[-1]:\n print('Yes')\nelse:\n print('No')", "N = int(input())\nLli = input().split()\nL = [int(i) for i in Lli]\nsL = sorted(L)\nif sum(sL[:-1]) > sL[-1]:\n print('Yes')\nelse:\n print('No')\n"]
['Wrong Answer', 'Accepted']
['s407077880', 's951049716']
[2940.0, 2940.0]
[17.0, 18.0]
[144, 145]
p03136
u057993957
2,000
1,048,576
Determine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane. You can use the following theorem: **Theorem** : an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.
['n = int(input())\ns = [int(i) for i in intpu().split()]\n\ns = sorted(s, reverse=True)\nprint("Yes" if s[0] < sum(s[1:]) else "No")', 'n = int(input())\nx = [int(i) for i in input().split()]\nx = sorted(x, reverse=True)\nprint("Yes" if x[0] < sum(x[1:]) else "No")']
['Runtime Error', 'Accepted']
['s858076653', 's012783473']
[2940.0, 3060.0]
[17.0, 17.0]
[127, 126]
p03136
u066111527
2,000
1,048,576
Determine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane. You can use the following theorem: **Theorem** : an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.
['N = input()\na = [input() for i in range(N)]\n\nif max(a)\u3000>=\u3000sum(a) - max(a):\n print("Yes")\nelse:\n print("No")', 'N = int(input())\na = [input() for i in range(N)]\nif max(a)\u3000>=\u3000sum(a) - max(a):\n print("Yes")\nelse:\n print("No")', 'N = input()\na = [input() for i in range(N)]\n\nif max(a)\u3000>\u3000sum(a) - max(a):\n print("Yes")\nelse\n print("No")', 'n = input()\na = list(map(int, input().split()))\nif max(a) >=\u3000sum(a) - max(a):\n print("Yes")\nelse:\n print("No")', 'N = input()\na = [input() for i in range(N)]\n\nif max(a)\u3000>\u3000sum(a) - max(a):\n print("Yes")\n else\n print("No")', 'N = input()\na = [input() for i in range(N)]\n\nif max(a)\u3000>\u3000sum(a) - max(a):\n print(Yes)\n else\n print(No)', 'n = input()\na = list(map(int, input().split()))\nif max(a)*2 >=\u3000sum(a):\n print("Yes")\nelse:\n print("No")', 'n = input()\nN = int(n)\na = [input() for i in range(N)]\na = int(a)\nif max(a)\u3000>=\u3000sum(a) - max(a):\n print("Yes")\nelse:\n print("No")', 'n=input()\na=list(map(int, input().split()))\nif max(a)*2 >= sum(a):\n print("Yes")\nelse:\n print("No")', 'n = input()\na = list(map(int, input().split()))\nif max(a)*2 >=\u3000sum(a):\n print("Yes")\nelse:\n print("No")', 'N = int(input())\na = int([input() for i in range(N)])\nif max(a)\u3000>=\u3000sum(a) - max(a):\n print("Yes")\nelse:\n print("No")', 'n=input()\na=list(map(int, input().split()))\nif max(a)*2 < sum(a):\n print("Yes")\nelse:\n print("No")']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted']
['s031111153', 's062006121', 's100687318', 's257697921', 's431518724', 's471316179', 's497429855', 's503879242', 's690427552', 's739226160', 's795919428', 's691508169']
[3064.0, 2940.0, 2940.0, 2940.0, 3064.0, 3064.0, 2940.0, 2940.0, 2940.0, 2940.0, 2940.0, 2940.0]
[18.0, 17.0, 17.0, 19.0, 17.0, 18.0, 17.0, 17.0, 17.0, 17.0, 17.0, 17.0]
[113, 117, 111, 114, 117, 113, 107, 134, 105, 111, 122, 104]
p03136
u069602573
2,000
1,048,576
Determine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane. You can use the following theorem: **Theorem** : an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.
['n = int(input())\nl=input().split()\nfor i in range(n):\n l[i] = int(l[i])\n\nl.sort()\nmax = l.pop(-1)\nsum = sum(l)\nif sum>max:\n print("YES")\nelse:\n print("NO")', 'n = int(input())\nl=input().split()\nfor i in range(n):\n l[i] = int(l[i])\n\nl.sort()\nmax = l.pop(-1)\nsum = sum(l)\nif sum>max:\n print("Yes")\nelse:\n print("No")']
['Wrong Answer', 'Accepted']
['s907609448', 's014700571']
[3060.0, 3060.0]
[18.0, 19.0]
[164, 164]
p03136
u072472435
2,000
1,048,576
Determine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane. You can use the following theorem: **Theorem** : an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.
['n = int(input())\nl = [int(x) for x in input().split()]\nsumSides = sum(l)\nlongestSide = max(l)\nif (longestSide < sumSides - longestSide):\n print("YES")\nelse:\n print("NO")', 'n = int(input())\nl = [int(x) for x in input().split()]\nsumSides = sum(l)\nlongestSide = max(l)\nif (longestSide < sumSides - longestSide):\n print("Yes")\nelse:\n print("No")']
['Wrong Answer', 'Accepted']
['s308652528', 's267627946']
[2940.0, 2940.0]
[20.0, 19.0]
[171, 171]
p03136
u072606168
2,000
1,048,576
Determine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane. You can use the following theorem: **Theorem** : an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.
["n = int(input())\nl = [int(i) for i in input().split()]\nif max(l) < sum([i for i in l if i != max[l]]):\n print('Yes')\nelse:\n print('No')", "n = int(input())\nl = [int(i) for i in input().split()]\nif max(l) < sum(l)/2:\n print('Yes')\nelse:\n print('No')"]
['Runtime Error', 'Accepted']
['s587085081', 's698705781']
[3056.0, 2940.0]
[17.0, 17.0]
[137, 111]
p03136
u072949274
2,000
1,048,576
Determine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane. You can use the following theorem: **Theorem** : an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.
["n = int(input())\nl = list(map(int, input().split()))\n\nl.sort()\nprint(l[-1], sum(l[:-1]))\nif l[-1] >= sum(l[:-1]):\n print('No')\nelse:\n print('Yes')\n", "n = int(input())\nl = list(map(int, input().split()))\n\nl.sort()\nif l[-1] >= sum(l[:-1]):\n print('No')\nelse:\n print('Yes')\n"]
['Wrong Answer', 'Accepted']
['s931654890', 's360942347']
[2940.0, 2940.0]
[17.0, 18.0]
[153, 127]
p03136
u076996519
2,000
1,048,576
Determine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane. You can use the following theorem: **Theorem** : an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.
["n = int(input())\n# l = sort(map(int, input().split()))\nl = sort(int(x) for x in input().split())\nl_sum = 0\nfor i in range(n-1):\n\tl_sum += l[i]\nif l_sum > l[n-1]:\n\tprint('Yes')\nelse:\n\tprint('No')", "n = int(input())\n# l = sort(map(int, input().split()))\nl = (int(x) for x in input().split()).sort()\nl_sum = 0\nfor i in range(n-1):\n\tl_sum += l[i]\nif l_sum > l[n-1]:\n\tprint('Yes')\nelse:\n\tprint('No')", "n = int(input())\nl = sort(map(int, input().split()))\nl_sum = 0\nfor i in range(n-1):\n\tl_sum += l[i]\nif l_sum > l[n-1]:\n\tprint('Yes')\nelse:\n\tprint('No')", "n = int(input())\nl = [int(x) for x in input().split()]\nl.sort()\n# print(l)\nl_sum = 0\nfor i in range(n-1):\n\tl_sum += l[i]\nif l[n-1] < l_sum:\n\tprint('Yes')\nelse:\n\tprint('No')"]
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s421010076', 's684122811', 's894474630', 's237882566']
[2940.0, 2940.0, 2940.0, 2940.0]
[17.0, 17.0, 18.0, 17.0]
[194, 197, 150, 172]
p03136
u077337864
2,000
1,048,576
Determine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane. You can use the following theorem: **Theorem** : an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.
["n = int(input())\nll = list(sorted(map(int, input().split())))\n\nif sum(ll[:-1]) > sum[-1]:\n print('Yes')\nelse:\n print('No')", "n = int(input())\nll = list(sorted(map(int, input().split())))\n\nif sum(ll[:-1]) > ll[-1]:\n print('Yes')\nelse:\n print('No')"]
['Runtime Error', 'Accepted']
['s664820728', 's736250497']
[2940.0, 2940.0]
[18.0, 18.0]
[124, 123]
p03136
u079022116
2,000
1,048,576
Determine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane. You can use the following theorem: **Theorem** : an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.
["n = int(input())\nl = list(map(int,input().split()))w\nif max(l) >= sum(l)-max(l):\n print('No')\nelse:\n print('Yes')", "n = int(input())\nl = list(map(int,input().split()))\nif max(l) >= sum(l)-max(l):\n print('No')\nelse:\n print('Yes')"]
['Runtime Error', 'Accepted']
['s425484782', 's626967171']
[2940.0, 2940.0]
[17.0, 17.0]
[115, 114]
p03136
u081688405
2,000
1,048,576
Determine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane. You can use the following theorem: **Theorem** : an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.
['n = int(input())\nls = list(map(int, input().split(" ")))\nprint("Yes" if 2*max(ls) > sum(ls) else "No")', 'n = int(input())\nls = list(map(int, input().split(" ")))\nprint("Yes" if 2*max(ls) < sum(ls) else "No")\n']
['Wrong Answer', 'Accepted']
['s391948737', 's784051564']
[2940.0, 2940.0]
[17.0, 17.0]
[102, 103]
p03136
u083190434
2,000
1,048,576
Determine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane. You can use the following theorem: **Theorem** : an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.
['n = int(input())\nl = map(int,input().split())\nif sum(l) > 2*max(l):\n print("Yes")\nelse:\n print("No")', 'n = int(input())\nl = list(map(int,input().split()))\nif sum(l) > 2*max(l):\n print("Yes")\nelse:\n print("No")']
['Runtime Error', 'Accepted']
['s090791481', 's559140731']
[2940.0, 2940.0]
[17.0, 17.0]
[106, 112]
p03136
u089230684
2,000
1,048,576
Determine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane. You can use the following theorem: **Theorem** : an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.
['n=input()\nint(n)\nall=0\na=[]\na=input().split()\nmx=0\nfor i in range(0,n):\n\tx=int(a[i])\n\tif x>mx: mx=x\n\tall=all+x\nif all>2*mx : print("Yes")\nelse : print("No")', "n=int(input())\nl=list(map(int,input().split()))\nm=max(l)\ndel l[l.index(m)]\ns=sum(l)\nif s<=m:\n print('No')\nelse:\n print('Yes')\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"]
['Runtime Error', 'Accepted']
['s656362727', 's866853558']
[3060.0, 2940.0]
[17.0, 17.0]
[156, 154]
p03136
u089376182
2,000
1,048,576
Determine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane. You can use the following theorem: **Theorem** : an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.
["_ = input()\ncand_list = list(map(int, input().split()))\nmax_val = max(cand_list)\nprint('Yes' if len([i for i in cand_list if i < max_val])==len(cand_list) else 'No')", "_ = input()\ncand_list = list(map(int, input().split()))\nmax_val = max(cand_list)\nprint('Yes' if sum(cand_list) > 2*max_val else 'No')\n"]
['Wrong Answer', 'Accepted']
['s662002827', 's380584247']
[3064.0, 3060.0]
[17.0, 18.0]
[165, 134]
p03136
u095756391
2,000
1,048,576
Determine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane. You can use the following theorem: **Theorem** : an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.
['N = input()\nL = list(input().split())\nb=0\nL.sort()\n \na = L.pop(-1)\n \nfor i in range(N-1):\n b+= L[i]\n \nif (a < b):\n print("Yes")\nelse:\n print("No")', 'N = input()\nL = list(input().split())\nb=0\nL.sort()\n \na = L.pop(-1)\n \nfor i in range(N-1):\n b += L[i]\n \nif (a < b):\n print("Yes")\nelse:\n print("No")', 'N = input()\nL = input().split()\nb=0\nL.sort()\n\na = L.pop(-1)\n\nfor i in range(N-1):\n b+= L[i]\n\nif (a < b):\n print("Yes")\nelse:\n print("No")\n\n', 'N = int(input())\nL = list(map(int, input().split()))\nb=0\nL.sort()\n \na = L.pop(-1)\n \nfor i in range(N-1):\n b+= L[i]\n \nif (a < b):\n print("Yes")\nelse:\n print("No")']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s052771577', 's372465933', 's705428256', 's586699147']
[2940.0, 3060.0, 2940.0, 3060.0]
[18.0, 18.0, 18.0, 18.0]
[149, 150, 142, 164]
p03136
u096359533
2,000
1,048,576
Determine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane. You can use the following theorem: **Theorem** : an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.
["N = int(input())\nL = list(map(int,input().split()))\nL.sort()\nif L[-1] < sum(L[0:-1]):\n print('YES')\nelse:\n print('NO')", "N = int(input())\nL = list(map(int,input().split()))\nL.sort()\nif L[-1] < sum(L[0:-1]):\n print('Yes')\nelse:\n print('No')"]
['Wrong Answer', 'Accepted']
['s616178282', 's657591099']
[2940.0, 2940.0]
[17.0, 17.0]
[124, 124]
p03136
u102242691
2,000
1,048,576
Determine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane. You can use the following theorem: **Theorem** : an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.
['\nn = int(input())\nl = list(map(int,input().split()))\n\nl.sort()\n"""\nprint(l)\nprint(sum(l) - l[-1])\nprint(l[-1])\n"""\nif (sum(l) - l[-1]) < l[-1]:\n print("Yes")\nelse:\n print("No")\n', '\nn = int(input())\nl = list(map(int,input().split()))\nl.sort()\n\nif (sum(l)-l[-1]) > l[-1]:\n print("Yes")\nelse:\n print("No")\n \n']
['Wrong Answer', 'Accepted']
['s212375137', 's261468498']
[2940.0, 2940.0]
[17.0, 17.0]
[183, 134]
p03136
u109632368
2,000
1,048,576
Determine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane. You can use the following theorem: **Theorem** : an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.
['def main():\n n = int(input())\n l = list(map(int,input().split()))\n lmax = max(l)\n\n s = sum(l) - 2*max(l)\n\n if s > 0:\n print("YES")\n else:\n print("NO")\n\nif __name__ == \'__main__\':\n main()', 'def main():\n n = int(input())\n l = list(map(int,input().split()))\n lmax = max(l)\n\n l.remove(lmax)\n\n if lmax < sum(l) :\n print("YES")\n else:\n print("NO")\n\nif __name__ == \'__main__\':\n main()', 'def main():\n n = int(input())\n l = list(map(int,input().split()))\n\n s = sum(l) - 2*max(l)\n\n if (s > 0):\n print("YES")\n else:\n print("NO")\n\nif __name__ == \'__main__\':\n main()', 'def main():\n n = int(input())\n l = list(map(int,input().split()))\n s = 0\n lmax = max(l)\n\n l.remove(lmax)\n\n for i in l:\n s += i\n if lmax < s :\n print("YES")\n else:\n print("NO")\n\nif __name__ == \'__main__\':\n main()', 'def main():\n n = int(input())\n l = list(map(int,input().split()))\n s = 0\n lmax = max(l)\n\n l.remove(lmax)\n\n for i in l:\n s += i\n if lmax < s :\n print("YES")\n elif lmax >= s :\n print("NO")\n\nif __name__ == \'__main__\':\n main()', 'def main():\n n = int(input())\n l = list(map(int,input().split()))\n s = 0\n lmax = max(l)\n\n l.remove(lmax)\n\n for i in l:\n s += i\n if lmax < s :\n print("YES")\n elif lmax >= s :\n print("NO")\n\nif __name__ == \'__main__\':\n main()', 'def main():\n n = int(input())\n l = list(map(int,input().split()))\n lmax = max(l)\n\n\n\n if lmax < ( sum(l) - lmax ) :\n print("YES")\n else:\n print("NO")\n\nif __name__ == \'__main__\':\n main()', 'def main():\n n = int(input())\n l = list(map(int,input().split()))\n s = 0\n lmax = max(l)\n\n l.remove(lmax)\n\n for i in l:\n s += i\n if lmax < s :\n print("Yes")\n elif lmax >= s :\n print("No")\n\nif __name__ == \'__main__\':\n main()\n']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s109514953', 's239225881', 's326715061', 's420836342', 's475787168', 's551247029', 's600775617', 's523216780']
[3060.0, 2940.0, 2940.0, 3060.0, 3060.0, 3060.0, 2940.0, 3060.0]
[17.0, 17.0, 17.0, 17.0, 17.0, 17.0, 17.0, 17.0]
[221, 223, 205, 259, 270, 270, 216, 271]
p03136
u113750443
2,000
1,048,576
Determine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane. You can use the following theorem: **Theorem** : an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.
['def nyu():\n N = int(input())\n L = list(map(int,input().split()))\n L.sort()\n\n return N,L\n\ndef check(N,L):\n sum =0 \n\n for n in range(N-1):\n sum += L[n]\n if sum > L[N-1]:\n print("YES")\n else:\n print("NO")\n \n\n\n\nN,L =nyu()\ncheck(N,L)\n\n\n\n\n\n', 'def nyu():\n N = int(input())\n L = list(map(int,input().split()))\n L.sort()\n\n return N,L\n\ndef check(N,L):\n sum =0 \n\n for n in range(N-1):\n sum += L[n]\n if sum > L[N-1]:\n print("Yes")\n else:\n print("No")\n \n\n\n\nN,L =nyu()\ncheck(N,L)\n\n\n\n\n\n']
['Wrong Answer', 'Accepted']
['s528518155', 's270877282']
[2940.0, 2940.0]
[17.0, 17.0]
[282, 282]
p03136
u115110170
2,000
1,048,576
Determine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane. You can use the following theorem: **Theorem** : an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.
['n = input()\na list(map(int,input().split()))\n\na = sorted(a)\n\nif sum(a[0:-2]) > a[-1]:\n print("No")\nelse:\n print("Yes")', 'n = input()\na list(map(int,input().split()))\n\na = sorted(a)\n\nif sum(a[0:-1]) > a[-1]:\n print("No")\nelse:\n print("Yes")\n', 'n = input()\na = list(map(int,input().split()))\n\na = sorted(a)\n\nif sum(a[0:-1]) > a[-1]:\n print("No")\nelse:\n print("Yes")\n', 'n = input()\na = list(map(int,input().split()))\n\na = sorted(a)\n\nif sum(a[0:-1]) <= a[-1]:\n print("No")\nelse:\n print("Yes")\n']
['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s561044715', 's633821461', 's725846516', 's269540708']
[2940.0, 2940.0, 2940.0, 2940.0]
[17.0, 17.0, 18.0, 17.0]
[121, 122, 123, 124]
p03136
u115888500
2,000
1,048,576
Determine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane. You can use the following theorem: **Theorem** : an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.
['N = input()\nL = sorted(list(map(int, input().split())))\nprint("Yes" if (sum(L[:-1]) < L[-1]) else "No")', 'N = input()\nL = sorted(list(map(int, input().split())))\nprint("Yes" if (sum(L[:-1]) > L[-1]) else "No")']
['Wrong Answer', 'Accepted']
['s061113084', 's078179551']
[2940.0, 2940.0]
[17.0, 17.0]
[103, 103]
p03136
u116233709
2,000
1,048,576
Determine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane. You can use the following theorem: **Theorem** : an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.
['n=int(input())\nl=list(map(int,input().split()))\ncnt=0\nl.sort()\nfor i in range(0,n-1):\n cnt+=l[i]\nif cnt>l[n]:\n print("Yes")\nelse:\n print("No")', 'n=int(input())\nl=list(map(int,input().split()))\ncnt=0\nl.sort()\nfor i in range(0,n-1):\n cnt+=l[i]\nif cnt>l[n-1]:\n print("Yes")\nelse:\n print("No")\n']
['Runtime Error', 'Accepted']
['s973419127', 's055257405']
[2940.0, 2940.0]
[17.0, 17.0]
[145, 148]
p03136
u118518526
2,000
1,048,576
Determine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane. You can use the following theorem: **Theorem** : an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.
["n = int(input())\nl = list(input().split())\n\nl.sort(reverse = True)\n\nif len(l) == n:\n lm = l[0]\n\n del l[0]\n\n if lm < sum(l):\n print('Yes')\n else:\n print('No')\nelse:\n print('No')\n", "n = int(input())\nl = list(map(input().split()))\n\nl.sort(reverse = True)\n\nif len(l) == n:\n lm = l[0]\n\n del l[0]\n\n if lm < sum(l):\n print('Yes')\n else:\n print('No')\nelse:\n print('No')\n", "n = int(input())\nl = list(input().split())\n\nl.sort(reverse = True)\n\nif len(l) == n:\n lm = l[0]\n\n del l[0]\n\n if lm < sum(l):\n print('Yes')\n else:\n print('No')\nelse:\n print('No')\n", "n = input()\nl = list(map(int, input().split()))\n\nl.sort(reverse=true)\n\nlm = l[0]\ndel l[0]\n\nif lm < sum(l):\n print('Yes')\nelse:\n print('No')", "n = int(input())\nl = list(map(input().split()))\n\nl.sort(reverse = True)\n\nlm = l[0]\n\ndel l[0]\n\nif lm < sum(l):\n print('Yes')\nelse:\n print('No')", "n = int(input())\nl = list(map(input().split()))\n\nl.sort(reverse = True)\n\nif len(l) == n:\n lm = l[0]\n\n del l[0]\n\n if int(lm) < sum(l):\n print('Yes')\n else:\n print('No')\nelse:\n print('No')\n", "n = int(input())\nl = [int(i) for i in input().split()]\n\nl.sort(reverse = True)\n\nif len(l) == n:\n lm = l[0]\n\n del l[0]\n\n if int(lm) < sum(l):\n print('Yes')\n else:\n print('No')\nelse:\n print('No')\n"]
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s070184644', 's104784983', 's278902742', 's359410788', 's444530046', 's664457906', 's895093905']
[2940.0, 2940.0, 2940.0, 2940.0, 2940.0, 2940.0, 2940.0]
[17.0, 17.0, 17.0, 17.0, 17.0, 17.0, 17.0]
[188, 193, 188, 141, 144, 198, 205]
p03136
u122195031
2,000
1,048,576
Determine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane. You can use the following theorem: **Theorem** : an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.
['N = int(input())\nl = list(map(int.input().split()))\n\nif 2 * max(l) < sum(l):\n print("Yes")\nelse:\n print("No")', 'N = int(input())\nl = list(map(int,input().split()))\n\nif 2 * max(l) < sum(l):\n print("Yes")\nelse:\n print("No")']
['Runtime Error', 'Accepted']
['s936986407', 's274732209']
[2940.0, 2940.0]
[17.0, 17.0]
[115, 115]
p03136
u123745130
2,000
1,048,576
Determine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane. You can use the following theorem: **Theorem** : an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.
['\n#include<algorithm>\n\n#include <numeric>\nusing namespace std;\n\nint main(){\n int n;\n int max_s=0;\n int sum_s=0;\n int L;\n\n cin>>n;\n for (int i=0;i<n;i++){\n cin>>L;\n sum_s+=L;\n max_s=max(max_s,L);\n } \t\n\tif (max_s<sum_s-max_s){\n cout<<"Yes"<<endl;\n }else{\n cout<<"No"<<endl;\n }\n return 0;\n}\n', 'n=int(input())\nl=sort(map(int,input().split()))\nprint(["No","Yes"][l[-1]>=sum(l)-l[-1]])', 'n=int(input())\nl=sorted(map(int,input().split()))\nprint(["No","Yes"][l[-1]<sum(l)-l[-1]])']
['Runtime Error', 'Runtime Error', 'Accepted']
['s441802458', 's531974346', 's915409909']
[2940.0, 2940.0, 2940.0]
[18.0, 17.0, 21.0]
[380, 88, 89]
p03136
u123824541
2,000
1,048,576
Determine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane. You can use the following theorem: **Theorem** : an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.
["N = int(input())\nL = input().split()\nsum_len = 0\n\nL_i = [int(s) for s in L]\nprint(L_i)\nL_i.sort()\n\nfor i in range(N-1):\n sum_len = sum_len + int(L_i[i])\n\nif sum_len > int(L_i[N-1]):\n print('Yes')\nelse :\n print('No')", "N = int(input())\nL = input().split()\nsum_len = 0\n\nL_i = [int(s) for s in L]\nL_i.sort()\n\nfor i in range(N-1):\n sum_len = sum_len + int(L_i[i])\n\nif sum_len > int(L_i[N-1]):\n print('Yes')\nelse :\n print('No')"]
['Wrong Answer', 'Accepted']
['s978943480', 's230732244']
[3064.0, 3060.0]
[19.0, 17.0]
[225, 214]
p03136
u131406572
2,000
1,048,576
Determine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane. You can use the following theorem: **Theorem** : an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.
['n=int(input())\np=list(map(int,input().split()))\nm=max(p)\np.remove(m)\nif m>sum(p):\n print("Yes")\nelse:\n print("No")', 'n=int(input())\np=list(map(int,input().split()))\nm=max(p)\np.remove(m)\n#print(p)\nif m<sum(p):\n print("Yes")\nelse:\n print("No")']
['Wrong Answer', 'Accepted']
['s754100186', 's047147026']
[2940.0, 2940.0]
[17.0, 17.0]
[120, 130]
p03136
u137808818
2,000
1,048,576
Determine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane. You can use the following theorem: **Theorem** : an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.
["n = int(input())\ns = [int(input()).split() for i range(n)]\nprint( 'Yes' if max(s) < sum(s)-max(s) else 'No')\n", "n = int(input())\ns = list(map(int,input().split()))\nprint( 'Yes' if max(s) < sum(s)-max(s) else 'No')\n"]
['Runtime Error', 'Accepted']
['s901408220', 's198067088']
[2940.0, 2940.0]
[17.0, 17.0]
[109, 102]
p03136
u143509139
2,000
1,048,576
Determine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane. You can use the following theorem: **Theorem** : an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.
["N = int(input())\nL = list(map(int, input().split()))\nans = 'Yes' \nif max(L) >= sum(L.pop(L.index.max(L))):\n ans = 'No'\nprint(ans)", "n = int(input())\nl = list(map(int, input().split()))\nif max(l) * 2 < sum(l):\n print('Yes')\nelse:\n print('No')"]
['Runtime Error', 'Accepted']
['s928741117', 's146748627']
[2940.0, 3064.0]
[18.0, 17.0]
[132, 115]
p03136
u157184457
2,000
1,048,576
Determine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane. You can use the following theorem: **Theorem** : an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.
['# coding: utf-8\n# Your code here!\nn = int(input())\nl = list(map(int, input().split()))\nm = sum(l)\na = 0\nfor i in range(n):\n if l[i] >= m - l[i]:\n print("NO")\n a = 1\n break\nif a == 0:\n print("YES")', '# coding: utf-8\n# Your code here!\nn = int(input())\nl = list(map(int, input().split()))\nm = sum(l)\na = 0\nfor i in range(n):\n if l[i] >= m - l[i]:\n print("No")\n a = 1\n break\nif a == 0:\n print("Yes")']
['Wrong Answer', 'Accepted']
['s638007287', 's064318697']
[3060.0, 3060.0]
[17.0, 17.0]
[223, 223]
p03136
u160414758
2,000
1,048,576
Determine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane. You can use the following theorem: **Theorem** : an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.
['import sys,collections,math;sys.setrecursionlimit(10**7)\ndef Is(): return [int(x) for x in sys.stdin.readline().split()]\ndef Ss(): return sys.stdin.readline().split()\ndef I(): return int(sys.stdin.readline())\ndef S(): return input()\n\nn = I()\nLs = Is()\nm = max(Ls)\nif sum(Ls) - m < m:\n print("Yes")\nelse:\n print("No")', 'import sys,collections,math;sys.setrecursionlimit(10**7)\ndef Is(): return [int(x) for x in sys.stdin.readline().split()]\ndef Ss(): return sys.stdin.readline().split()\ndef I(): return int(sys.stdin.readline())\ndef S(): return input()\n\nn = I()\nLs = Is()\nm = max(Ls)\nif sum(Ls) - m > m:\n print("Yes")\nelse:\n print("No")']
['Wrong Answer', 'Accepted']
['s005524330', 's089949596']
[3436.0, 3436.0]
[25.0, 27.0]
[322, 322]
p03136
u163320134
2,000
1,048,576
Determine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane. You can use the following theorem: **Theorem** : an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.
["n=int(input())\narr=[int(input()) for _ in range(n)]\narr=sorted(arr)\ntotal=sum(arr[:-1])\nif arr[-1]<total:\n print('Yes')\nelse:\n print('No')", "n=int(input())\narr=list(map(int,input().split()))\narr=sorted(arr)\ntotal=sum(arr[:-1])\nif arr[-1]<total:\n print('Yes')\nelse:\n print('No')"]
['Runtime Error', 'Accepted']
['s787445437', 's497741142']
[3060.0, 3060.0]
[17.0, 17.0]
[140, 138]
p03136
u163874353
2,000
1,048,576
Determine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane. You can use the following theorem: **Theorem** : an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.
['n = int(input())\nl = list(map(int, input().split()))\nl.sort()\ncnt = 0\nfor i in l[:n - 1]:\n cnt += 1\n #print(i)\nif cnt > l[n - 1]:\n print("Yes")\nelse:\n print("No")\n ', 'n = int(input())\nl = list(map(int, input().split()))\nl.sort()\ncnt = 0\nfor i in l[:n - 1]:\n cnt += i\n #print(i)\nif cnt > l[n - 1]:\n print("Yes")\nelse:\n print("No")']
['Wrong Answer', 'Accepted']
['s912755083', 's507988187']
[2940.0, 3060.0]
[17.0, 17.0]
[179, 174]
p03136
u165268875
2,000
1,048,576
Determine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane. You can use the following theorem: **Theorem** : an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.
['\nN = int(input())\na = list(map(int, input().split()))\n\nprint("Yes" if max(a) > sum(a)-max(a) else "No")\n', '\nN = int(input())\na = [int(input()) for i in range(N)]\n\nprint("Yes" if max(a) > sum(a)-max(a) else "No")\n', '\nN = int(input())\na = list(map(int, input().split()))\n\nprint("Yes" if max(a) < sum(a)-max(a) else "No")\n', '\nN = int(input())\na = list(map(int, input().split()))\n\nprint("Yes" if max(a) < sum(a)-max(a) else "No")\n', 'N = int(input())\na = list(map(int, input().split()))\n\nprint("Yes" if max(a) < sum(a)-max(a) else "No")\n']
['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s194829090', 's318830063', 's436898543', 's690146439', 's019967558']
[2940.0, 2940.0, 2940.0, 2940.0, 2940.0]
[17.0, 18.0, 17.0, 17.0, 17.0]
[104, 105, 106, 106, 103]
p03136
u171115409
2,000
1,048,576
Determine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane. You can use the following theorem: **Theorem** : an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.
["# -*- coding: utf-8 -*-\nN = int(input())\nL = list(map(int, input().split()))\n\nL.sort()\nsum = 0\nfor i in range(N-1):\n sum += L[i]\n\nprint(sum, L[-1])\nif(L[-1] < sum):\n print('Yes')\nelse:\n print('No')\n", "# -*- coding: utf-8 -*-\nN = int(input())\nL = list(map(int, input().split()))\n\nL.sort()\nsum = 0\nfor i in range(N-1):\n sum += L[i]\n\nif(L[-1] < sum):\n print('Yes')\nelse:\n print('No')\n"]
['Wrong Answer', 'Accepted']
['s208288092', 's740865829']
[3060.0, 2940.0]
[17.0, 17.0]
[201, 183]
p03136
u175590965
2,000
1,048,576
Determine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane. You can use the following theorem: **Theorem** : an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.
['n = int(input())\nl = list(map(int,input().split()))\nif max(l) < sum(l)-max(l):\n print("YES")\nelse:\n print("NO")', 'n = int(input())\nl = list(map(int,input().split()))\nif max(l) < sum(l)-max(l):\n print("Yes")\nelse:\n print("No")']
['Wrong Answer', 'Accepted']
['s298175696', 's530756138']
[2940.0, 2940.0]
[17.0, 17.0]
[117, 117]
p03136
u176567747
2,000
1,048,576
Determine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane. You can use the following theorem: **Theorem** : an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.
["N = int(input())\nL_list = list(map(int, input().split()))\n\nm = max(L_list)\nresult = 'yes' if sum(L_list) - m > m else 'no'\nprint(result)", "N = int(input())\nL_list = list(map(int, input().split()))\n \nm = max(L_list)\nresult = 'Yes' if sum(L_list) - m > m else 'No'\nprint(result)"]
['Wrong Answer', 'Accepted']
['s811692818', 's875558163']
[2940.0, 2940.0]
[17.0, 18.0]
[136, 137]
p03136
u181195295
2,000
1,048,576
Determine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane. You can use the following theorem: **Theorem** : an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.
['li = list(map(int,input().split()))\n\nif sum(li) - 2*max(li) > 0:\n print("Yes")\nelse: print("No")', 'N = input()\nli = list(map(int,input().split()))\n\nif sum(li) - 2*max(li) > 0:\n print("Yes")\nelse: print("No")\n']
['Wrong Answer', 'Accepted']
['s058115261', 's456072475']
[2940.0, 2940.0]
[17.0, 17.0]
[97, 110]
p03136
u181526702
2,000
1,048,576
Determine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane. You can use the following theorem: **Theorem** : an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.
["N = map(int, input().split())\nL = map(int, input().split())\n\nmax_length = max(L)\n\nif max_length < sum(L) - max_length:\n print('Yes')\nelse:\n print('No')", "N = int(input())\nL = list(map(int, input().split()))\n\nmax_length = max(L)\n\nif max_length < sum(L) - max_length:\n print('Yes')\nelse:\n print('No')"]
['Wrong Answer', 'Accepted']
['s233323672', 's514002703']
[2940.0, 2940.0]
[18.0, 19.0]
[157, 150]
p03136
u184817817
2,000
1,048,576
Determine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane. You can use the following theorem: **Theorem** : an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.
["def judge(n,l):\n for i in range(n):\n for j in range(n):\n s = 0\n if(j!=i):\n s += l[j]\n if(s<l[i]):\n print('No')\n return\n print('Yes')\n return\n\nn = int(input())\nl = list(map(int,input().split()))\njudge(n,l)", "def judge(n,l):\n for i in range(n):\n for j in range(n):\n s = 0\n if(j!=i):\n s += l[j]\n if(s>l[i]):\n print('No')\n return\n print('Yes')\n return\n\nn = int(input())\nl = list(map(int,input().split()))\njudge(n,l)", "n = int(input())\nl = list(map(int,input().split()))\njudge(n,l)\n\ndef judge(n,l):\n for i in range(n):\n for j in range(j):\n s = 0\n if(j!=i):\n s += l[j]\n if(s>l[i]):\n print('No')\n return\n print('Yes')\n return", "n = int(input())\nl = list(map(int,input().split()))\n\ndef judge(n,l):\n for i in range(n):\n for j in range(j):\n s = 0\n if(j!=i):\n s += l[j]\n if(s>l[i]):\n print('No')\n return\n print('Yes')\n return", "def judge(n,l):\n for i in range(n):\n s = 0\n for j in range(n):\n if(j!=i):\n s += l[j]\n if(s<=l[i]):\n print('No')\n return\n print('Yes')\n return\n\nn = int(input())\nl = list(map(int,input().split()))\njudge(n,l)"]
['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s061724626', 's425875145', 's542552573', 's667639643', 's960165698']
[3060.0, 3060.0, 3060.0, 3060.0, 3060.0]
[17.0, 17.0, 17.0, 17.0, 17.0]
[286, 298, 298, 287, 283]
p03136
u189479417
2,000
1,048,576
Determine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane. You can use the following theorem: **Theorem** : an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.
['N = int(input())\nL = list(map(int,input().split()))\nif max(L) * 2 < L:\n print("Yes")\nelse:\n print("No")', 'N = int(input())\nL = list(map(int,input().split()))\nif max(L) * 2 < sum(L):\n print("Yes")\nelse:\n print("No")']
['Runtime Error', 'Accepted']
['s293234002', 's657042156']
[2940.0, 2940.0]
[24.0, 17.0]
[109, 114]
p03136
u190406011
2,000
1,048,576
Determine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane. You can use the following theorem: **Theorem** : an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.
['N = int(input())\nL_ls = [int(i) for i in input().split()]\nprint(L_ls)\nif sum(L_ls) - 2*max(L_ls) > 0:\n print("Yes")\nelse:\n print("No")', 'N = int(input())\nL_ls = map(int, input().split())\nif sum(L_ls) - 2*max(L_ls) > 0:\n print("Yes")\nelse:\n print("No")', 'N = int(input())\nL_ls = [int(i) for i in input().split()]\nif sum(L_ls) - 2*max(L_ls) > 0:\n print("Yes")\nelse:\n print("No")']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s365028688', 's890422191', 's772387552']
[2940.0, 2940.0, 2940.0]
[17.0, 17.0, 17.0]
[136, 116, 124]
p03136
u196746947
2,000
1,048,576
Determine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane. You can use the following theorem: **Theorem** : an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.
['n=int(input())\nL=list(map(int,input().split()))\nsum=0\nmax=0\nfor i in L:\n if i>max:\n sum+=max\n max=i\nif max<sum:\n print("Yes")\nelse:\n print("No")', 'n=int(input())\nL=list(map(int,input().split()))\nsum=0\nmax=0\nfor i in L:\n if i>max:\n sum+=max\n max=i\n else:\n sum+=i\nif max<sum:\n print("Yes")\nelse:\n print("No")']
['Wrong Answer', 'Accepted']
['s528472262', 's775875161']
[2940.0, 3060.0]
[17.0, 18.0]
[167, 192]
p03136
u197300260
2,000
1,048,576
Determine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane. You can use the following theorem: **Theorem** : an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.
['# _*_ coding:utf-8 _*_\n\n\n\ndef solveProblem(lengthList):\n\tsortedList = sorted(lengthList,reverse=True)\n\tallIntegerSum = sum(lengthList)\n\tmaxInteger = sortedList.pop(0)\n\tanotherIntegerSum = allIntegerSum - maxInteger\n\tif maxInteger < anotherIntegerSum:\n\t\tanswer="YES"\n\telse:\n\t\tanswer="NO"\n\treturn answer\n\nif __name__ == \'__main__\':\n\t_ = input()\n\tlList = list(map(int,input().strip().split(\' \')))\n\tsolution = solveProblem(lList)\n\tprint("{}".format(solution))\n', '# _*_ coding:utf-8 _*_\n\n\n\ndef solveProblem(lengthList):\n\tsortedList = sorted(lengthList,reverse=True)\n\tallIntegerSum = sum(lengthList)\n\tmaxInteger = sortedList.pop(0)\n\tanotherIntegerSum = allIntegerSum - maxInteger\n\tif maxInteger < anotherIntegerSum:\n\t\tanswer="Yes"\n\telse:\n\t\tanswer="No"\n\treturn answer\n\nif __name__ == \'__main__\':\n\t_ = input()\n\tlList = list(map(int,input().strip().split(\' \')))\n\tsolution = solveProblem(lList)\n\tprint("{}".format(solution))\n']
['Wrong Answer', 'Accepted']
['s472563503', 's564863586']
[3060.0, 3060.0]
[18.0, 17.0]
[545, 545]
p03136
u198062737
2,000
1,048,576
Determine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane. You can use the following theorem: **Theorem** : an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.
['N = int(input())\nmax_L = 0\nsum_L = 0\nfor i in range(0, N):\n L = int(input())\n if L > max_L:\n max_L = L\n sum_L += L\n\nif sum_L - max_L > max_L:\n print("Yes")\nelse:\n print("No")', 'N = int(input())\nL = [int(s) for s in input().split(" ")]\nmax_L = 0\nsum_L = 0\nfor l in L:\n if l > max_L:\n max_L = l\n sum_L += l\n \nif sum_L - max_L > max_L:\n print("Yes")\nelse:\n print("No")']
['Runtime Error', 'Accepted']
['s061660319', 's834320437']
[2940.0, 3060.0]
[18.0, 17.0]
[182, 195]
p03136
u198440493
2,000
1,048,576
Determine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane. You can use the following theorem: **Theorem** : an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.
['n = int(input())\nl = map(int, input().split())\ns = 0\nt = 0\nfor x in l:\n s += x\n t = max(x, t)\nif s>t:\n print(Yes)\nelse:\n print(No)', "n = int(input())\nl = map(int, input().split())\ns = 0\nt = 0\nfor x in l:\n s += x\n t = max(x, t)\nif s>2*t:\n print('Yes')\nelse:\n print('No')"]
['Runtime Error', 'Accepted']
['s988454253', 's650607097']
[2940.0, 3060.0]
[18.0, 17.0]
[134, 140]
p03136
u203374394
2,000
1,048,576
Determine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane. You can use the following theorem: **Theorem** : an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.
['# -*- coding: utf-8 -*-\n\nindex = int(input(\'input num : \'))\n\n\nmaximum = 0\nother = 0\ninputList = input().split()\nfor i in range(index):\n tmp = int(inputList[i])\n if tmp > maximum:\n maximum = tmp\n other = other + maximum\n else:\n other = other + tmp\n\nif maximum <= tmp - maximum:\n print("Yes")\nelse:\n print("No")\n\n', '# -*- coding: utf-8 -*-\n\nindex = int(input(\'input num : \'))\n\n\nmaximum = 0\nother = 0\ninputList = input().split()\nfor i in range(index):\n tmp = int(inputList[i])\n if tmp > maximum:\n maximum = tmp\n other = other + maximum\n else:\n other = other + tmp\n\nif maximum < other - maximum:\n print("Yes")\nelse:\n print("No")', '# -*- coding: utf-8 -*-\n\nindex = int(input())\n \n\nmax = 0\nother = 0\nl =\u3000input().split()\nfor i in range(n):\n tmp = l[i]\n max = tmp if tmp > max else other = other + l[i]\n \nif max < tmp:\n print("Yes")\nelse: \n print("No")', '# -*- coding: utf-8 -*-\n\nindex = int(input())\n\n\nmax = 0\nother = 0\nfor i in range(n):\n tmp = input()\n max = tmp if tmp > max else other = other + tmp\n\nprint("Yes") if max < tmp else print("No")\n\n', '# -*- coding: utf-8 -*-\n\nindex = int(input(\'input num : \'))\n\n\nmaximum = 0\nother = 0\ninputList = input().split()\nfor i in range(index):\n tmp = int(inputList[i])\n if tmp > maximum:\n maximum = tmp\n other = other + maximum\n else:\n other = other + tmp\n\nif maximum >= tmp - maximum :\n print("Yes")\nelse:\n print("No")', '# -*- coding: utf-8 -*-\n\nindex = int(input(\'input num : \'))\n\n\nmaximum = 0\nother = 0\ninputList = input().split()\nfor i in range(index):\n tmp = int(inputList[i])\n if tmp > maximum:\n maximum = tmp\n other = other + maximum\n else:\n other = other + tmp\n\nif maximum < other - maximum:\n print("Yes")\nelse:\n print("No")\n', '# -*- coding: utf-8 -*-\n\nindex = int(input())\n \n\nmax = 0\nother = 0\nl = input().split() \nfor i in range(index):\n tmp = int(l[i])\n if tmp > max :\n max = tmp \n else:\n other = other + tmp\n \nif max < tmp:\n print("Yes")\nelse: \n print("No")', '# -*- coding: utf-8 -*-\n\nindex = int(input())\n \n\nmax = 0\nother = 0\nl = input().split() \nfor i in range(index):\n tmp = int(l[i])\n if tmp > max :\n max = tmp \n else:\n other = other + tmp\n \nif max <= tmp:\n print("Yes")\nelse: \n print("No")', '# -*- coding: utf-8 -*-\n\nindex = int(input())\n\n\nmax = 0\nother = 0\nfor i in range(n):\n tmp = input()\n max = tmp if tmp > max else other = other + tmp\n\n if max < tmp :\n print("Yes")\nelse : \nprint("No")\n\n', '# -*- coding: utf-8 -*-\n\nindex = int(input())\n \n\nmax = 0\nother = 0\nl = input().split() \nfor i in range(index):\n tmp = int(l[i])\n if tmp > max :\n max = tmp \n else:\n other = other + tmp\n \nif max < tmp:\n print("Yes")\nelse: \n print("No")', '# -*- coding: utf-8 -*-\n\nindex = int(input())\n\n\nmaximum = 0\nother = 0\ninputList = input().split()\nfor i in range(index):\n tmp = int(inputList[i])\n if tmp > maximum:\n maximum = tmp\n other = other + maximum\n else:\n other = other + tmp\n\nif maximum < other - maximum:\n print("Yes")\nelse:\n print("No")\n']
['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s072564865', 's192225745', 's192446746', 's208430147', 's405455170', 's505254692', 's535580911', 's560791918', 's578729974', 's837448933', 's454150818']
[2940.0, 3060.0, 2940.0, 3064.0, 3060.0, 2940.0, 3060.0, 3060.0, 2940.0, 3060.0, 2940.0]
[18.0, 18.0, 17.0, 17.0, 20.0, 18.0, 17.0, 17.0, 17.0, 17.0, 18.0]
[398, 397, 271, 248, 397, 398, 291, 292, 258, 291, 384]
p03136
u203377003
2,000
1,048,576
Determine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane. You can use the following theorem: **Theorem** : an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.
['N = int(input())\nL = list(map(int, input().split()))\n\nL2 = sorted(L)\nprint(N, L2)\n\nif sum(L2[0:-1]) > L2[-1]:\n print("Yes")\nelse:\n print("No")', 'N = int(input())\nL = list(map(int, input().split()))\n\nL2 = sorted(L)\n\nif sum(L2[0:-1]) > L2[-1]:\n print("Yes")\nelse:\n print("No")']
['Wrong Answer', 'Accepted']
['s302718126', 's584273288']
[3060.0, 2940.0]
[17.0, 17.0]
[148, 135]
p03136
u204616996
2,000
1,048,576
Determine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane. You can use the following theorem: **Theorem** : an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.
["N=int(input())\nL=list(map(int,input().split()))\nL=sorted(L)\nif sum(L[:-1])>L:\n print('Yes')\nelse:\n print('No')", "N=int(input())\nL=list(map(int,input().split()))\nL=sorted(L)\nif sum(L[:-1])>L[-1]:\n print('Yes')\nelse:\n print('No')"]
['Runtime Error', 'Accepted']
['s314054781', 's147487973']
[3188.0, 2940.0]
[18.0, 17.0]
[112, 116]
p03136
u204779264
2,000
1,048,576
Determine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane. You can use the following theorem: **Theorem** : an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.
['import sys\nN = None\n\nfor i,line in enumerate(sys.stdin):\n if i == 0:\n N = int(line)\n if i == 1:\n lines = [int(i) for i in line.split(" ")]\n if (sum(lines) - max(lines)) > max(lines):\n print("YES")\n else:\n print("NO")', 'import sys\nN = None\n\nfor i,line in enumerate(sys.stdin):\n if i == 0:\n N = int(line)\n if i == 1:\n lines = [int(i) for i in line.split(" ")]\n if (sum(lines) - max(lines)) > max(lines):\n print("Yes")\n else:\n print("No")']
['Wrong Answer', 'Accepted']
['s783363018', 's860575946']
[3060.0, 3060.0]
[19.0, 17.0]
[272, 272]
p03136
u205561862
2,000
1,048,576
Determine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane. You can use the following theorem: **Theorem** : an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.
["input();s=map(int,input().split());print('YNeos'[sum(s)-max(s)*2<1::2])\n", "print((lambda l:['No','Yes',input()][sum(l[:-1])>l[-1]])(sorted(list(map(int,input().split())))))\n", "print((lambda l:['No','Yes',input()][sum(l[:-1])>=l[-1]])(sorted(list(map(int,input().split())))))", "print((lambda l:['No','Yes'][sum(l[:-1])>l[-1]])(sorted(list(map(int,[input()]+input().split()))[1:])))\n"]
['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s659165318', 's850480546', 's926326612', 's667110962']
[2940.0, 2940.0, 2940.0, 2940.0]
[17.0, 20.0, 17.0, 18.0]
[72, 98, 98, 104]
p03136
u210545407
2,000
1,048,576
Determine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane. You can use the following theorem: **Theorem** : an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.
["number = int(input())\n\nsides = [int(val) for val in input().split(' ')]\n\nprint(sum(sides))\nprint(max(sides))", "number = int(input())\n\nsides = [int(val) for val in input().split(' ')]\n\nlongest = max(sides)\nall = sum(sides)\n\nif longest < all - longest:\n print('Yes')\nelse:\n print('No')"]
['Wrong Answer', 'Accepted']
['s940604974', 's712769704']
[2940.0, 3060.0]
[17.0, 17.0]
[108, 174]
p03136
u215329188
2,000
1,048,576
Determine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane. You can use the following theorem: **Theorem** : an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.
['10\n1 8 10 5 8 12 34 100 11 3', "N = int(input())\n*L, = map(int, input().split())\n\nL_sum = sum(L)\n\nres = True\nfor l in L:\n if ((L_sum - l) <= l):\n res = False\n\nif (res):\n print('Yes')\nelse:\n print('No')\n"]
['Runtime Error', 'Accepted']
['s900627759', 's963948603']
[2940.0, 2940.0]
[22.0, 17.0]
[28, 186]