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
p03127
u455317716
2,000
1,048,576
There are N monsters, numbered 1, 2, ..., N. Initially, the health of Monster i is A_i. Below, a monster with at least 1 health is called alive. Until there is only one alive monster, the following is repeated: * A random alive monster attacks another random alive monster. * As a result, the health of the monst...
['n = int(input())\na_li = list(set(int(x) for x in input().split()))\n\nwhile 1:\n res = a_li[-1]\n a_li.sort(reverse = True)\n cou = 0\n for i in a_li[:-1]:\n a_li[cou] = i % a_li[-1]\n cou += 1\n print(a_li)\n a_li = list(set(a_li))\n try:\n a_li.remove(0)\n except:\n...
['Runtime Error', 'Accepted']
['s683715962', 's850894299']
[142216.0, 19728.0]
[1420.0, 128.0]
[448, 412]
p03127
u457683760
2,000
1,048,576
There are N monsters, numbered 1, 2, ..., N. Initially, the health of Monster i is A_i. Below, a monster with at least 1 health is called alive. Until there is only one alive monster, the following is repeated: * A random alive monster attacks another random alive monster. * As a result, the health of the monst...
['import numpy as np\n\nn = int(input())\nA = np.array([int(i) for i in input().split()])\n\nA=np.sort(A)\ns=A[0]\nfor i in range(max([n, s])):\n c = A[0]\n A = A % c\n A[0] = c\n z=A.count(0)\n A=np.sort(A)[z:]\n for j in range(len(A)):\n if A[0] != 0:\n break\n A = np.delete...
['Runtime Error', 'Accepted']
['s902273707', 's974342394']
[23088.0, 23120.0]
[191.0, 200.0]
[355, 279]
p03127
u460245024
2,000
1,048,576
There are N monsters, numbered 1, 2, ..., N. Initially, the health of Monster i is A_i. Below, a monster with at least 1 health is called alive. Until there is only one alive monster, the following is repeated: * A random alive monster attacks another random alive monster. * As a result, the health of the monst...
['_N = input()\nA_list = list(map(int, input().split()))\n\nprint("{}".format(A_list))\n\nwhile len(A_list) > 1:\n min_A = min(A_list)\n A_list = [min_A] + [A % min_A for A in A_list if A % min_A != 0]\n print("{}".format(A_list))\n\nprint("{}".format(A_list[0]))', '_N = input()\nA_list = list(map(int, input()...
['Wrong Answer', 'Accepted']
['s018138551', 's937682001']
[14252.0, 14248.0]
[90.0, 76.0]
[260, 201]
p03127
u465699806
2,000
1,048,576
There are N monsters, numbered 1, 2, ..., N. Initially, the health of Monster i is A_i. Below, a monster with at least 1 health is called alive. Until there is only one alive monster, the following is repeated: * A random alive monster attacks another random alive monster. * As a result, the health of the monst...
["n = int(input())\nai = list(map(int, input().split(' ')))\nwhile len(ai) > 1:\n print(ai)\n ai = list(sorted(ai))\n ai_head = ai[0]\n ai = list(filter(lambda x: x != 0, map(lambda x: x%ai_head, list(ai[1:]))))\n ai.append(ai_head)\nprint(ai[0])", "n = int(input())\nai = list(map(int, input().split(' ')...
['Wrong Answer', 'Accepted']
['s762221622', 's664767866']
[14224.0, 14252.0]
[185.0, 168.0]
[251, 243]
p03127
u476124554
2,000
1,048,576
There are N monsters, numbered 1, 2, ..., N. Initially, the health of Monster i is A_i. Below, a monster with at least 1 health is called alive. Until there is only one alive monster, the following is repeated: * A random alive monster attacks another random alive monster. * As a result, the health of the monst...
['from queue import PriorityQueue\nN = int(input())\nA = map(int, input().split())\nq = PriorityQueue\nfor a in A:\n q.put(a)\nx = q.get()\nwhile not q.empty():\n y=q.get()\n if y == 0:\n break\n q.put(x % y)\n x = y\nprint(x)', 'from queue import PriorityQueue\nN = int(input())\nA = map(int, input().split())\n...
['Runtime Error', 'Accepted']
['s361376172', 's458840484']
[12212.0, 15192.0]
[36.0, 1826.0]
[219, 243]
p03127
u478588435
2,000
1,048,576
There are N monsters, numbered 1, 2, ..., N. Initially, the health of Monster i is A_i. Below, a monster with at least 1 health is called alive. Until there is only one alive monster, the following is repeated: * A random alive monster attacks another random alive monster. * As a result, the health of the monst...
['from functools import reduce\nfrom math import gcd\ninput()\nAi = list(map(int, input().strip()))\nprint(reduce(gcd, Ai))', 'from functools import reduce\ndef gcd(a, b):\n if a < b:\n return gcd(b, a)\n if b == 0:\n return a\n else:\n return gcd(b, a%b)\ninput()\nAi = list(map(int, input...
['Runtime Error', 'Accepted']
['s151094756', 's280057608']
[3572.0, 14600.0]
[23.0, 85.0]
[117, 219]
p03127
u483722302
2,000
1,048,576
There are N monsters, numbered 1, 2, ..., N. Initially, the health of Monster i is A_i. Below, a monster with at least 1 health is called alive. Until there is only one alive monster, the following is repeated: * A random alive monster attacks another random alive monster. * As a result, the health of the monst...
['# -*- coding: utf-8 -*-\nN = map(int, input())\nA = list(map(int, input().split()))\n\nwhile len(A) >= 2:\n largest_elem = A.index(max(A))\n x = A.pop(largest_elem)\n largest_elem = A.index(max(A))\n y = A.pop(largest_elem)\n print(x, y)\n if x == 1 and y == 1:\n A.append(y)\n elif x % y =...
['Wrong Answer', 'Accepted']
['s080638003', 's066224800']
[14252.0, 14248.0]
[2104.0, 94.0]
[398, 289]
p03127
u485716382
2,000
1,048,576
There are N monsters, numbered 1, 2, ..., N. Initially, the health of Monster i is A_i. Below, a monster with at least 1 health is called alive. Until there is only one alive monster, the following is repeated: * A random alive monster attacks another random alive monster. * As a result, the health of the monst...
["def main():\n N = int(input())\n monsters = list(map(int, input().split()))\n\n monsters = sorted(monsters)\n \n\n last = 10000\n while True:\n # print('==============================')\n \n for i in range(1, len(monsters)):\n monsters[i] = monsters[i] % monsters[0]\n\n \n if 0 in monsters:\...
['Runtime Error', 'Accepted']
['s068945031', 's177532378']
[14252.0, 15020.0]
[132.0, 203.0]
[613, 237]
p03127
u496744988
2,000
1,048,576
There are N monsters, numbered 1, 2, ..., N. Initially, the health of Monster i is A_i. Below, a monster with at least 1 health is called alive. Until there is only one alive monster, the following is repeated: * A random alive monster attacks another random alive monster. * As a result, the health of the monst...
['n = int(input())\na = list(map(int, input().split()))\nmini = a.pop(a.index(min(a)))\nsemi_mini = a.pop(a.index(min(a)))\nprint(mini, semi_mini)\nwhile mini > 0 and semi_mini > 0:\n if semi_mini > mini:\n semi_mini -= mini\n else:\n mini -= semi_mini\nprint(max(mini, semi_mini))\n', 'n = int(input...
['Wrong Answer', 'Accepted']
['s440397863', 's335460257']
[14252.0, 14252.0]
[47.0, 87.0]
[290, 402]
p03127
u497883442
2,000
1,048,576
There are N monsters, numbered 1, 2, ..., N. Initially, the health of Monster i is A_i. Below, a monster with at least 1 health is called alive. Until there is only one alive monster, the following is repeated: * A random alive monster attacks another random alive monster. * As a result, the health of the monst...
['n = int(input())\na = list(map(int,input().split()))\na = sorted(a)\ndef gcd(a,b):\n c = a%b\n if c == 0:\n return b\n 0else:\n return gcd(b,c)\nc = 0\nfor i in a[1:]:\n c_ = gcd(i,a[0])\n if c_ == 1:\n c = 1\n break\n else:\n if c_ < c or c == 0:\n c = c_\nprint(c)\n', 'n = int(input())\na ...
['Runtime Error', 'Runtime Error', 'Accepted']
['s403976233', 's564362555', 's059525354']
[2940.0, 14252.0, 14252.0]
[17.0, 82.0, 118.0]
[275, 263, 274]
p03127
u502283124
2,000
1,048,576
There are N monsters, numbered 1, 2, ..., N. Initially, the health of Monster i is A_i. Below, a monster with at least 1 health is called alive. Until there is only one alive monster, the following is repeated: * A random alive monster attacks another random alive monster. * As a result, the health of the monst...
['from sys import stdin\nimport numpy as np\n\nN = int(stdin.readline().rstrip().split()[0])\nA = [int(x) for x in stdin.readline().rstrip().split()]\n# N, X = [int(x) for x in stdin.readline().rstrip().split()]\n\ndef G(_a, _b):\n if _a>=_b:\n a, b = _a, _b\n else:\n a, b = _b, _a\n \n while True:\n c = a...
['Runtime Error', 'Accepted']
['s591924712', 's025670919']
[23316.0, 23384.0]
[190.0, 252.0]
[630, 658]
p03127
u512007680
2,000
1,048,576
There are N monsters, numbered 1, 2, ..., N. Initially, the health of Monster i is A_i. Below, a monster with at least 1 health is called alive. Until there is only one alive monster, the following is repeated: * A random alive monster attacks another random alive monster. * As a result, the health of the monst...
['#ABC118_C\n\nimport fraction\n\nn = int(input())\na = list(map(int,input().split()))\n\nx = fraction.gcd(a[0],a[1])\n\nif n != 2:\n for i in range(2,n):\n x = fraction.gcd(x,a[i])\n \nprint(x)', 'INF = 10 ** 10\n\ndef num(k):\n if k == 1:\n return 2\n elif k == 7:\n return 3\n ...
['Runtime Error', 'Runtime Error', 'Accepted']
['s142052934', 's670699244', 's648181538']
[2940.0, 3064.0, 14252.0]
[19.0, 18.0, 77.0]
[196, 1232, 216]
p03127
u516554284
2,000
1,048,576
There are N monsters, numbered 1, 2, ..., N. Initially, the health of Monster i is A_i. Below, a monster with at least 1 health is called alive. Until there is only one alive monster, the following is repeated: * A random alive monster attacks another random alive monster. * As a result, the health of the monst...
['n=int(input())\na=list(map(int,input().split()))\n\na=sorted(a)\n\ndef make_divisors(n):\n lower_divisors , upper_divisors = [], []\n i = 1\n while i*i <= n:\n if n % i == 0:\n lower_divisors.append(i)\n if i != n // i:\n upper_divisors.append(n//i)\n i += 1...
['Runtime Error', 'Accepted']
['s401931660', 's062116898']
[9020.0, 20000.0]
[26.0, 917.0]
[587, 557]
p03127
u518042385
2,000
1,048,576
There are N monsters, numbered 1, 2, ..., N. Initially, the health of Monster i is A_i. Below, a monster with at least 1 health is called alive. Until there is only one alive monster, the following is repeated: * A random alive monster attacks another random alive monster. * As a result, the health of the monst...
['def gcd(n,m):\n a=min(n,m)\n b=max(n,m)\n while a!=0:\n b,a=a,b%a\n return a\nn=int(input())\nl=list(map(int,input().split()))\nans=l[0]\nfor i in range(1,n):\n ans=gcd(ans,l[i])\nprint(ans)', 'def gcd(n,m):\n a=min(n,m)\n b=max(n,m)\n while a!=0:\n b,a=a,b%a\n return b\nn=int(input())\nl=list(map(int,...
['Wrong Answer', 'Accepted']
['s774005050', 's322028949']
[14252.0, 14252.0]
[101.0, 110.0]
[187, 187]
p03127
u518064858
2,000
1,048,576
There are N monsters, numbered 1, 2, ..., N. Initially, the health of Monster i is A_i. Below, a monster with at least 1 health is called alive. Until there is only one alive monster, the following is repeated: * A random alive monster attacks another random alive monster. * As a result, the health of the monst...
['n=int(input())\na=list(map(int,input().split()))\nb=list(set(a)) \nif len(b)==1:\n print(b[0])\n exit()\nelse: \n x=1\n while x>0:\n c=sorted(b)\n c[1]=c[1]-c[0]\n c=sorted(list(set(c)))\n if c[0]==1:\n x=0\n if len(c)==1:\n print(2)\n ...
['Time Limit Exceeded', 'Time Limit Exceeded', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s031503590', 's047581070', 's108792064', 's669544840', 's818355652', 's180566470']
[16008.0, 15884.0, 3064.0, 14480.0, 14480.0, 14436.0]
[2104.0, 2104.0, 17.0, 119.0, 123.0, 623.0]
[338, 403, 338, 430, 430, 456]
p03127
u527261492
2,000
1,048,576
There are N monsters, numbered 1, 2, ..., N. Initially, the health of Monster i is A_i. Below, a monster with at least 1 health is called alive. Until there is only one alive monster, the following is repeated: * A random alive monster attacks another random alive monster. * As a result, the health of the monst...
['import math\nn=int(input())\na=list(map(int,input().split()))\nprint(math.gcd(a))\n ', 'n=int(input())\na=list(map(int,input().split()))\ndef gcd(x,y):\n while x%y>0:\n x,y=y,x%y\n return y\na.sort(reverse=True)\nans=a[0]\nfor j in range(n-1):\n ans=gcd(ans,a[j+1])\nprint(ans)\n ']
['Runtime Error', 'Accepted']
['s026058407', 's155459337']
[15020.0, 14252.0]
[43.0, 117.0]
[85, 188]
p03127
u528376608
2,000
1,048,576
There are N monsters, numbered 1, 2, ..., N. Initially, the health of Monster i is A_i. Below, a monster with at least 1 health is called alive. Until there is only one alive monster, the following is repeated: * A random alive monster attacks another random alive monster. * As a result, the health of the monst...
["def main():\n\tN = int(input())\n\tA = list(map(int, input().split()))\n\twhile(len(A) != 1):\n\t\tA.sort()\n\t\tmini = A[0]\n\t\tfor i in range(1, len(A)):\n\t\t\tif i >= len(A):\n\t\t\t\tcontinue\n\t\t\tif A[i] % mini == 0:\n\t\t\t\tA.pop(i)\n\t\t\telse:\n\t\t\t\tA[i] = A[i] % mini\n\t\tA = QUICKSORT(A)\n\t\tpiv = ...
['Runtime Error', 'Accepted']
['s897077718', 's970565447']
[14428.0, 14252.0]
[832.0, 1573.0]
[416, 312]
p03127
u528470578
2,000
1,048,576
There are N monsters, numbered 1, 2, ..., N. Initially, the health of Monster i is A_i. Below, a monster with at least 1 health is called alive. Until there is only one alive monster, the following is repeated: * A random alive monster attacks another random alive monster. * As a result, the health of the monst...
['N = int(input())\nA = list(map(int, input().split()))\n\nAs = sorted(A)\nAs = [a%As[0] if a%As[0] != 0 else As[0] for a in As]\nAs = sorted(As)\n\ndef judge(tmp_one, tmp_two):\n flg = 1\n \n while flg:\n if tmp_two % tmp_one == 0:\n tmp_two = tmp_one\n else:\n tmp_two = tm...
['Runtime Error', 'Accepted']
['s359646985', 's850149076']
[14480.0, 14228.0]
[138.0, 113.0]
[733, 409]
p03127
u529012223
2,000
1,048,576
There are N monsters, numbered 1, 2, ..., N. Initially, the health of Monster i is A_i. Below, a monster with at least 1 health is called alive. Until there is only one alive monster, the following is repeated: * A random alive monster attacks another random alive monster. * As a result, the health of the monst...
['import fractions\n\nN = int(input())\nA = list(map(int, input().split()))\nans = A[0]\nfor i in range(1, N):\n ans = gcd(ans, A[i])\n \nprint(ans)', 'import math\nfrom functools import reduce\n\ndef gcd(v1, v2):\n if v1 == 0 or v2 == 0:\n return max(v1, v2)\n if v1 % v2 == 0:\n return v2\n ...
['Runtime Error', 'Accepted']
['s785131869', 's305685448']
[16240.0, 14756.0]
[60.0, 87.0]
[144, 254]
p03127
u539517139
2,000
1,048,576
There are N monsters, numbered 1, 2, ..., N. Initially, the health of Monster i is A_i. Below, a monster with at least 1 health is called alive. Until there is only one alive monster, the following is repeated: * A random alive monster attacks another random alive monster. * As a result, the health of the monst...
["n=int(input())\na=list(map(int,input().split()))\nwhile len(a)>1:\n a.sort()\n for i in range(1,n):\n a[i]=a[i]%a[0]\n a.replace(0,'')\n n=len(a)\nprint(a[0])", 'n=int(input())\na=list(map(int,input().split()))\nwhile len(a)>1:\n a.sort()\n for i in range(1,n):\n a[i]=a[i]%a[0]\n a=[i for i in a if not i...
['Runtime Error', 'Accepted']
['s273930142', 's960535591']
[15020.0, 14252.0]
[101.0, 167.0]
[157, 170]
p03127
u556589653
2,000
1,048,576
There are N monsters, numbered 1, 2, ..., N. Initially, the health of Monster i is A_i. Below, a monster with at least 1 health is called alive. Until there is only one alive monster, the following is repeated: * A random alive monster attacks another random alive monster. * As a result, the health of the monst...
['N = int(input())\nA = list(map(int,input().split()))\nnow = A[0]\nfor i in range(1,N):\n now = math.gcd(A[i],now)\nprint(now)', 'import math\nN = int(input())\nA = list(map(int,input().split()))\nnow = A[0]\nfor i in range(1,N):\n now = math.gcd(A[i],now)\nprint(now)\n']
['Runtime Error', 'Accepted']
['s560936652', 's407654882']
[20128.0, 20332.0]
[50.0, 68.0]
[123, 136]
p03127
u562753067
2,000
1,048,576
There are N monsters, numbered 1, 2, ..., N. Initially, the health of Monster i is A_i. Below, a monster with at least 1 health is called alive. Until there is only one alive monster, the following is repeated: * A random alive monster attacks another random alive monster. * As a result, the health of the monst...
['import math\n\nn = int(input())\na = [int(x) for x in input().split(" ")]\ng = a.sort()[n - 1]\n\nfor i in range(1, n):\n g = math.gcd(g, a[i])\n \nprint(g)', 'import math\n\n\nn = int(input())\na = [int(x) for x in input().split(" ")]\ng = a.sort()[n - 1]\n\n\nfor i in range(1, n):\n g = math.gcd(g, a[i])\n...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s074497268', 's246047787', 's455117914', 's509823560', 's888927444', 's255128722']
[14252.0, 14252.0, 14252.0, 14252.0, 14252.0, 14484.0]
[81.0, 79.0, 46.0, 82.0, 2104.0, 202.0]
[153, 152, 138, 150, 347, 524]
p03127
u570417673
2,000
1,048,576
There are N monsters, numbered 1, 2, ..., N. Initially, the health of Monster i is A_i. Below, a monster with at least 1 health is called alive. Until there is only one alive monster, the following is repeated: * A random alive monster attacks another random alive monster. * As a result, the health of the monst...
['N = int(input())\nA = [int(i) for i in input().split()]\n\nwhile len(A) > 1:\n min_num = min(A)\n min_index = A.index(min(A))\n for i in range(len(A)):\n if i != min_index:\n A[i] = A[i] % min_num\n if(A[i] == 0):\n A.pop(i)\n\n\nprint(A[0])', 'N = int(input())\nA = [int(i) for i in input().spl...
['Runtime Error', 'Accepted']
['s658287466', 's044462828']
[14252.0, 14252.0]
[813.0, 1599.0]
[251, 245]
p03127
u581403769
2,000
1,048,576
There are N monsters, numbered 1, 2, ..., N. Initially, the health of Monster i is A_i. Below, a monster with at least 1 health is called alive. Until there is only one alive monster, the following is repeated: * A random alive monster attacks another random alive monster. * As a result, the health of the monst...
['n = int(input())\na = [int(input()) for i in range(n)]\n\ng = gcd(a[0], a[1])\nfor i in range(2, n):\n g = gcd(g, a[i])\n \nprint(g)', 'n = int(input())\na = list(map(int, input().split()))\n\ndef gcd(p, q):\n if q == 0:\n return p\n else:\n return gcd(q, p % q)\n\ng = gcd(a[0], a[1])\nfor i...
['Runtime Error', 'Accepted']
['s289701266', 's313949348']
[11016.0, 20084.0]
[35.0, 87.0]
[131, 213]
p03127
u585056683
2,000
1,048,576
There are N monsters, numbered 1, 2, ..., N. Initially, the health of Monster i is A_i. Below, a monster with at least 1 health is called alive. Until there is only one alive monster, the following is repeated: * A random alive monster attacks another random alive monster. * As a result, the health of the monst...
['import random\nn = int(input())\nenemies = list(map(int,input().split()))\nwhile True:\n en_at = random.randrange(len(enemies))\n while True:\n en_h = random.randrange(len(enemies))\n if en_at != en_h: break\n enemies[en_h]-=enemies[en_at]\n if enemies[en_h]<=0: enemies.pop(en_h)\n if len(enemies)==1:\n ...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s269687754', 's834555287', 's539205427']
[15404.0, 14764.0, 14596.0]
[1333.0, 47.0, 76.0]
[331, 130, 186]
p03127
u593567568
2,000
1,048,576
There are N monsters, numbered 1, 2, ..., N. Initially, the health of Monster i is A_i. Below, a monster with at least 1 health is called alive. Until there is only one alive monster, the following is repeated: * A random alive monster attacks another random alive monster. * As a result, the health of the monst...
['N = int(input())\nA = list(map(int,input().split()))\n\nA.sort()\nstack = A[1:]\nm = A[0]\n\nwhile stack:\n stack = list(stack)\n l = []\n for x in stack:\n if x % m == 0:\n continue\n l.append(x % m)\n \n m = min(l)\n stack = set(l)\n\nprint(m)\n\n\n\n\n', 'N = int(input())\nA = list(map(int,input()...
['Runtime Error', 'Accepted']
['s619315534', 's935955183']
[14252.0, 14224.0]
[114.0, 113.0]
[249, 281]
p03127
u607563136
2,000
1,048,576
There are N monsters, numbered 1, 2, ..., N. Initially, the health of Monster i is A_i. Below, a monster with at least 1 health is called alive. Until there is only one alive monster, the following is repeated: * A random alive monster attacks another random alive monster. * As a result, the health of the monst...
['n = int(input())\na = list(map(int,input().split()))\nx = a[0]\nfor i in range(1,n):\n x,y = max(x,a[i]),min(x,a[i])\n print(x,y)\n while y!=0:x,y=y,x%y\nprint(x)', 'n = int(input())\na = list(map(int,input().split()))\n\nx = a[0]\nfor i in range(1,n):\n x,y = max(x,a[i]),min(x,a[i])\n while y!=0:x,y=y...
['Wrong Answer', 'Accepted']
['s298226488', 's683426506']
[19924.0, 20044.0]
[158.0, 105.0]
[164, 150]
p03127
u609061751
2,000
1,048,576
There are N monsters, numbered 1, 2, ..., N. Initially, the health of Monster i is A_i. Below, a monster with at least 1 health is called alive. Until there is only one alive monster, the following is repeated: * A random alive monster attacks another random alive monster. * As a result, the health of the monst...
['import sys\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nimport numpy as np\nN = int(input())\nA = [int(x) for x in readline().rstrip().split()]\nA = np.array(A, np.int64)\nwhile len(A) > 1:\n A = A[np.nonzero(A)]\n A = np.sort(A)\n minA = A[0]\n...
['Runtime Error', 'Accepted']
['s414439515', 's048435400']
[21444.0, 23124.0]
[199.0, 199.0]
[368, 288]
p03127
u619197965
2,000
1,048,576
There are N monsters, numbered 1, 2, ..., N. Initially, the health of Monster i is A_i. Below, a monster with at least 1 health is called alive. Until there is only one alive monster, the following is repeated: * A random alive monster attacks another random alive monster. * As a result, the health of the monst...
['#copy code\nfrom fractions import gcd\nn=int(input())\na=[int(i) for i in input().split()]\nc=a[0]\nfor i in a:\n c=gcd(c,a)\nprint(c)\n', 'from fractions import gcd\nn=int(input())\na=[int(i) for i in input().split()]\nc=a[0]\nfor i in a:\n c=gcd(c,a)\nprint(c)\n', '\nn=int(input())\na=[int(i) for i in input()...
['Runtime Error', 'Runtime Error', 'Accepted']
['s123496817', 's237728949', 's733218600']
[16280.0, 16280.0, 14252.0]
[63.0, 65.0, 71.0]
[131, 120, 153]
p03127
u619670102
2,000
1,048,576
There are N monsters, numbered 1, 2, ..., N. Initially, the health of Monster i is A_i. Below, a monster with at least 1 health is called alive. Until there is only one alive monster, the following is repeated: * A random alive monster attacks another random alive monster. * As a result, the health of the monst...
['#coding:utf-8\n\nn = int(input())\na = list(map(int,input().split()))\n\nwhile len(a)>1:\n for i in range(1,len(a)):\n a[i] %= a[0]\n a.sort()\n while True:\n if a[0] == 0:\n a.remove(0)\n else:\n break;\n\n', '#coding:utf-8\n\nn = int(input())\na = list(map(int,input().split()))\n\nwhile len(a)...
['Wrong Answer', 'Accepted']
['s028018831', 's341210861']
[14252.0, 14252.0]
[1648.0, 1638.0]
[214, 225]
p03127
u620846115
2,000
1,048,576
There are N monsters, numbered 1, 2, ..., N. Initially, the health of Monster i is A_i. Below, a monster with at least 1 health is called alive. Until there is only one alive monster, the following is repeated: * A random alive monster attacks another random alive monster. * As a result, the health of the monst...
['n = int(input())\nxlist = list(map(int,input().split()))\na = xlist[0]\nfor i in range(1,n):\n a = fractions.gcd(a,xlist[i])\nprint(a)', 'from functools import reduce\nfrom math import gcd\nn = int(input())\nxlist = list(map(int,input().split()))\nprint(reduce(gcd, xlist))']
['Runtime Error', 'Accepted']
['s954776433', 's476882067']
[19876.0, 20480.0]
[52.0, 64.0]
[130, 131]
p03127
u623231048
2,000
1,048,576
There are N monsters, numbered 1, 2, ..., N. Initially, the health of Monster i is A_i. Below, a monster with at least 1 health is called alive. Until there is only one alive monster, the following is repeated: * A random alive monster attacks another random alive monster. * As a result, the health of the monst...
['n = int(input())\nli = list(map(int,input().split()))\n\nwhile len(li) > 1:\n a = min(li)\n for i in range(len(li)):\n li[i] %= a\n if li[i] == 0:\n li.pop(i)\n \nprint(li[0])\n ', 'n = int(input())\nli = list(map(int,input().split()))\n\nwhile len(li) > 1:\n a = min(li)\n for i in range(len(li...
['Runtime Error', 'Accepted']
['s437215160', 's435633637']
[14252.0, 14252.0]
[798.0, 72.0]
[188, 226]
p03127
u626337957
2,000
1,048,576
There are N monsters, numbered 1, 2, ..., N. Initially, the health of Monster i is A_i. Below, a monster with at least 1 health is called alive. Until there is only one alive monster, the following is repeated: * A random alive monster attacks another random alive monster. * As a result, the health of the monst...
['N = int(input())\nLifes = map(int, input().split())\n\nLifes.sort(key=lambda x:-x)\n\nans = Lifes[N-1]\n\nfor i in range(N):\n for j in range(i, N):\n life = Lifes[i] - Lifes[j]\n if life > 0:\n\t ans = min(ans, life)\nprint(ans)', 'N = int(input())\nLifes = map(int, input().split())\n\nLifes.sort(key=lambda ...
['Runtime Error', 'Runtime Error', 'Accepted']
['s201642441', 's507624789', 's628278946']
[2940.0, 11100.0, 14224.0]
[17.0, 27.0, 147.0]
[224, 228, 559]
p03127
u626881915
2,000
1,048,576
There are N monsters, numbered 1, 2, ..., N. Initially, the health of Monster i is A_i. Below, a monster with at least 1 health is called alive. Until there is only one alive monster, the following is repeated: * A random alive monster attacks another random alive monster. * As a result, the health of the monst...
['n = int(input())\na = list(map(int, input().split()))\nwhile len(a) > 0:\n m = min(a)\n a = [a[i]%m for i in range(len(a)) if a[i]%m > 0]\n a.append(m)\nprint(m)\n', 'n = int(input())\na = list(map(int, input().split()))\nwhile len(a) > 1:\n m = min(a)\n a = [a[i]%m for i in range(len(a)) if a[i]%m > 0]\n a.app...
['Time Limit Exceeded', 'Accepted']
['s550240220', 's698776938']
[14224.0, 14224.0]
[2108.0, 80.0]
[159, 159]
p03127
u628047647
2,000
1,048,576
There are N monsters, numbered 1, 2, ..., N. Initially, the health of Monster i is A_i. Below, a monster with at least 1 health is called alive. Until there is only one alive monster, the following is repeated: * A random alive monster attacks another random alive monster. * As a result, the health of the monst...
['import fraction\nn = int(input())\na = list(map(int,input().split()))\nans = a[0]\nfor x in a:\n ans = fraction.gcd(x,ans)\nprint(ans)\n\n', 'def gcd(a, b):\n if b == 0:\n return a\n return gcd(b,a%b)\nn = int(input())\na = list(map(int,input().split()))\nans = a[0]\nfor x in a:\n ans = gcd(x,ans)\...
['Runtime Error', 'Accepted']
['s149765463', 's690051243']
[2940.0, 14224.0]
[17.0, 73.0]
[133, 175]
p03127
u635958201
2,000
1,048,576
There are N monsters, numbered 1, 2, ..., N. Initially, the health of Monster i is A_i. Below, a monster with at least 1 health is called alive. Until there is only one alive monster, the following is repeated: * A random alive monster attacks another random alive monster. * As a result, the health of the monst...
['from functions import gcd \nfrom functools import reduce\n\nN=int(input())\nA=list(map(int,input().split()))\n\nprint(reduce(gcd,A))', 'print(1)', 'from functools import reduce\n\nN=int(input())\nA=list(map(int,input().split()))\ndef gcd(a,b):\n while b!=0:\n a,b=b,a%b\n return a\nprint(reduce(gcd,A))']
['Runtime Error', 'Wrong Answer', 'Accepted']
['s066922976', 's492385927', 's247917305']
[2940.0, 2940.0, 14596.0]
[17.0, 17.0, 70.0]
[126, 8, 159]
p03127
u639426108
2,000
1,048,576
There are N monsters, numbered 1, 2, ..., N. Initially, the health of Monster i is A_i. Below, a monster with at least 1 health is called alive. Until there is only one alive monster, the following is repeated: * A random alive monster attacks another random alive monster. * As a result, the health of the monst...
['N = int(input())\nA = list(map(int, input().split()))\nj = 0\nA.sort()\nfor n in A:\n\tif n%2 == 1:\n\t\tj = 1\na = 0\nfor n in range(1, len(A)-1):\n\tif A[n] % A[0] == 1\n\t\ta = 1\nif a == 0:\n\tj = 3\nif A[0] == A[-1]:\n\tj = 2\nif j == 0:\n\tprint(2)\nelif j == 1:\n\tprint(1)\nelif j == 3:\n\tprint(A[0])\nelse:\n...
['Runtime Error', 'Runtime Error', 'Accepted']
['s240854057', 's725777627', 's088356050']
[3064.0, 2940.0, 14252.0]
[17.0, 18.0, 135.0]
[297, 211, 214]
p03127
u641406334
2,000
1,048,576
There are N monsters, numbered 1, 2, ..., N. Initially, the health of Monster i is A_i. Below, a monster with at least 1 health is called alive. Until there is only one alive monster, the following is repeated: * A random alive monster attacks another random alive monster. * As a result, the health of the monst...
['n = int(input())\nmonster = sorted(list(map(int,input().split())))\nmin_HP = min(monster)\ncnt=0\nwhile True:\n tmp = int(monster[-1]/monster[-2])\n monster[-1]-=monster[-2]*tmp\n if monster[-1]<=0:\n monster.pop(-1)\n monster = sorted(monster)\n if min_HP==monster[0]:\n cnt+=1\n if cnt>=2:\n print...
['Runtime Error', 'Wrong Answer', 'Accepted']
['s298540169', 's447677918', 's170682490']
[14252.0, 14224.0, 14224.0]
[101.0, 60.0, 188.0]
[385, 198, 223]
p03127
u645250356
2,000
1,048,576
There are N monsters, numbered 1, 2, ..., N. Initially, the health of Monster i is A_i. Below, a monster with at least 1 health is called alive. Until there is only one alive monster, the following is repeated: * A random alive monster attacks another random alive monster. * As a result, the health of the monst...
['import fraction\ndef monsters(li,n):\n t = temp\n for i in range(1,n-1):\n t = fraction.gcd(t,li[i+1])\n return t\n\nn = int(input())\nli_a = list(map(int,input().split()))\ntemp = li_a[0]\nprint(monsters(li_a,n))', 'import fractions\ndef monsters(li,n):\n t = temp\n for i in range(1,n-1):\n ...
['Runtime Error', 'Wrong Answer', 'Accepted']
['s128395513', 's134397724', 's454376717']
[3064.0, 16296.0, 14252.0]
[18.0, 92.0, 65.0]
[219, 221, 254]
p03127
u655048024
2,000
1,048,576
There are N monsters, numbered 1, 2, ..., N. Initially, the health of Monster i is A_i. Below, a monster with at least 1 health is called alive. Until there is only one alive monster, the following is repeated: * A random alive monster attacks another random alive monster. * As a result, the health of the monst...
['N = int(input())\na = list(map(int,input().split()))\nans = a[0]\nfor i in range(1,N):\n ans = gcd(ans,a[i])\nprint(ans)', 'import math\nN = int(input())\na = list(map(int,input().split()))\nans = a[0]\nfor i in range(1,N):\n ans = math.gcd(ans,a[i])\nprint(ans)\n']
['Runtime Error', 'Accepted']
['s880645003', 's721707411']
[19972.0, 20172.0]
[48.0, 69.0]
[116, 134]
p03127
u655110382
2,000
1,048,576
There are N monsters, numbered 1, 2, ..., N. Initially, the health of Monster i is A_i. Below, a monster with at least 1 health is called alive. Until there is only one alive monster, the following is repeated: * A random alive monster attacks another random alive monster. * As a result, the health of the monst...
['N = input()\nA = {int(x) for x in input().split()}\n\nwhile len(A) == 1:\n mn = min(A)\n A = {x % mn for x in A if x % mn != 0}\n A.add(mn)\nprint(A.pop())\n', 'N = input()\nA = {int(x) for x in input().split()}\n\nwhile len(A) != 1:\n mn = min(A)\n A = {x % mn for x in A if x % mn != 0}\n A.add(mn)...
['Wrong Answer', 'Accepted']
['s563006604', 's657339892']
[19724.0, 19724.0]
[2104.0, 83.0]
[158, 157]
p03127
u667458133
2,000
1,048,576
There are N monsters, numbered 1, 2, ..., N. Initially, the health of Monster i is A_i. Below, a monster with at least 1 health is called alive. Until there is only one alive monster, the following is repeated: * A random alive monster attacks another random alive monster. * As a result, the health of the monst...
['N = int(input())\nA = list(max(int, input().split()))\n\ndef gcd(x, y):\n if x % y == 0:\n return y\n else:\n gcd(y, x % y)\n\nnum = A[0]\nfor i in range(1, N):\n num = gcd(max(num, A[i]), min(num, A[i]))\n\nprint(num)', 'N = int(input())\nA = list(map(int, input().split()))\n \ndef gcd(x, y):\n if x % y ==...
['Runtime Error', 'Accepted']
['s591477207', 's217838326']
[11096.0, 14252.0]
[26.0, 111.0]
[214, 225]
p03127
u672494157
2,000
1,048,576
There are N monsters, numbered 1, 2, ..., N. Initially, the health of Monster i is A_i. Below, a monster with at least 1 health is called alive. Until there is only one alive monster, the following is repeated: * A random alive monster attacks another random alive monster. * As a result, the health of the monst...
['import sys\nimport math\nfrom collections import deque\n\nsys.setrecursionlimit(4100000)\n\n\ndef inputs(num_of_input):\n ins = [input() for i in range(num_of_input)]\n return ins\n\n\ndef gcd_multi(nums):\n if len(nums) == 0:\n return 0\n if len(nums) <= 2:\n return min(nums)\n\n ret = m...
['Wrong Answer', 'Accepted']
['s197320528', 's036289166']
[3316.0, 15420.0]
[21.0, 101.0]
[659, 810]
p03127
u676496404
2,000
1,048,576
There are N monsters, numbered 1, 2, ..., N. Initially, the health of Monster i is A_i. Below, a monster with at least 1 health is called alive. Until there is only one alive monster, the following is repeated: * A random alive monster attacks another random alive monster. * As a result, the health of the monst...
['def gcd(m,n):\n while n:\n m,n = n, m%n\n return m\nn = int(input())\nm = map(int,input().split())\nans = m[0]\nfor i in range(1,n):\n ans = gcd(m[i],ans)\nprint(ans)', 'def gcd(m,n):\n while n:\n m,n = n, m%n\n return m\nn = int(input())\nm = list(map(int,input().split()))\nans = m[0]\nf...
['Runtime Error', 'Accepted']
['s444100380', 's620035540']
[11096.0, 14224.0]
[30.0, 73.0]
[173, 179]
p03127
u682467216
2,000
1,048,576
There are N monsters, numbered 1, 2, ..., N. Initially, the health of Monster i is A_i. Below, a monster with at least 1 health is called alive. Until there is only one alive monster, the following is repeated: * A random alive monster attacks another random alive monster. * As a result, the health of the monst...
['from math import floor, ceil, sqrt, factorial, log\nfrom itertools import accumulate, permutations, combinations, product, combinations_with_replacement\nfrom bisect import bisect_left, bisect_right\nfrom collections import Counter, defaultdict\nfrom heapq import heappop, heappush, heappushpop\nimport sys\nINF = floa...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s141928068', 's581556071', 's219489688']
[19220.0, 19248.0, 19172.0]
[66.0, 48.0, 59.0]
[1512, 1248, 1317]
p03127
u684120680
2,000
1,048,576
There are N monsters, numbered 1, 2, ..., N. Initially, the health of Monster i is A_i. Below, a monster with at least 1 health is called alive. Until there is only one alive monster, the following is repeated: * A random alive monster attacks another random alive monster. * As a result, the health of the monst...
['import fractions\nimport functools\n\nn = int(input())\na = [int(i) for i in input().split()]\na = list(set(a))\n\nb = [i%2 for i in a if i%2 !=0]\n\nif len(b) != 0:\n print(1)\nelse:\n print(functools.reduce(fractions.gcd, a))', 'def gcd(a,b):\n if a%b == 0:\n return(a)\n else:\n return(gcd(b,a%b))\n\nn = ...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s828365216', 's885454892', 's520618849']
[16496.0, 14224.0, 14224.0]
[85.0, 2104.0, 118.0]
[217, 215, 213]
p03127
u687044304
2,000
1,048,576
There are N monsters, numbered 1, 2, ..., N. Initially, the health of Monster i is A_i. Below, a monster with at least 1 health is called alive. Until there is only one alive monster, the following is repeated: * A random alive monster attacks another random alive monster. * As a result, the health of the monst...
['# -*- coding:utf-8 -*-\nimport fractions\n\ndef solve():\n N = input()\n A = list(map(int, input().split()))\n\n \n \n\n ans = A[0]\n for i in range(1, N):\n ans = fractions.gcd(ans, A[i])\n print(ans)\n\nif __name__ == "__main__":\n solve()\n', 'def gcd(a, b):\n \n if b == 0:\n ...
['Runtime Error', 'Accepted']
['s813035672', 's922313596']
[16276.0, 14252.0]
[63.0, 125.0]
[398, 374]
p03127
u688375653
2,000
1,048,576
There are N monsters, numbered 1, 2, ..., N. Initially, the health of Monster i is A_i. Below, a monster with at least 1 health is called alive. Until there is only one alive monster, the following is repeated: * A random alive monster attacks another random alive monster. * As a result, the health of the monst...
['INFO=int(input())\n\nDATA=list(map(int, input().split(" ")))\nDATA=sorted(DATA)\n\ndef Euclidean(m,n):\n while n!=0:\n temp = n\n n = m%n\n m=temp\n return m\n \noutput=DATA[0]\nfor i in range(1,INFO):\n print(output)\n output = Euclidean(DATA[i], output)\nprint(output)', 'INFO=int...
['Wrong Answer', 'Accepted']
['s403352460', 's158054616']
[14252.0, 14224.0]
[172.0, 108.0]
[290, 271]
p03127
u712975113
2,000
1,048,576
There are N monsters, numbered 1, 2, ..., N. Initially, the health of Monster i is A_i. Below, a monster with at least 1 health is called alive. Until there is only one alive monster, the following is repeated: * A random alive monster attacks another random alive monster. * As a result, the health of the monst...
['N=int(input())\na=list(map(int,input().split()))\ndef u(x,y):\n if x%y==0:\n return y\n else:\n return u(y,x%y)\nb=list(range(N-1))\nfor i in range(1,N):\n b[i-1]=u(a[i-1],a[i])\nprint(int(b[N-2]))', 'N=int(input())\na=list(map(int,input().split()))\ndef u(x,y):\n if x%y==0:\n return ...
['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted']
['s182190553', 's692070075', 's816961065', 's561973678']
[14252.0, 14224.0, 14252.0, 14252.0]
[432.0, 97.0, 109.0, 97.0]
[210, 208, 210, 216]
p03127
u714533789
2,000
1,048,576
There are N monsters, numbered 1, 2, ..., N. Initially, the health of Monster i is A_i. Below, a monster with at least 1 health is called alive. Until there is only one alive monster, the following is repeated: * A random alive monster attacks another random alive monster. * As a result, the health of the monst...
['import random\n\nn = int(input())\nm = [int(i) for i in input().split()]\n\nwhile True:\n\ta = m.pop(random.randrange(n)); n -= 1\n\tb = m.pop(random.randrange(n)); n -= 1\n\ta -= b\n\tm.extend([a, b]); n += 2\n\tprint(m)\n\tfor i in m:\n\t\tif i <= 0:\n\t\t\tm.remove(i); n -= 1\n\tif len(m) == 1: print(m[0]); exit()...
['Runtime Error', 'Accepted']
['s479971287', 's952602918']
[142904.0, 15020.0]
[2104.0, 72.0]
[292, 172]
p03127
u729938879
2,000
1,048,576
There are N monsters, numbered 1, 2, ..., N. Initially, the health of Monster i is A_i. Below, a monster with at least 1 health is called alive. Until there is only one alive monster, the following is repeated: * A random alive monster attacks another random alive monster. * As a result, the health of the monst...
['n = int(input())\nmonsters = list(map(int, input().split()))\ndef gcd(a, b):\n if b == 0: \n return a\n else:\n return gcd(b, a%b)\ngcd(4,2)\n\ndef gcd_more(a):\n ans = a[0]\n for i in range(1,len(a)):\n ans = gcd(ans, a[i])\n return ans\ngcd_more(monsters)', 'n = int(input())\nmo...
['Wrong Answer', 'Accepted']
['s265401722', 's361329192']
[14224.0, 14224.0]
[84.0, 84.0]
[280, 287]
p03127
u732468087
2,000
1,048,576
There are N monsters, numbered 1, 2, ..., N. Initially, the health of Monster i is A_i. Below, a monster with at least 1 health is called alive. Until there is only one alive monster, the following is repeated: * A random alive monster attacks another random alive monster. * As a result, the health of the monst...
['N = int(input())\nHPs = list(map(int, input().split()))\n\nwhile len(HPs) > 1:\n HPs.sort()\n for i in range(len(HPs)-1):\n HPs[i+1] = HPs[i+1] % HPs[0]\n HPs.remove(0)\n\nprint(HPs[0])', 'N = int(input())\nHPs = list(map(int, input().split()))\n\nwhile len(HPs) > 1:\n HPs.sort()\n for i in len(...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s380244694', 's515995199', 's826050220', 's947759113']
[14224.0, 14828.0, 14224.0, 14224.0]
[145.0, 77.0, 155.0, 1705.0]
[192, 183, 235, 216]
p03127
u732870425
2,000
1,048,576
There are N monsters, numbered 1, 2, ..., N. Initially, the health of Monster i is A_i. Below, a monster with at least 1 health is called alive. Until there is only one alive monster, the following is repeated: * A random alive monster attacks another random alive monster. * As a result, the health of the monst...
['N = int(input())\nA = list(map(int, input().split()))\n\ndef gcd(a, b):\n if b == 0:\n return a\n else:\n return gcd(b, a % b)\n\nans = A[0]\nfor i in range(n):\n ans = gcd(ans, A[i])\n\n print(ans)', 'N = int(input())\nA = list(map(int, input().split()))\n\ndef gcd(a, b):\n if b == 0:\n ...
['Runtime Error', 'Runtime Error', 'Accepted']
['s149222683', 's187624843', 's276096499']
[14252.0, 14224.0, 14224.0]
[43.0, 43.0, 92.0]
[211, 207, 207]
p03127
u756782069
2,000
1,048,576
There are N monsters, numbered 1, 2, ..., N. Initially, the health of Monster i is A_i. Below, a monster with at least 1 health is called alive. Until there is only one alive monster, the following is repeated: * A random alive monster attacks another random alive monster. * As a result, the health of the monst...
['import numpy as np\nN = int(input())\nA = list(map(int,input().split()))\nflag = 0\n#mi = min(A)\nQ = np.array(A)\nan = 1\ndef toku(Q):\n mi = min(Q)\n R1 = Q % mi\n if any(R1) == 0:\n flag = 1\n an = mi\n return(R1)\n else:\n R = R1[R1!=0]\n return(R)\n\nwhile flag == 1...
['Wrong Answer', 'Accepted']
['s590593636', 's079934942']
[24356.0, 23136.0]
[181.0, 210.0]
[328, 446]
p03127
u762540523
2,000
1,048,576
There are N monsters, numbered 1, 2, ..., N. Initially, the health of Monster i is A_i. Below, a monster with at least 1 health is called alive. Until there is only one alive monster, the following is repeated: * A random alive monster attacks another random alive monster. * As a result, the health of the monst...
['def gcd(a, b):\n while b:\n a, b = b, a % b\n return a\ndef gcdl(l):\n from functools import reduce\n reduce(lambda x, y: gcd(x, y), a)\nn=input()\nprint(gcdl(list(map(int,input().split()))))', 'def gcd(a, b):\n while b:\n a, b = b, a % b\n return a\ndef gcdl(l):\n from functools im...
['Runtime Error', 'Accepted']
['s567097311', 's943038351']
[14252.0, 14252.0]
[48.0, 73.0]
[202, 209]
p03127
u782685137
2,000
1,048,576
There are N monsters, numbered 1, 2, ..., N. Initially, the health of Monster i is A_i. Below, a monster with at least 1 health is called alive. Until there is only one alive monster, the following is repeated: * A random alive monster attacks another random alive monster. * As a result, the health of the monst...
['N=input()\nA=set(map(int,input().split()))\nR=max(A)\nwhile 1:\n r=min(A)\n if r==R:break\n A=set(i if i<=r else i%r for i in A)\n A=set(i for i in A if i!=0)\n R=r\n print(A)\nprint(R)', 'input()\nA=set(map(int,input().split()))\nR=max(A)\nwhile 1:\n r=min(A)\n if r==R:break\n A=set(i%r for i in A)...
['Wrong Answer', 'Accepted']
['s120986604', 's987229647']
[19728.0, 19728.0]
[80.0, 78.0]
[193, 126]
p03127
u783420291
2,000
1,048,576
There are N monsters, numbered 1, 2, ..., N. Initially, the health of Monster i is A_i. Below, a monster with at least 1 health is called alive. Until there is only one alive monster, the following is repeated: * A random alive monster attacks another random alive monster. * As a result, the health of the monst...
['import random\nN = int(input())\nA = list(map(int, input().split()))\n\nwhile len(A) != 1:\n print(A)\n attack_monster = random.randint(0,10**9) % len(A)\n damage_monster = random.randint(0,10**9) % len(A)\n if attack_monster != damage_monster:\n A[damage_monster] = A[damage_monster] - A[attack_mon...
['Runtime Error', 'Accepted']
['s761206973', 's688367662']
[143548.0, 14252.0]
[1760.0, 71.0]
[395, 345]
p03127
u784169501
2,000
1,048,576
There are N monsters, numbered 1, 2, ..., N. Initially, the health of Monster i is A_i. Below, a monster with at least 1 health is called alive. Until there is only one alive monster, the following is repeated: * A random alive monster attacks another random alive monster. * As a result, the health of the monst...
["N = int(input())\nL = [int(s) for s in input().split(' ')]\n\nwhile len(L) > 1:\n\tL.sort()\n if L[-1] % L[0] == 0:\n L.pop()\n else:\n L[-1] = L[-1] % L[0]\nprint(L[0])", "N = int(input())\nL = [int(s) for s in input().split(' ')]\n\nwhile len(L) > 1:\n L.sort()\n L_new = [L[0]]\n for l in L[1:]:\...
['Runtime Error', 'Accepted']
['s014360880', 's188101501']
[2940.0, 14252.0]
[17.0, 158.0]
[175, 204]
p03127
u795021383
2,000
1,048,576
There are N monsters, numbered 1, 2, ..., N. Initially, the health of Monster i is A_i. Below, a monster with at least 1 health is called alive. Until there is only one alive monster, the following is repeated: * A random alive monster attacks another random alive monster. * As a result, the health of the monst...
['N = int(input())\nlista = list(set(sorted(list(map(int, input().split())))))\nlength = len(lista)\nwhile length>1:\n print(length)\n print(lista)\n for n in range(1, length):\n print(lista[n-1])\n lista[n] = lista[n]%lista[0]\n print(lista)\n lista.sort()\n print(lista)\n lista = li...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s670056725', 's966464835', 's205856837']
[69520.0, 14864.0, 14864.0]
[2108.0, 236.0, 154.0]
[428, 394, 369]
p03127
u800396927
2,000
1,048,576
There are N monsters, numbered 1, 2, ..., N. Initially, the health of Monster i is A_i. Below, a monster with at least 1 health is called alive. Until there is only one alive monster, the following is repeated: * A random alive monster attacks another random alive monster. * As a result, the health of the monst...
['N = int(input())\nA = list(map(int,input().split()))\n\n\n# ans = set()\n# for a in A:\n# if a%v!=0:\n# ans.add(a%v)\n# ans.add(v)\n# return ans\n\n# while len(A)>1:\n# A = helper(A)\n# print(min(A))\ndef gcd(x,y):\n if y==0: return x\n return gcd(y,x%y)\nans = A[0]\nfor ...
['Runtime Error', 'Accepted']
['s434452235', 's365913251']
[14252.0, 14224.0]
[42.0, 84.0]
[371, 165]
p03127
u810356688
2,000
1,048,576
There are N monsters, numbered 1, 2, ..., N. Initially, the health of Monster i is A_i. Below, a monster with at least 1 health is called alive. Until there is only one alive monster, the following is repeated: * A random alive monster attacks another random alive monster. * As a result, the health of the monst...
["import sys\ndef input(): return sys.stdin.readline().rstrip()\nimport numpy as np\ndef main():\n n=int(input())\n A=np.array([int(_) for _ in input().split()])\n while A.size>1:\n min_A=np.min(A)\n A=np.fmod(A,min_A)\n A=A[A>0]\n A=np.append(A,min_A)\n print(A)\n print(A...
['Wrong Answer', 'Accepted']
['s056962973', 's836076574']
[23120.0, 23116.0]
[187.0, 187.0]
[352, 335]
p03127
u812587837
2,000
1,048,576
There are N monsters, numbered 1, 2, ..., N. Initially, the health of Monster i is A_i. Below, a monster with at least 1 health is called alive. Until there is only one alive monster, the following is repeated: * A random alive monster attacks another random alive monster. * As a result, the health of the monst...
['\nN = int(input())\nA = list(map(int, input().split()))\n\nwhile(len(set(A)) != 1):\n print(A)\n for i in range(N):\n if A[i] > min(A):\n time = A[i] // min(A)\n if time == 1:\n A[i] =A[i] - time * min(A)\n else:\n A[i] =A[i] - (time - 1) *...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s184888026', 's626339977', 's190182931']
[14480.0, 142676.0, 14480.0]
[2108.0, 2104.0, 257.0]
[373, 272, 371]
p03127
u813450934
2,000
1,048,576
There are N monsters, numbered 1, 2, ..., N. Initially, the health of Monster i is A_i. Below, a monster with at least 1 health is called alive. Until there is only one alive monster, the following is repeated: * A random alive monster attacks another random alive monster. * As a result, the health of the monst...
['n = int(input())\na = list(map(int, input().split()))\na.sort()\nwhile len(a) >= 2 :\n k = a[1] % a[0]\n if k == 0 :\n a.pop(1)\n else :\n a[1] = k\n a.sort()\n print(a)\n if a[0] == 1 :\n break\nprint(a[0])\n', 'n = int(input())\na = list(map(int, input().split()))\na.sort()\nw...
['Runtime Error', 'Accepted']
['s483334489', 's795104859']
[142648.0, 14252.0]
[1866.0, 1595.0]
[234, 207]
p03127
u814781830
2,000
1,048,576
There are N monsters, numbered 1, 2, ..., N. Initially, the health of Monster i is A_i. Below, a monster with at least 1 health is called alive. Until there is only one alive monster, the following is repeated: * A random alive monster attacks another random alive monster. * As a result, the health of the monst...
['n = int(input())\narray = [int(k) for k in input().split()]\narray.reverse()\nresult = 0\nm = 0\nfor i, num in enumerate(array):\n if i == 0:\n m = num\n else:\n if m % num != 0:\n result += num - m % num\nprint(result)', 'N = int(input())\nMONSTER = list(map(int, input().split()))\n\nd...
['Wrong Answer', 'Accepted']
['s597376324', 's785790014']
[14224.0, 14224.0]
[87.0, 97.0]
[239, 254]
p03127
u815666840
2,000
1,048,576
There are N monsters, numbered 1, 2, ..., N. Initially, the health of Monster i is A_i. Below, a monster with at least 1 health is called alive. Until there is only one alive monster, the following is repeated: * A random alive monster attacks another random alive monster. * As a result, the health of the monst...
['infa = 10**10\nn = int(input())\na = list(map(int,input().split()))\n\nfor k in range(infa):\n mina = min(a)\n print("ループ")\n\n for i in range(len(a)):\n \n if a[i] == mina:\n a[i] = mina\n else:\n a[i] = a[i] % mina\n \n a = [j for j in a if not j == 0]\n\n ...
['Wrong Answer', 'Accepted']
['s227172094', 's475090708']
[14252.0, 14224.0]
[104.0, 108.0]
[363, 340]
p03127
u823885866
2,000
1,048,576
There are N monsters, numbered 1, 2, ..., N. Initially, the health of Monster i is A_i. Below, a monster with at least 1 health is called alive. Until there is only one alive monster, the following is repeated: * A random alive monster attacks another random alive monster. * As a result, the health of the monst...
['import math\nfrom functools import reduce\nprint(reduce(math.gcd,map(int,input().split())))', 'import math\nprint(reduce(math.gcd,map(int,input().split())))', 'import math\nimport functools\ninput()\nprint(functools.reduce(math.gcd,map(int,input().split())))']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s166649349', 's473562248', 's260646112']
[9576.0, 9108.0, 17568.0]
[33.0, 25.0, 56.0]
[89, 60, 95]
p03127
u824237520
2,000
1,048,576
There are N monsters, numbered 1, 2, ..., N. Initially, the health of Monster i is A_i. Below, a monster with at least 1 health is called alive. Until there is only one alive monster, the following is repeated: * A random alive monster attacks another random alive monster. * As a result, the health of the monst...
['import numpy as np\n\nn = int(input())\nx = list(map(int, input().split()))\n\ndef numpy_gcd(a, b):\n a, b = np.broadcast_arrays(a, b)\n a = a.copy()\n b = b.copy()\n pos = np.nonzero(b)[0]\n while len(pos) > 0:\n b2 = b[pos]\n a[pos], b[pos] = b2, a[pos] % b2\n pos = pos[b[pos] !=...
['Runtime Error', 'Runtime Error', 'Accepted']
['s123110486', 's305564962', 's619828108']
[23084.0, 5132.0, 14252.0]
[182.0, 19.0, 248.0]
[481, 322, 324]
p03127
u828365778
2,000
1,048,576
There are N monsters, numbered 1, 2, ..., N. Initially, the health of Monster i is A_i. Below, a monster with at least 1 health is called alive. Until there is only one alive monster, the following is repeated: * A random alive monster attacks another random alive monster. * As a result, the health of the monst...
['input()\nA = list(map(int, input().split(" ")))\nA.sort()\ndef gcd(a, b):\n while b:\n a, b = b, a%b\n return a\nrtn = 0\nfor i in range(0,len(A)-1):\n print(A[i], A[i+1], gcd(A[i], A[i+1]))\n A[i+1] = gcd(A[i], A[i+1])\nprint(A[-1])', 'input()\nA = list(map(int, input().split(" ")))\nA.sort()\ndef...
['Wrong Answer', 'Accepted']
['s378749837', 's487212071']
[14252.0, 14252.0]
[333.0, 126.0]
[241, 198]
p03127
u840958781
2,000
1,048,576
There are N monsters, numbered 1, 2, ..., N. Initially, the health of Monster i is A_i. Below, a monster with at least 1 health is called alive. Until there is only one alive monster, the following is repeated: * A random alive monster attacks another random alive monster. * As a result, the health of the monst...
['n=int(input())\na=list(map(int,input().split()))\nwhile len(a)>1:\n s=min(a)\n a = list(map(lambda x:x-min(a), a))\n a = [i for i in a if i != 0]+[s]\nprint(int(a))', 'n=int(input())\na=list(map(int,input().split()))\namin=min(a)\nwhile len(a)>1:\n s=min(a)\n a = list(map(lambda x:x%s, a))\n a = [i ...
['Runtime Error', 'Accepted']
['s067013360', 's528173561']
[15020.0, 14224.0]
[2104.0, 82.0]
[167, 171]
p03127
u844902298
2,000
1,048,576
There are N monsters, numbered 1, 2, ..., N. Initially, the health of Monster i is A_i. Below, a monster with at least 1 health is called alive. Until there is only one alive monster, the following is repeated: * A random alive monster attacks another random alive monster. * As a result, the health of the monst...
['import fraction\nn = int(input())\na = list(map(int,input().split()))\nans = a[0]\n\nfor i in range(1,len(a)):\n ans =fraction.gcd(ans,a[i])\nprint(ans)', 'n = int(input())\na = list(map(int,input().split()))\nans = a[0]\n\ndef gcd(x,y):\n d = 0\n if max(x,y) == x:\n x,y = y,x\n while True:\n ...
['Runtime Error', 'Accepted']
['s104129571', 's955436686']
[2940.0, 14252.0]
[18.0, 89.0]
[146, 301]
p03127
u863150907
2,000
1,048,576
There are N monsters, numbered 1, 2, ..., N. Initially, the health of Monster i is A_i. Below, a monster with at least 1 health is called alive. Until there is only one alive monster, the following is repeated: * A random alive monster attacks another random alive monster. * As a result, the health of the monst...
['Keita [9:48 PM]\nimport numpy as np\n\nN=int(input()) \nlistA = list(map(int,input().split()))\n\nminA = min(listA)\n\nwhile True:\n minA = min(listA)\n minApos = np.argmin(listA)\n listA = [x % minA for x in listA]\n listA[minApos] = minA\n listA= [x for x in listA if x >0]\n if len(set(listA))==1:\n ...
['Runtime Error', 'Accepted']
['s958279022', 's130599261']
[2940.0, 23108.0]
[17.0, 217.0]
[333, 320]
p03127
u866769581
2,000
1,048,576
There are N monsters, numbered 1, 2, ..., N. Initially, the health of Monster i is A_i. Below, a monster with at least 1 health is called alive. Until there is only one alive monster, the following is repeated: * A random alive monster attacks another random alive monster. * As a result, the health of the monst...
['N = int(input())\nA = list(map(int,input().split()))\nfor main_loop in range (0,N): \n A.sort()\n de = A.count(0)\n del A[:de]\n li = len(A)\n if A[0] == 1:\n break\n print(A)\n for x in range(1,li):\n A[x] = A[x]%A[0]\n print(A[x])\nprint(A[0])', 'N = int(input())\nA = li...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s263645564', 's781195207', 's388012132']
[14224.0, 14252.0, 14224.0]
[393.0, 138.0, 142.0]
[277, 259, 250]
p03127
u883203948
2,000
1,048,576
There are N monsters, numbered 1, 2, ..., N. Initially, the health of Monster i is A_i. Below, a monster with at least 1 health is called alive. Until there is only one alive monster, the following is repeated: * A random alive monster attacks another random alive monster. * As a result, the health of the monst...
['N = int(input())\n\ndata = [int(i) for i in input().split()]\n\ni = 0\ndef euq(x,y):\n a = max(x,y)\n b = min(x,y)\n if a % b == 0:\n return b\n else:\n \treturn euq(b, a % b)\n \nprint(data)\n\nwhile i < N-1:\n com = euq(data[i],data[i + 1])\n data[i+1] = com\n i += 1\n \n \n\nprint(com)\n', 'N = in...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s548912952', 's859785470', 's095610386']
[14252.0, 14224.0, 14224.0]
[150.0, 151.0, 91.0]
[283, 283, 224]
p03127
u887207211
2,000
1,048,576
There are N monsters, numbered 1, 2, ..., N. Initially, the health of Monster i is A_i. Below, a monster with at least 1 health is called alive. Until there is only one alive monster, the following is repeated: * A random alive monster attacks another random alive monster. * As a result, the health of the monst...
['import sys \nstdin = sys.stdin\nns = lambda : stdin.readline().rstrip()\nni = lambda : int(ns())\nna = lambda : map(int, stdin.readline().split())\n\nn = ni()\na = list(na())\n\ndef gcd(n, m):\n while m:\n n, m = m, n%m\n return n\n\nans = 1\nfor e in a:\n ans = gcd(ans, e)\nprint(ans)', 'import sys \nstdin = s...
['Wrong Answer', 'Accepted']
['s761558936', 's152238564']
[14172.0, 14172.0]
[71.0, 68.0]
[275, 283]
p03127
u892796322
2,000
1,048,576
There are N monsters, numbered 1, 2, ..., N. Initially, the health of Monster i is A_i. Below, a monster with at least 1 health is called alive. Until there is only one alive monster, the following is repeated: * A random alive monster attacks another random alive monster. * As a result, the health of the monst...
['n = int(input())\na = sorted(list(map(int, input().split())))\nwhile True:\n a = list(set(a))\n tmp = a[:]\n for i in tmp:\n if i == a[0]:\n continue\n elif i % a[0] == 0:\n a.remove(i)\n else:\n a.append(i % a[0])\n a.sort()\n if len(a) == 1:\n ...
['Time Limit Exceeded', 'Accepted']
['s796860504', 's256416705']
[84204.0, 14864.0]
[2106.0, 334.0]
[326, 431]
p03127
u902468164
2,000
1,048,576
There are N monsters, numbered 1, 2, ..., N. Initially, the health of Monster i is A_i. Below, a monster with at least 1 health is called alive. Until there is only one alive monster, the following is repeated: * A random alive monster attacks another random alive monster. * As a result, the health of the monst...
['import fraction as math\n\nfrom functools import reduce\n\ndef gcd(*numbers):\n return reduce(math.gcd, numbers)\n\ninput()\n\nli = [int(i) for i in input().split(" ")]\n\nprint(gcd(*li))', 'from functools import reduce\n\ndef mgcd(a, b):\n while b:\n a, b = b, a % b\n return a\n\ndef gcd(*numbers):\n...
['Runtime Error', 'Accepted']
['s483388260', 's737009383']
[2940.0, 14596.0]
[17.0, 73.0]
[179, 218]
p03127
u902973687
2,000
1,048,576
There are N monsters, numbered 1, 2, ..., N. Initially, the health of Monster i is A_i. Below, a monster with at least 1 health is called alive. Until there is only one alive monster, the following is repeated: * A random alive monster attacks another random alive monster. * As a result, the health of the monst...
['N = int(input())\nA = list(map(int, input().split()))\n\ndp = [[max(A) + 1 for _ in range(N)] for _ in range(max(A) + 1)]\nfor i in range(N):\n dp[0][i] = A[i]\nfor i in range(max(A)):\n for j in range(N):\n for k in range(N):\n if not j == k:\n if not dp[i][j] - dp[i][k] <= 0:\...
['Wrong Answer', 'Accepted']
['s089078395', 's906080418']
[314612.0, 14224.0]
[2125.0, 96.0]
[458, 258]
p03127
u916908463
2,000
1,048,576
There are N monsters, numbered 1, 2, ..., N. Initially, the health of Monster i is A_i. Below, a monster with at least 1 health is called alive. Until there is only one alive monster, the following is repeated: * A random alive monster attacks another random alive monster. * As a result, the health of the monst...
['import random\n\nN = int(input())\nhps = list(map(int, input().split()))\n\ndef is_fighting(hps):\n suverve = 0\n for hp in hps:\n if hp > 0:\n suverve += 1\n\n if suverve == 1:\n return False\n return True\n\ndef can_atack(hp):\n if hp <= 0:\n return False\n return T...
['Wrong Answer', 'Accepted']
['s880915516', 's388975851']
[15404.0, 14252.0]
[2104.0, 113.0]
[605, 229]
p03127
u922416423
2,000
1,048,576
There are N monsters, numbered 1, 2, ..., N. Initially, the health of Monster i is A_i. Below, a monster with at least 1 health is called alive. Until there is only one alive monster, the following is repeated: * A random alive monster attacks another random alive monster. * As a result, the health of the monst...
['N =int(input())\nA = list(map(int, input().split()))\n\n\n\ndef gcd(x,y): \n while y != 0:\n x , y = y , x % y \n return x\n\n\n\n\n\n\ndef gcd(A):\n ans = A[0]\n for i in range(1,N) #range(1,N)= 1,2,...,N-1\n ans = gcd(ans, A[i])\n return ans\nprint(gcd(A))', 'N =int(input())\nA = list(m...
['Runtime Error', 'Accepted']
['s553881564', 's049467087']
[2940.0, 14228.0]
[18.0, 70.0]
[376, 379]
p03127
u937529125
2,000
1,048,576
There are N monsters, numbered 1, 2, ..., N. Initially, the health of Monster i is A_i. Below, a monster with at least 1 health is called alive. Until there is only one alive monster, the following is repeated: * A random alive monster attacks another random alive monster. * As a result, the health of the monst...
['n = map(int, input().split())\nx = list(map(int, input().split()))\ns = math.gcd(x[0],x[1])\nfor i in x:\n s = math.gcd(s,i)\n\nprint(s)', 'import math\nn = int(input())\nl = [int(i) for i in input().split()]\n\ndef gcd(x, y):\n if y == 0:\n return x\n else:\n return gcd(y, x % y) \ns = gcd(l[0...
['Runtime Error', 'Accepted']
['s552679110', 's831739459']
[14252.0, 14252.0]
[41.0, 88.0]
[133, 229]
p03127
u940990031
2,000
1,048,576
There are N monsters, numbered 1, 2, ..., N. Initially, the health of Monster i is A_i. Below, a monster with at least 1 health is called alive. Until there is only one alive monster, the following is repeated: * A random alive monster attacks another random alive monster. * As a result, the health of the monst...
['from functools import reduce\n\ndef gcd(a, b):\n if a < b:\n a, b = b, a\n if b == 0:\n return a\n c = a % b\n return gcd(b, c)\n\nnumbers = [int(x) for x in input().split()]\nprint(reduce(gcd, numbers))', 'from functools import reduce\n\ndef gcd(a, b):\n if a < b:\n a, b = b, a\n ...
['Wrong Answer', 'Accepted']
['s202432633', 's318495290']
[3700.0, 14748.0]
[24.0, 78.0]
[218, 235]
p03127
u941753895
2,000
1,048,576
There are N monsters, numbered 1, 2, ..., N. Initially, the health of Monster i is A_i. Below, a monster with at least 1 health is called alive. Until there is only one alive monster, the following is repeated: * A random alive monster attacks another random alive monster. * As a result, the health of the monst...
['import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time\n\nsys.setrecursionlimit(10**7)\ninf=10**20\nmod=10**9+7\n\ndef LI(): return list(map(int,input().split()))\ndef I(): return int(input())\ndef LS(): return input().split()\ndef S(): return input()\n\ndef main():\n n=I()\n l=LI(...
['Wrong Answer', 'Accepted']
['s339430931', 's822715532']
[16600.0, 16604.0]
[83.0, 86.0]
[459, 434]
p03127
u945418216
2,000
1,048,576
There are N monsters, numbered 1, 2, ..., N. Initially, the health of Monster i is A_i. Below, a monster with at least 1 health is called alive. Until there is only one alive monster, the following is repeated: * A random alive monster attacks another random alive monster. * As a result, the health of the monst...
['#C\nn = int(input())\naa = list(map(int,input().split()))\n\nprint(aa)\ndef mod(xx):\n bb=[]\n for i in range(len(xx)):\n b = xx[i] if (0<xx[i] and xx[i] <= min(xx)) else xx[i] % min(xx)\n if b>0:\n bb.append(b)\n return bb\n\nwhile True:\n bb = mod(aa)\n # print(bb)\n if mi...
['Wrong Answer', 'Accepted']
['s985789976', 's804388550']
[14252.0, 14252.0]
[2104.0, 73.0]
[356, 175]
p03127
u957722693
2,000
1,048,576
There are N monsters, numbered 1, 2, ..., N. Initially, the health of Monster i is A_i. Below, a monster with at least 1 health is called alive. Until there is only one alive monster, the following is repeated: * A random alive monster attacks another random alive monster. * As a result, the health of the monst...
['n=int(input())\nl=list(map(int,input().split()))\nans=0\ndef gcd(a,b):\n if b==0:return a\n return gcd(b,a%b)\nif n==1:\n ans=x[0]\nelse:\n element = gcd(x[0], x[1])\n if n==2:\n ans=element\n else:\n for i in range(2,n):\n element=gcd(element,x[i])\n ans=element\nprint...
['Runtime Error', 'Accepted']
['s738882370', 's053732021']
[14252.0, 14252.0]
[42.0, 87.0]
[307, 307]
p03127
u963903527
2,000
1,048,576
There are N monsters, numbered 1, 2, ..., N. Initially, the health of Monster i is A_i. Below, a monster with at least 1 health is called alive. Until there is only one alive monster, the following is repeated: * A random alive monster attacks another random alive monster. * As a result, the health of the monst...
['N = int(input())\nl = [int(i) for i in input().split()]\n\nl = sorted(l)\n\nsema = True\nfor i in range(len(l)):\n for j in range(i + 1,len(l)):\n if not l[j] % l[i] == 0:\n sema = False\n break\npre = min(l)\nif sema == True:\n print(pre)\nelse:\n m = l[1] % l[0]\n for i in r...
['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted']
['s069295111', 's422702556', 's574904639', 's754802112', 's691012200']
[14356.0, 14252.0, 16276.0, 190896.0, 14596.0]
[2104.0, 131.0, 65.0, 2115.0, 86.0]
[421, 401, 165, 405, 234]
p03127
u978261660
2,000
1,048,576
There are N monsters, numbered 1, 2, ..., N. Initially, the health of Monster i is A_i. Below, a monster with at least 1 health is called alive. Until there is only one alive monster, the following is repeated: * A random alive monster attacks another random alive monster. * As a result, the health of the monst...
['def main():\n _ = input()\n monsters = [int(n) for n in input().split(" ")]\n max_gcd = reduce(math.gcd, monsters)\n print(max_gcd)\n\nif __name__ == "__main__":\n main()', 'from functools import reduce\n\ndef gcd(a, b):\n x = max(a, b)\n y = min(a, b)\n if x % y == 0:\n return y\n e...
['Runtime Error', 'Accepted']
['s523474482', 's578137807']
[14224.0, 14596.0]
[45.0, 98.0]
[178, 421]
p03127
u986985627
2,000
1,048,576
There are N monsters, numbered 1, 2, ..., N. Initially, the health of Monster i is A_i. Below, a monster with at least 1 health is called alive. Until there is only one alive monster, the following is repeated: * A random alive monster attacks another random alive monster. * As a result, the health of the monst...
["from sys import stdin, exit\nfrom math import factorial\ninput = stdin.readline\nlmi = lambda: list(map(int, input().split()))\nmi = lambda: map(int, input().split())\nsi = lambda: input().strip('\\n')\nssi = lambda: input().strip('\\n').split()\n\nn = int(input())\narr = lmi()\na = min(arr)\nfor i in range(n):\n ...
['Wrong Answer', 'Accepted']
['s485796327', 's560843730']
[14252.0, 14168.0]
[62.0, 89.0]
[331, 394]
p03127
u994521204
2,000
1,048,576
There are N monsters, numbered 1, 2, ..., N. Initially, the health of Monster i is A_i. Below, a monster with at least 1 health is called alive. Until there is only one alive monster, the following is repeated: * A random alive monster attacks another random alive monster. * As a result, the health of the monst...
['n=int(input())\nA=list(map(int,input().split()))\ndef gcd(a,b):\n if b==0:\n return(a)\n else:\n return(gcd(b,b%a))\nans=A[0]\nfor i in range(n-1):\n ans=gcd(ans,A[i+1])\nprint(ans)\n', 'n=int(input())\nA=list(map(int,input().split()))\ndef gcd(a,b):\n if b>a:\n return(gcd(b,a))\n ...
['Wrong Answer', 'Accepted']
['s956739438', 's850608107']
[14252.0, 15020.0]
[105.0, 94.0]
[195, 234]
p03128
u013408661
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
['n,m=map(int,input().split())\na=list(map(int,input().split()))\ndp=[0]*(n+1)\nans=[0]*(n+1)\nnum=[0,2,5,5,4,5,6,3,7,6]\nINF=10**18\nfor i in range(1,n+1):\n stack=[]\n for j in m:\n if i-num[j]>=0:\n stack.append(dp[i-num[j]])\n else:\n stack.append(-INF)\n dp[i]=max(stack)+1\n if dp[i]>0:\n an...
['Runtime Error', 'Wrong Answer', 'Accepted']
['s224450623', 's643678483', 's015871971']
[3188.0, 14332.0, 14824.0]
[18.0, 304.0, 387.0]
[403, 403, 549]
p03128
u016567570
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
['N, M = map(int, input().split())\nA_list = list(map(int, input().split()))\ncost_Dict = {1:2, 2:5, 3:5, 4:4, 5:5, 6:6, 7:3, 8:7, 9:6}\nA_Dict = {}\nfor x in A_list:\n A_Dict[x] = cost_Dict[x]\nmin_digit = min(A_Dict, key=A_Dict.get)\nmin_cost = min(A_Dict.values())\nmin_num = min_cost\nlow_digit_num = (N // min_num)...
['Wrong Answer', 'Accepted']
['s199445885', 's321281056']
[3064.0, 3420.0]
[19.0, 96.0]
[554, 742]
p03128
u025235255
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
['n, m = map(int, input().split())\na = list(map(int, input().split()))\nuse = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6]\ndp = [[0] * 10 for i in range(n+1)]\n\ndef makenum(x,y):\n res = 0\n for i in range(y):\n res = res* 10 + x\n return res\n \nfor i in range(1,n+1):\n kouho = []\n for j in a:\n ...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s293434613', 's872203354', 's822093807']
[4900.0, 4884.0, 4972.0]
[2104.0, 2104.0, 127.0]
[1060, 946, 615]
p03128
u029169777
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
['N,M=map(int,input().split())\n\nA=list(map(int,input().split()))\nA.sort(reverse=True)\nhonsuu=[0,2,5,5,4,5,6,3,7,6]\n\ndef ketadp(N,M,A):\n dp=[0]*(N+1)\n for i in range(N):\n for j in A:\n if (i+1-honsuu[j])==0 or (i+1-honsuu[j]>0 and dp[i+1-honsuu[j]]!=0):\n dp[i+1]=max(dp[i+1],dp[i+1-honsuu[j]]+1...
['Runtime Error', 'Accepted']
['s788347876', 's527822160']
[3368.0, 3368.0]
[2104.0, 110.0]
[587, 673]
p03128
u034128150
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
['def max_for_str(a, b):\n if len(a) > len(b):\n return a\n elif len(a) < len(b):\n return b\n else:#This case is unlikely to happen.\n for c1, c2 in zip(a, b):\n if c1 > c2:\n return a\n elif c1 < c2:\n return b\n return a\n ...
['Wrong Answer', 'Accepted']
['s388926722', 's525913747']
[27764.0, 28916.0]
[86.0, 179.0]
[806, 739]
p03128
u046187684
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
['def solve(string):\n n, m, *a = map(int, string.split())\n needs = {i + 1: n for i, n in enumerate(map(int, "2 5 5 4 5 6 3 7 6".split()))}\n if 2 in a and 5 in a:\n a.remove(2)\n if 3 in a and 5 in a:\n a.remove(3)\n if 2 in a and 3 in a:\n a.remove(2)\n if 6 in a and 9 in a:\n ...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s511016319', 's974589442', 's914381507']
[3064.0, 3188.0, 3064.0]
[18.0, 19.0, 18.0]
[1116, 1216, 1064]
p03128
u047023156
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
["import sys\nfrom operator import itemgetter\nfrom collections import deque\ninput = sys.stdin.readline\n\nN, M = map(int, input().split())\nA = list(map(int, input().split()))\nB = [i for i in range(1, 10)]\nC = [2, 5, 5, 4, 5, 6, 3, 7, 6]\ninf = float('inf')\ncosts = {m: C[m-1] for m in A}\nprint(costs)\ndp = deque(...
['Wrong Answer', 'Accepted']
['s833191430', 's903570619']
[4060.0, 4060.0]
[79.0, 78.0]
[786, 773]
p03128
u047816928
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
["cost = [None,2,5,5,4,5,6,3,7,6]\n\nAset = {}\nfor a in A:\n c = cost[a]\n Aset[c] = max(Aset[c], a) if c in Aset else a\nA = sorted([v for k,v in Aset.items()])\n\ndp = [None]*(N+1)\ndp[0] = (0,[0]*len(A))\n\nfor ia, a in enumerate(A):\n c = cost[a]\n for i in range(c, N+1):\n t = dp[i-c]\n ...
['Runtime Error', 'Accepted']
['s651160326', 's775682498']
[3064.0, 6388.0]
[18.0, 53.0]
[520, 595]
p03128
u054106284
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
['N, M = (int(i) for i in input().split())\nA = [int(i) for i in input().split()]\nnum = [0,2,5,5,4,5,6,3,7,6]\n\nDP = [0] * (N+1)\n\nfor i in range(N+1):\n for j in range(M):\n n = num[A[j]]\n if i - n >= 0:\n DP[i] = max(DP[i], DP[i-n]+1)\n\nA.sort(reverse = True)\n\nans = ""\nremain = DP[...
['Time Limit Exceeded', 'Accepted']
['s380459567', 's848358886']
[3348.0, 4028.0]
[2104.0, 88.0]
[520, 713]
p03128
u057109575
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
['def printing(a_start, a_2, n):\n a_3 = []\n mod_list = []\n \n for i in range(len(a_2)):\n if (a_2[i][1] % a_start[1] not in mod_list) and (a_2[i][1] % a_start[1] != 0):\n a_3.append(a_2[i])\n mod_list.append(a_2[i][1] % a_start[1])\n \n a_3.sort(key=lambda x: x[1], reverse=True)\n if len(a_3) >= ...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s190424983', 's646379449', 's688329227', 's069778449']
[3192.0, 3444.0, 3192.0, 16496.0]
[18.0, 22.0, 18.0, 108.0]
[1288, 1293, 1287, 416]
p03128
u062459048
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
['n,m = map(int,input().split())\nA = list(map(int,input().split()))\n\nsu = [0,2,5,5,4,5,6,3,7,6]\n\ndp = [0]*(n+1)\n\nfor i in range(1,n+1):\n for j in A:\n if i >= su[j]:\n dp[i] = max(dp[i],dp[i-su[j]]*10+j)\n \nprint(dp[-1])\n \n\n\n\n', 'n,m = map(int,input().split())\nA = list(map(int,input().spli...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s787964138', 's923939928', 's372298347']
[14388.0, 3060.0, 14516.0]
[148.0, 68.0, 150.0]
[236, 231, 240]
p03128
u064408584
2,000
1,048,576
Find the largest integer that can be formed with exactly N matchsticks, under the following conditions: * Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9). * The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respe...
["n,m=map(int, input().split())\nmt=[0,2,5,5,4,5,6,3,7,6]\na=sorted(map(int, input().split()))\ndp=['']*(n+1)\ndp[0]='*'\nfor i in range(n+1):\n if not dp[i]:continue\n for j in a:\n if i+mt[j]<n+1:\n dp[i+mt[j]]=dp[i]+str(j)\nprint(dp[-1][1:])", "n,m=map(int, input().split())\nhon=[2,5,5,4,5,6,...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s598451458', 's845161500', 's198082748']
[29684.0, 4212.0, 14708.0]
[105.0, 32.0, 165.0]
[256, 737, 271]