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 |
|---|---|---|---|---|---|---|---|---|---|---|
p03061 | u480200603 | 2,000 | 1,048,576 | There are N integers, A_1, A_2, ..., A_N, written on the blackboard. You will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written. Find the maximum possible greatest common divisor of the N integers on the blackboard afte... | ['import functools\nimport fractions\nn = int(input())\nvalues = list(map(int, input().split()))\nm = 1\n\nfor i in range(n):\n a = values[:]\n a.pop(i)\n gcd = functools.reduce(fractions.gcd, a)\n if m < gcd:\n m = gcd\n\n\nprint(m)\n', 'n = int(input())\nv = list(map(int, input().split()))\nm = 1\n... | ['Time Limit Exceeded', 'Accepted'] | ['s136591856', 's939612869'] | [16140.0, 14052.0] | [2104.0, 216.0] | [237, 516] |
p03061 | u480847874 | 2,000 | 1,048,576 | There are N integers, A_1, A_2, ..., A_N, written on the blackboard. You will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written. Find the maximum possible greatest common divisor of the N integers on the blackboard afte... | ['N = int(input())\nA = list(map(int, input().split()))\n\n\ndef gcd(a,b):\n if b == 0:\n return a\n return gcd(b, a % b)\n\n\ndef m():\n left, right = A.copy(), A.copy()\n for i in range(1, N):\n left[i] = gcd(A[i], left[i-1])\n\n for i in reversed(range(0, N-1)):\n right[i] = gcd(A... | ['Wrong Answer', 'Accepted'] | ['s229833777', 's050060784'] | [14428.0, 14432.0] | [182.0, 180.0] | [461, 461] |
p03061 | u483156389 | 2,000 | 1,048,576 | There are N integers, A_1, A_2, ..., A_N, written on the blackboard. You will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written. Find the maximum possible greatest common divisor of the N integers on the blackboard afte... | ['import math\nn=int(input())\nl = list(map(int, input().split()))\nans=1;\nfor i in range(n):\n\tans=max(math.gcd(math.gcd(l[0],l[i-1]),math.gcd(l[i],l[n-1])),ans)\nprint(ans)', 'def gcd(a,b):\n\twhile b:\n\t\ta,b=b,a%b\n\treturn a\nn=int(input())\nl = list(map(int, input().split()))\nans=1;\nm=[0]*(n+1)\no=[0]*(n+1)\... | ['Runtime Error', 'Accepted'] | ['s256405408', 's100191768'] | [14588.0, 14584.0] | [42.0, 187.0] | [167, 259] |
p03061 | u483645888 | 2,000 | 1,048,576 | There are N integers, A_1, A_2, ..., A_N, written on the blackboard. You will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written. Find the maximum possible greatest common divisor of the N integers on the blackboard afte... | ["import math\nfrom functools import reduce \nfrom fractions import gcd\nn = int(input())\n*v, = map(int,input().split())\n#print(v)\n\nmn = 0\nfor i in range(n):\n c = v.copy()\n #print('c',c)\n c.pop(i)\n #print('c2',c)\n ans = reduce(gcd,c)\n #print('v',v)\n #print('ans',ans)\n if ans > mn:\n mn = ans\n ... | ['Time Limit Exceeded', 'Accepted'] | ['s990518493', 's319561650'] | [16148.0, 14076.0] | [2104.0, 215.0] | [312, 273] |
p03061 | u486990800 | 2,000 | 1,048,576 | There are N integers, A_1, A_2, ..., A_N, written on the blackboard. You will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written. Find the maximum possible greatest common divisor of the N integers on the blackboard afte... | ['import math\nfrom functools import reduce\nimport fractions\nimport numpy as np\ndef gcd_list(numbers):\n return reduce(fractions.gcd, numbers)\n\nN = int(input())\nA = list(map(int, input().split()))\nans=0\nfor i in range(N):\n a = A[0]\n del A[0]\n \n b = gcd_list(A)\n if ans < b:\n ans = ... | ['Time Limit Exceeded', 'Runtime Error', 'Accepted'] | ['s581484838', 's720835237', 's026241357'] | [24536.0, 24544.0, 14436.0] | [2112.0, 181.0, 217.0] | [340, 354, 454] |
p03061 | u491656579 | 2,000 | 1,048,576 | There are N integers, A_1, A_2, ..., A_N, written on the blackboard. You will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written. Find the maximum possible greatest common divisor of the N integers on the blackboard afte... | ['def gcd(x,y):\n if y==0:\n return x\n else:\n return gcd(y,x%y)\n\nn=int(input())\na_array=[int(a) for a in input().split()]\n\nfor i in range(1, n-1):\n a=gcd(a,a_array[i])\n left_gcd.append(a)\n\nright_gcd=[a_array[-1]]\nfor i in range(n-2,0,-1):\n b=gcd(b,a_array[i])\n right_gcd.app... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s629043186', 's951153923', 's016250863'] | [14052.0, 14428.0, 14076.0] | [46.0, 216.0, 216.0] | [446, 476, 817] |
p03061 | u495903598 | 2,000 | 1,048,576 | There are N integers, A_1, A_2, ..., A_N, written on the blackboard. You will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written. Find the maximum possible greatest common divisor of the N integers on the blackboard afte... | ['\n# coding: utf-8\n\n# In[1]:\n\nN = int(input())\nA = list(map(int, input().split()))\n\n\n# In[2]:\n\nimport copy\n#import numpy as np\n\n\n# In[3]:\n\ndef get_divisor_list(A):\n divisor_list = [1]\n if A == 1:\n return divisor_list\n else:\n for i in range(2, A//2+1):\n if A%i == ... | ['Runtime Error', 'Accepted'] | ['s661936659', 's761735546'] | [28176.0, 14076.0] | [2104.0, 189.0] | [1115, 995] |
p03061 | u502721867 | 2,000 | 1,048,576 | There are N integers, A_1, A_2, ..., A_N, written on the blackboard. You will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written. Find the maximum possible greatest common divisor of the N integers on the blackboard afte... | ['import numpy\n\ndef gcd(a,b,mem):\n str12 = "{}.{}".format(a, b)\n if b==0:\n return a\n elif str12 in mem.keys():\n return mem[str12]\n else:\n mem[str12] = gcd(b,a%b,mem)\n return mem[str12]\n\n\n\n\nN = int(input())\nA = numpy.array([int(x) for x in input().split()])\na2 = ... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s152508929', 's330741718', 's371166903'] | [23120.0, 16056.0, 14056.0] | [195.0, 2104.0, 211.0] | [494, 308, 472] |
p03061 | u504562455 | 2,000 | 1,048,576 | There are N integers, A_1, A_2, ..., A_N, written on the blackboard. You will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written. Find the maximum possible greatest common divisor of the N integers on the blackboard afte... | ['import copy\nn = int(input())\na = list(map(int,input().split()))\nans = 1\nfor i in range(n):\n b = copy.deepcopy(a)\n b.pop(i)\n for j in range(max(b)+1,2):\n c = list(map(lambda x: x % j,b))\n if sum(c) == 0:\n ans = j\n break\nprint(ans)', 'import copy\nn = int(input())\na = list(map(int,input(... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s875232387', 's950455503', 's564646523'] | [14820.0, 34696.0, 15008.0] | [2104.0, 2104.0, 669.0] | [248, 465, 877] |
p03061 | u509661905 | 2,000 | 1,048,576 | There are N integers, A_1, A_2, ..., A_N, written on the blackboard. You will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written. Find the maximum possible greatest common divisor of the N integers on the blackboard afte... | ['#!/usr/bin/env python3\n\nimport fractions\nimport functools\nimport math\n\n\ndef number_of_divisors(x):\n res = 0\n for i in range(1, math.floor(math.sqrt(x)) + 1):\n d, m = divmod(x, i)\n if m == 0:\n res += 1 + int(d != i)\n return res\n\n\ndef gcds(xs):\n return functools.red... | ['Wrong Answer', 'Accepted'] | ['s010972000', 's285927997'] | [16152.0, 16164.0] | [2104.0, 147.0] | [646, 774] |
p03061 | u514687406 | 2,000 | 1,048,576 | There are N integers, A_1, A_2, ..., A_N, written on the blackboard. You will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written. Find the maximum possible greatest common divisor of the N integers on the blackboard afte... | ['import sys\nn = int(sys.stdin.readline())\na = list(map(int,sys.stdin.readline().split()))\npref,suf = [0]*(n+2),[0]*(n+2)\npref[1] = a[0]\nfor i in range(2,n+1):\n pref[i] = gcd(pref[i-1],a[i-1])\nsuf[n] = a[n-1]\nfor i in range(n-1,0,-1):\n suf[i] = gcd(suf[i+1],a[i-1])\nans = max(suf[2],pref[n-1])\nfor i in ... | ['Runtime Error', 'Accepted'] | ['s668921380', 's379422093'] | [14196.0, 14488.0] | [44.0, 242.0] | [372, 464] |
p03061 | u517447467 | 2,000 | 1,048,576 | There are N integers, A_1, A_2, ..., A_N, written on the blackboard. You will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written. Find the maximum possible greatest common divisor of the N integers on the blackboard afte... | ['N = int(input())\nA = list(map(int, input().split()))\n\ndef gcd(a, b):\n if b > a:\n a, b = b, a \n red = a % b\n if red == 0:\n return b\n else:\n return gcd(red, b)\n\nL = [A[0]]\nfor i in range(1, N):\n L.append(gcd(A[i], L[-1]))\n \nR = [A[-1], A[-1]]\nfor i in range(N-2, -1, -1):\n R.append(gcd... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s047951164', 's981091473', 's059826961'] | [14436.0, 15512.0, 14584.0] | [183.0, 290.0, 190.0] | [489, 499, 509] |
p03061 | u518042385 | 2,000 | 1,048,576 | There are N integers, A_1, A_2, ..., A_N, written on the blackboard. You will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written. Find the maximum possible greatest common divisor of the N integers on the blackboard afte... | ['n=int(input())\nl=list(map(int,input().split()))\nimport functools\nimport fractions\nl1=[]\nfor i in range(n):\n a=l[0]\n del l[0]\n s = functools.reduce(fractions.gcd, l)\n l1.append(s)\n l.append(a)\nprint(max(l1))', 'n=int(input())\nl=list(map(int,input().split()))\ndef gcd(n,m):\n l0=[]\n if n==0:\n re... | ['Time Limit Exceeded', 'Runtime Error', 'Accepted'] | ['s306862111', 's747927600', 's481756817'] | [14076.0, 2940.0, 14440.0] | [2104.0, 17.0, 286.0] | [211, 706, 427] |
p03061 | u519130434 | 2,000 | 1,048,576 | There are N integers, A_1, A_2, ..., A_N, written on the blackboard. You will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written. Find the maximum possible greatest common divisor of the N integers on the blackboard afte... | ['import fractions\n\nN = int(input())\nAs = list(map(int, input().split()))\n\nleft_gcds = [fractions.gcd(As[0], As[0])]\nfor i in range(1, len(As)):\n left_gcds.append(fractions.gcd(left_gcds[i-1], As[i]))\n\nright_gcds = [fractions.gcd(As[-1], As[-1])]\nfor i in reversed(range(len(As)-1)):\n right_gcds.append(... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s127708281', 's684608693', 's221746367'] | [16124.0, 16932.0, 16156.0] | [106.0, 2104.0, 219.0] | [595, 576, 630] |
p03061 | u528087569 | 2,000 | 1,048,576 | There are N integers, A_1, A_2, ..., A_N, written on the blackboard. You will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written. Find the maximum possible greatest common divisor of the N integers on the blackboard afte... | ['import fractions\nimport copy\nfrom functools import reduce\nnum = int(input())\nnums = [int(s) for s in input().split()]\n\ndef gcd_list(numbers):\n return reduce(fractions.gcd, nums)\ndef gcd(*numbers):\n return reduce(fractions.gcd, numbers)\nanswer = []\nfor i in range(num):\n ls = copy.deepcopy(nums)\n d... | ['Time Limit Exceeded', 'Accepted'] | ['s175291633', 's885728766'] | [16076.0, 14052.0] | [2104.0, 182.0] | [358, 427] |
p03061 | u529012223 | 2,000 | 1,048,576 | There are N integers, A_1, A_2, ..., A_N, written on the blackboard. You will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written. Find the maximum possible greatest common divisor of the N integers on the blackboard afte... | ['\nimport fractions\nN = int(input())\nA = list(map(int, input().split()))\nL = [0]\nR = [0]\nfor i in range(N-1):\n L.append(gcd(L[i], A[i]))\n R.append(gcd(R[i], A[-i-1]))\nMAX = 0\nfor i in range(N):\n MAX = max(MAX, gcd(L[i], R[-i-1]))\nprint(MAX)\n\n', '\nimport fractions\nL = [0]\nR = [0]\nfor i in rang... | ['Runtime Error', 'Runtime Error', 'Time Limit Exceeded', 'Wrong Answer', 'Accepted'] | ['s699189318', 's763409324', 's833651340', 's860147486', 's689271504'] | [16148.0, 5048.0, 16148.0, 23128.0, 24988.0] | [65.0, 36.0, 2104.0, 1981.0, 1912.0] | [249, 196, 250, 485, 467] |
p03061 | u533039576 | 2,000 | 1,048,576 | There are N integers, A_1, A_2, ..., A_N, written on the blackboard. You will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written. Find the maximum possible greatest common divisor of the N integers on the blackboard afte... | ['from fractions import gcd\n\n# return a if b == 0 else GCD(b, a % b)\n\n\nclass SegTree():\n def __init__(self, n_, ele_id, operation_func):\n self.n = 1\n while self.n < n_:\n self.n *= 2\n self.data = [ele_id] * (2 * self.n - 1)\n self.ele_id = ele_id\n self.oper... | ['Time Limit Exceeded', 'Time Limit Exceeded', 'Time Limit Exceeded', 'Time Limit Exceeded', 'Time Limit Exceeded', 'Accepted'] | ['s288999279', 's319126931', 's624631610', 's633369080', 's700017319', 's433752287'] | [16164.0, 16288.0, 16272.0, 16140.0, 16280.0, 14584.0] | [2104.0, 2104.0, 2104.0, 2104.0, 2104.0, 227.0] | [2028, 1991, 1953, 1952, 2258, 320] |
p03061 | u534308356 | 2,000 | 1,048,576 | There are N integers, A_1, A_2, ..., A_N, written on the blackboard. You will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written. Find the maximum possible greatest common divisor of the N integers on the blackboard afte... | ['from functools import reduce\nfrom fractions import gcd\n\n\ndef gcd_check(data, ans):\n for i in range(len(data) - 1):\n ans.append(reduce(gcd, [data[i], data[i + 1]]))\n \nN = int(input())\ndata = list(map(int, input().split()))\nans_data = []\ngcd_check(data, ans_data)\n\nprint(max(ans_data))\n', 'from f... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s284182404', 's534828244', 's789273849', 's824622813', 's977866247', 's011969795'] | [16148.0, 1943048.0, 20528.0, 14080.0, 1999056.0, 20584.0] | [173.0, 2223.0, 157.0, 2104.0, 2233.0, 146.0] | [294, 331, 458, 351, 331, 426] |
p03061 | u537782349 | 2,000 | 1,048,576 | There are N integers, A_1, A_2, ..., A_N, written on the blackboard. You will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written. Find the maximum possible greatest common divisor of the N integers on the blackboard afte... | ['a', 'def g_c_d(x, y):\n if x == 0:\n return y\n elif y == 0:\n return x\n else:\n return g_c_d(y, x % y)\n\n\na = int(input())\nb = list(map(int, input().split()))\nc = [0] * (a + 1)\nd = [0] * (a + 1)\nfor i in range(1, a + 1):\n c[i] = g_c_d(b[i-1], c[i-1])\n d[-i-1] = g_c_d(b[-i... | ['Runtime Error', 'Accepted'] | ['s860107371', 's855130303'] | [2940.0, 14436.0] | [17.0, 237.0] | [1, 385] |
p03061 | u540761833 | 2,000 | 1,048,576 | There are N integers, A_1, A_2, ..., A_N, written on the blackboard. You will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written. Find the maximum possible greatest common divisor of the N integers on the blackboard afte... | ['N = int(input())\nA = sorted(list(map(int,input().split())))\ndef gcd(a,b):\n if b == 0:\n return a\n else:\n return gcd(b,a%b)\ngcda = []\nL = [0 for i in range(N)]\nR = [0 for i in range(N)]\nL[1] = A[0]\nR[-2] = A[-1]\nfor i in range(1,N-1):\n L[i] = gcd(L[i-1],A[i])\n\nfor i in range(N-2,-1... | ['Wrong Answer', 'Accepted'] | ['s936251196', 's464290885'] | [14076.0, 14076.0] | [253.0, 245.0] | [440, 505] |
p03061 | u545368057 | 2,000 | 1,048,576 | There are N integers, A_1, A_2, ..., A_N, written on the blackboard. You will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written. Find the maximum possible greatest common divisor of the N integers on the blackboard afte... | ['N = int(input())\nAs = [int(i) for i in input().split()]\n\n\ndef make_divisors(n):\n divisors = []\n for i in range(1, int(n**0.5)+1):\n if n % i == 0:\n divisors.append(i)\n if i != n // i:\n divisors.append(n//i)\n return divisors\n\ndevs = make_divisors(A[0])\... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s478366426', 's996403750', 's110895440'] | [14400.0, 14588.0, 14584.0] | [46.0, 76.0, 302.0] | [509, 1597, 656] |
p03061 | u552357043 | 2,000 | 1,048,576 | There are N integers, A_1, A_2, ..., A_N, written on the blackboard. You will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written. Find the maximum possible greatest common divisor of the N integers on the blackboard afte... | ['def gcd(a,b):\n if a <= b:\n a,b = b,a\n if a%b == 0:\n return b\n else:\n return gcd(b,a%b)\n\nN = int(input())\nA = list(map(int, input().split()))\n\nL_gcd = [A[0]]\nR_gcd = [A[-1]]\n\nfor i in range(1,N):\n L_gcd.append(gcd(L_gcd[i-1],A[i]))\n R_gcd.insert(0,gcd(A[N-i-1],R_gcd[... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s173634846', 's214582684', 's273301942', 's379121355', 's506755334', 's515772244', 's615685667', 's675194006', 's874171524', 's919013702', 's928445303', 's955620942', 's805295097'] | [14584.0, 3064.0, 14488.0, 2940.0, 14428.0, 14584.0, 14488.0, 14080.0, 14428.0, 14432.0, 2940.0, 2940.0, 14400.0] | [2104.0, 17.0, 44.0, 18.0, 2108.0, 43.0, 163.0, 45.0, 2104.0, 2108.0, 17.0, 17.0, 180.0] | [394, 370, 444, 497, 417, 375, 500, 366, 498, 442, 365, 777, 459] |
p03061 | u554953477 | 2,000 | 1,048,576 | There are N integers, A_1, A_2, ..., A_N, written on the blackboard. You will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written. Find the maximum possible greatest common divisor of the N integers on the blackboard afte... | ['#include <bits/stdc++.h>\nusing namespace std;\n//#define MOD 1000000007\n#define MOD 998244353\n#define INF 100000000000000009\ntypedef long long ll;\n#define REP(i,n) for(int i=0;i<(n);++i)\n#define OREP(i,n) for(int i=1;i<=(n);++i)\n#define ZREP(i,n) for(int i=1;i<(n);++i)\n#define YES(s) s?cout << "YES" << endl:c... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s298370095', 's590294504', 's926449811'] | [2940.0, 2940.0, 14400.0] | [17.0, 17.0, 185.0] | [1275, 1081, 387] |
p03061 | u556028974 | 2,000 | 1,048,576 | There are N integers, A_1, A_2, ..., A_N, written on the blackboard. You will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written. Find the maximum possible greatest common divisor of the N integers on the blackboard afte... | ['import math\nfrom functools import reduce\nimport sys\nsys.setrecursionlimit(10**6)\n\ndef gcd_list(numbers) :\n return reduce(math.gcd, numbers)\n\nN = int(input())\nA = []\nA = list(map(int, input().split()))\nlen = len(A)\ngcd = 1\n\nif N==2:\n print(max(A[0],A[1]))\n sys.exit()\n\nfor i in range(len):\n ... | ['Runtime Error', 'Accepted'] | ['s414600833', 's347077640'] | [14708.0, 15688.0] | [51.0, 263.0] | [410, 728] |
p03061 | u562935282 | 2,000 | 1,048,576 | There are N integers, A_1, A_2, ..., A_N, written on the blackboard. You will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written. Find the maximum possible greatest common divisor of the N integers on the blackboard afte... | ['N = int(input())\na = list(map(int, input().split()))\n\nd = set()\nfor aa in a[0], a[1]:\n for i in range(1, int(aa ** 0.5) + 1):\n if aa % i == 0:\n d.add(i)\n d.add(aa // i) \n\n\nprint(d)\n\ng = 1\nfor dd in d:\n cnt = 0\n for aa in a:\n if aa % dd == 0:\n ... | ['Wrong Answer', 'Time Limit Exceeded', 'Accepted'] | ['s056802157', 's338931429', 's442903820'] | [14584.0, 16940.0, 14556.0] | [1901.0, 2104.0, 247.0] | [1723, 938, 517] |
p03061 | u570257051 | 2,000 | 1,048,576 | There are N integers, A_1, A_2, ..., A_N, written on the blackboard. You will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written. Find the maximum possible greatest common divisor of the N integers on the blackboard afte... | ['n = int(input())\na = list(map(int, input().split()))\nanswer = sorted(a)[1]\nfor b in range(answer).reverse():\n cnt = 2\n flag = True\n for i in range(n):\n if a[i] % answer != 0:\n cnt -= 1\n if cnt == 0:\n flag = False\n if flag:\n break\n answer -= 1\npri... | ['Runtime Error', 'Accepted'] | ['s708039784', 's717846868'] | [14080.0, 14060.0] | [66.0, 573.0] | [314, 406] |
p03061 | u571199625 | 2,000 | 1,048,576 | There are N integers, A_1, A_2, ..., A_N, written on the blackboard. You will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written. Find the maximum possible greatest common divisor of the N integers on the blackboard afte... | ['N = int(input())\nA = list(map(int, input().split()))\n\nnum = A[0]\n\n\ndef gcd(x, y):\n if y == 0:\n return x\n else:\n return gcd(y, x % y)\n\n\nfor i in range(N):\n if A[i]%num == 0:\n continue\n B = A[:]\n B.pop(i)\n gcd1 = int(B[0])\n\n for j in range(1, N - 1):\n ... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s306308834', 's568286547', 's766373607', 's934744486', 's051759796'] | [14076.0, 14076.0, 14064.0, 14584.0, 14076.0] | [2104.0, 45.0, 57.0, 2104.0, 171.0] | [372, 366, 369, 568, 655] |
p03061 | u575750790 | 2,000 | 1,048,576 | There are N integers, A_1, A_2, ..., A_N, written on the blackboard. You will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written. Find the maximum possible greatest common divisor of the N integers on the blackboard afte... | ['num =int(input())\nvalue = list(map(int, input().split()))\nvalue.sort()\npoint = 0\nfor i in range (0, value[0]):\n cnt = 0\n for j in range(0, num):\n if value[j]%(value[0]-i)!=0:\n cnt += 1\n point = j\n print(i)\n if cnt == 1 or cnt == 0:\n break\nprint(value[0] - i)', 'num =int(input())\nvalu... | ['Wrong Answer', 'Accepted'] | ['s477229732', 's530095723'] | [14060.0, 14436.0] | [2104.0, 554.0] | [278, 580] |
p03061 | u580362735 | 2,000 | 1,048,576 | There are N integers, A_1, A_2, ..., A_N, written on the blackboard. You will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written. Find the maximum possible greatest common divisor of the N integers on the blackboard afte... | ['import fractions\nfrom functools import reduce\nN = int(input())\nA = list(map(int,input().split()))\nans = 0\nA = sorted(A)\ndef gcd_list(numbers):\n return reduce(fractions.gcd, numbers)\nans = 0\nans_ = 0\nif N == 2:\n print(max(A))\nelif N == 3:\n tmp = [A[0],A[1],A[N-1]]\n for i in range(len(tmp)):\n tm... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s047081834', 's071414652', 's185480991', 's321071293', 's321885962', 's369638519', 's438467091', 's765788028', 's844998532'] | [16148.0, 16160.0, 16512.0, 3064.0, 16160.0, 16152.0, 16152.0, 16148.0, 14428.0] | [89.0, 65.0, 85.0, 17.0, 107.0, 86.0, 109.0, 84.0, 213.0] | [746, 521, 669, 812, 813, 435, 813, 750, 345] |
p03061 | u580806822 | 2,000 | 1,048,576 | There are N integers, A_1, A_2, ..., A_N, written on the blackboard. You will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written. Find the maximum possible greatest common divisor of the N integers on the blackboard afte... | ['def gcd(a,b):\n while b!=0:\n a,b=b,a%b\n return a\n\ndef ngcd(li):\n temp=gcd(li[0], li[1])\n if len(li)-3 >=0:\n for i in range(len(li)-3):\n temp=gcd(temp, li[i+2])\n return temp\n\nn=int(input())\na=[int(i) for i in input().split()]\n\nt=a[0]\nt2=a[1]\nout=0\nf=1\nmin=10**9+1\nfor ... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s718266178', 's992822887', 's225762612'] | [14560.0, 14400.0, 14524.0] | [151.0, 149.0, 190.0] | [950, 951, 502] |
p03061 | u581040514 | 2,000 | 1,048,576 | There are N integers, A_1, A_2, ..., A_N, written on the blackboard. You will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written. Find the maximum possible greatest common divisor of the N integers on the blackboard afte... | ['N = int(input())\n\nA_list = list(map(int, input().split())) # case1 : [7, 6, 8]\n\ndef gcd(a, b):\n while b != 0:\n a, b = b, int(a%b)\n return a\n\nleft_gcd = [0] * (N+1)\nright_gcd = [0] * (N+1)\nfor i in range(N):\n left_gcd[i] = gcd(A_list[i], left_gcd[i-1])\nfor i in range(N-1, 0, -1):\n righ... | ['Wrong Answer', 'Accepted'] | ['s295311103', 's446948273'] | [14432.0, 14436.0] | [208.0, 219.0] | [471, 471] |
p03061 | u583507988 | 2,000 | 1,048,576 | There are N integers, A_1, A_2, ..., A_N, written on the blackboard. You will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written. Find the maximum possible greatest common divisor of the N integers on the blackboard afte... | ['n = int(input())\na = list(map(int, input().split()))\n\nres = []\nans = []\nx = 0\nif n > 2:\n while x < math.factorial(n):\n c = random.sample(a, 2)\n if c not in res:\n res.append(c)\n x += 1 \n ans.append(math.gcd(c[0],c[1]))\n print(max(ans))\nelif n == 2:\n while x < math.factorial(n)/2:... | ['Runtime Error', 'Accepted'] | ['s536223512', 's268815767'] | [14584.0, 22996.0] | [42.0, 129.0] | [442, 361] |
p03061 | u590211278 | 2,000 | 1,048,576 | There are N integers, A_1, A_2, ..., A_N, written on the blackboard. You will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written. Find the maximum possible greatest common divisor of the N integers on the blackboard afte... | ["N = int(input())\nA = list(map(int,input().split(' ')))\n\ndef myGCD(a,b):\n while b!=0:\n a,b = b,a%b\n return a\n\ndef list_gcd(numbers):\n tmp=numbers[0]\n for i in range(len(numbers)-1):\n tmp=min(tmp,myGCD(numbers[i],numbers[i+1]))\n return(tmp)\n\n#print(list_gcd(A))\n\ncandidate=[0... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s208115245', 's632409800', 's842801857'] | [14524.0, 14584.0, 14436.0] | [45.0, 193.0, 203.0] | [634, 407, 429] |
p03061 | u591690245 | 2,000 | 1,048,576 | There are N integers, A_1, A_2, ..., A_N, written on the blackboard. You will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written. Find the maximum possible greatest common divisor of the N integers on the blackboard afte... | ['n = int(input(), 10)\na = list(map(int, input().split()))\ngreatCDlist = []\n\nfor i in range(n):\n pop = a.pop(i)\n greatCD = 1\n for j in range(n):\n if j == 0:\n greatCD = gcd(a[0], a[1])\n else:\n greatCD = gcd(greatCD, a[j])\n a.insert(i, pop)\n greatCDlist.append(greatCD)\n\nmaxg = 1\nfor i... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s076219121', 's165613109', 's260607070'] | [14488.0, 3064.0, 14076.0] | [43.0, 17.0, 271.0] | [503, 499, 526] |
p03061 | u597455618 | 2,000 | 1,048,576 | There are N integers, A_1, A_2, ..., A_N, written on the blackboard. You will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written. Find the maximum possible greatest common divisor of the N integers on the blackboard afte... | ['from fractions import gcd\nn = int(input())\na = list(map(int, input().split()))\nans = 0\nfor i in range(n):\n for j in range(i+1,n):\n tmp = gcd(a[i], a[j])\n if ans < tmp:\n ans = tmp\nprint(ans)', 'import sys\ndef gcd(m, n):\n if n == 0:\n n, m = m, n\n r = m % n\n return gcd(n, r) if ... | ['Wrong Answer', 'Accepted'] | ['s659403790', 's363129789'] | [16136.0, 20472.0] | [2104.0, 169.0] | [201, 388] |
p03061 | u598860476 | 2,000 | 1,048,576 | There are N integers, A_1, A_2, ..., A_N, written on the blackboard. You will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written. Find the maximum possible greatest common divisor of the N integers on the blackboard afte... | ['def GCD(a, b):\n while a % b != 0:\n r = a % b\n a, b = b, r\n return b\n\nans = 0\nN = int(input())\nA = tuple(map(int,input().split()))\nA2 = tuple(set(A))\nAf = 0\n\nif len(A2) <= 2:\n A2 = (A2[0],A2[0])\n\nfor S in range(len(A2)):\n for i in range(len(A2)):\n if S != i:\n ... | ['Wrong Answer', 'Accepted'] | ['s151127406', 's600200560'] | [14188.0, 14180.0] | [56.0, 219.0] | [371, 458] |
p03061 | u599114793 | 2,000 | 1,048,576 | There are N integers, A_1, A_2, ..., A_N, written on the blackboard. You will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written. Find the maximum possible greatest common divisor of the N integers on the blackboard afte... | ['l_ans = [0] * n\ng = 0\nfor i in range(1, n):\n g = gcd(g, v[i-1])\n l_ans[i] = g\nr_ans = [0] * n\ng = 0\nfor i in range(1, n):\n g = gcd(g, v[n-i])\n r_ans[i] = g\nr_ans.reverse()\nans = 1\nfor i in range(n):\n ans = max(ans, gcd(l_ans[i], r_ans[i]))\nprint(ans)\n', 'from collections import deque\nfr... | ['Runtime Error', 'Time Limit Exceeded', 'Accepted'] | ['s327969841', 's471087445', 's768432342'] | [3064.0, 16056.0, 14436.0] | [17.0, 2104.0, 183.0] | [266, 324, 382] |
p03061 | u599170882 | 2,000 | 1,048,576 | There are N integers, A_1, A_2, ..., A_N, written on the blackboard. You will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written. Find the maximum possible greatest common divisor of the N integers on the blackboard afte... | ['import math\n\nN = int(input())\nA = list(map(int, input().split()))\n\nnot_replaced_max = A[0]\n\ndef gcd(a, b):\n if b == 0:\n return a\n return gcd(b, a%b)\n\n\n\n\n\n# result.append(i)\n# return result\n\n\n\n\n\n# not_replaced_max = gcd(not_replaced_max, A[i])\n# print(replaced_m... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s042760036', 's670749093', 's795254594'] | [14460.0, 14588.0, 14436.0] | [67.0, 513.0, 203.0] | [1108, 1114, 385] |
p03061 | u602715823 | 2,000 | 1,048,576 | There are N integers, A_1, A_2, ..., A_N, written on the blackboard. You will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written. Find the maximum possible greatest common divisor of the N integers on the blackboard afte... | ['import sys\nfrom fractions import gcd\nn = int(input())\na = list(map(int, input().split()))\n\na = list(set(a))\n\n\n\nif len(a) <= 2:\n print(max(a))\nelse:\n a.sort()\n ans = max(gcd(a[0], a[-1]), gcd(a[1], a[-1]), gcd(a[0], a[1]))\n e_cnt = 0\n for e in a:\n if e % ans != 0:\n if ... | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s350826282', 's537187721', 's730142336', 's021047502'] | [16572.0, 13196.0, 14060.0, 14488.0] | [63.0, 62.0, 77.0, 215.0] | [438, 416, 389, 390] |
p03061 | u606878291 | 2,000 | 1,048,576 | There are N integers, A_1, A_2, ..., A_N, written on the blackboard. You will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written. Find the maximum possible greatest common divisor of the N integers on the blackboard afte... | ["from math import gcd\nfrom functools import reduce\n\nN = int(input())\nA = tuple(map(int, input().split(' ')))\n\nif len(A) == 2:\n print(max(A))\nelse:\n base = reduce(gcd, A)\n rest = 1\n\n ans1 = A[0]\n for a in A:\n b = gcd(ans1, a)\n if rest > 0 and b == base:\n rest -= 1... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s469078236', 's969882676', 's907722037'] | [21388.0, 21644.0, 25024.0] | [96.0, 92.0, 113.0] | [516, 419, 405] |
p03061 | u619197965 | 2,000 | 1,048,576 | There are N integers, A_1, A_2, ..., A_N, written on the blackboard. You will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written. Find the maximum possible greatest common divisor of the N integers on the blackboard afte... | ['n=int(input())\na=sorted([int(i) for i in input().split()])\ngcd1=[0]*n\ngcd2=[0]*n\nfor i in range(n):\n if i!=0:\n gcd1[i]=gcd(a[0],a[i])\n if i!=1:\n gcd2[i]=gcd(a[1],a[i])\nprint(max(max(gcd1),max(gcd2)))', 'def gcd(num1,num2):\n if num2==0:\n return num1\n return gcd(num2,num1%nu... | ['Runtime Error', 'Accepted'] | ['s411401771', 's001854974'] | [14056.0, 14440.0] | [74.0, 598.0] | [219, 505] |
p03061 | u619458041 | 2,000 | 1,048,576 | There are N integers, A_1, A_2, ..., A_N, written on the blackboard. You will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written. Find the maximum possible greatest common divisor of the N integers on the blackboard afte... | ['import sys\n\n\ndef gcd(a, b):\n """Euclidean Algorithm"""\n while b != 0:\n a, b = b, a % b\n return a\n\n\ndef main():\n input = sys.stdin.readline\n N = int(input())\n A = list(map(int, input().split()))\n\n if N == 2:\n return max(A)\n\n g = A[0]\n B = []\n for a in A:\... | ['Wrong Answer', 'Accepted'] | ['s497715067', 's824702708'] | [14112.0, 14256.0] | [87.0, 255.0] | [486, 599] |
p03061 | u622523700 | 2,000 | 1,048,576 | There are N integers, A_1, A_2, ..., A_N, written on the blackboard. You will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written. Find the maximum possible greatest common divisor of the N integers on the blackboard afte... | ['n = int(input())\na = list(map(int, input().split())).sort(reverse=True)\n\ndef gcd(x, y):\n if y == 0:\n return x\n return gcd(y, x % y)\n\nans = 1\nif n == 2:\n print(max(a))\nelse:\n for i in range(n // 10):\n b = a[:i] + a[i + 1:]\n element = gcd(b[0], b[1])\n if n == 3:\n ... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s056014649', 's207678840', 's693975412'] | [14584.0, 14080.0, 14488.0] | [64.0, 2104.0, 242.0] | [485, 487, 419] |
p03061 | u626468554 | 2,000 | 1,048,576 | There are N integers, A_1, A_2, ..., A_N, written on the blackboard. You will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written. Find the maximum possible greatest common divisor of the N integers on the blackboard afte... | ['#!/usr/bin/env python3\n\ndef gcd(a, b):\n\twhile b:\n\t\ta, b = b, a % b\n\treturn a\n\nn = int(input())\na = input().split()\nnum1 = 10000000000\nnum2 = 10000000000\n\nb = gcd(int(a[0]),int(a[1]))\ncntr = 0\n\nfor i in range(1,n):\n w = gcd(int(a[i]),b)\n b = w\n \n if w < num1:\n num1 = w\n e... | ['Wrong Answer', 'Accepted'] | ['s045671229', 's362952087'] | [11132.0, 14452.0] | [95.0, 201.0] | [401, 469] |
p03061 | u627655207 | 2,000 | 1,048,576 | There are N integers, A_1, A_2, ..., A_N, written on the blackboard. You will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written. Find the maximum possible greatest common divisor of the N integers on the blackboard afte... | ['from functools import lru_cache\n\n\n@lru_cache(maxsize=None)\ndef gcd(a, b):\n if b == 0:\n return a\n return gcd(b, a % b)\n\n\ndef sub():\n N, As = [input() for _ in range(2)]\n N = int(N)\n As = [int(e) for e in As.split(" ")]\n \n\n memG = 0\n if N == 2:\n memG = gcd(As[0], ... | ['Wrong Answer', 'Accepted'] | ['s351701002', 's078837997'] | [32276.0, 32336.0] | [643.0, 657.0] | [1405, 1497] |
p03061 | u630281418 | 2,000 | 1,048,576 | There are N integers, A_1, A_2, ..., A_N, written on the blackboard. You will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written. Find the maximum possible greatest common divisor of the N integers on the blackboard afte... | ['import sys\ninput = sys.stdin.readline\n\nimport numpy as np\n\ninput()\nA = np.array(list(map(int, input().split())))\nN = len(A)\nprint(A)\nif N <= 2:\n print(max(A))\n exit()\n\ndef gcd(a, b):\n if b == 0: return a\n return gcd(b, a%b)\n\nans = 1\nfor ptr in range(N):\n li = np.concatenate([A[:ptr],... | ['Wrong Answer', 'Accepted'] | ['s028088210', 's877333145'] | [23072.0, 14080.0] | [2109.0, 260.0] | [424, 812] |
p03061 | u631277801 | 2,000 | 1,048,576 | There are N integers, A_1, A_2, ..., A_N, written on the blackboard. You will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written. Find the maximum possible greatest common divisor of the N integers on the blackboard afte... | ["import sys\nstdin = sys.stdin\n \nsys.setrecursionlimit(10**5) \n \ndef li(): return map(int, stdin.readline().split())\ndef li_(): return map(lambda x: int(x)-1, stdin.readline().split())\ndef lf(): return map(float, stdin.readline().split())\ndef ls(): return stdin.readline().split()\ndef ns(): return stdin.readlin... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s184408507', 's615118571', 's381013022'] | [14136.0, 14196.0, 14488.0] | [2104.0, 104.0, 196.0] | [893, 656, 933] |
p03061 | u644533034 | 2,000 | 1,048,576 | There are N integers, A_1, A_2, ..., A_N, written on the blackboard. You will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written. Find the maximum possible greatest common divisor of the N integers on the blackboard afte... | ['# coding: utf-8\n# Your code here!\n\nN = int(input().rstrip())\nA = list(map(int, input().rstrip().split()))\n\ndef gcd(x, y):\n if x == 0:\n return y\n if y == 0:\n return x\n \n if y > x:\n temp = y\n y = x\n x = temp\n amari = x % y\n if amari == 0:\n ... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s960098187', 's966697750', 's140147642'] | [14400.0, 14488.0, 14524.0] | [2108.0, 2104.0, 175.0] | [610, 574, 601] |
p03061 | u647102103 | 2,000 | 1,048,576 | There are N integers, A_1, A_2, ..., A_N, written on the blackboard. You will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written. Find the maximum possible greatest common divisor of the N integers on the blackboard afte... | ['def gcd(x, y): \n while(y): \n x, y = y, x % y \n return x \n\nn = int(input())\nA = list(map(int, input().split())) \n \nL = list(A)\n\n \n\nfor i in range(n):\n L[i] = gcd(L[i], L[i-1])\n\nprint(max(L)) ', 'def gcd(x, y): \n while(y): \n x, y = y, x % y \n return x \n\nn = int(input()... | ['Wrong Answer', 'Accepted'] | ['s362421040', 's932784229'] | [14080.0, 14432.0] | [82.0, 172.0] | [208, 374] |
p03061 | u652057333 | 2,000 | 1,048,576 | There are N integers, A_1, A_2, ..., A_N, written on the blackboard. You will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written. Find the maximum possible greatest common divisor of the N integers on the blackboard afte... | ['# C\nimport functools import reduce\nimport math\n\nn = int(input())\na = list(map(int, input().split()))\nans = 0\n\nfor i in range(n):\n values = a[:i] + a[i+1:]\n gcd = reduce(math.gcd, values)\n ans = max(ans, gcd)\nprint(ans)', '# C\nimport functools\ndef gcd(a,b):\n if a<b:a,b=b,a\n if a%b==0:ret... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s058442385', 's293098986', 's796357311', 's859347216'] | [2940.0, 14704.0, 14684.0, 14576.0] | [17.0, 66.0, 94.0, 239.0] | [227, 284, 512, 833] |
p03061 | u652150585 | 2,000 | 1,048,576 | There are N integers, A_1, A_2, ..., A_N, written on the blackboard. You will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written. Find the maximum possible greatest common divisor of the N integers on the blackboard afte... | ['n=int(input())\nl=list(map(int,input().split()))\ns=[[0]for _ in range(n)]\n#print(s)\n\nimport math\nimport fractions\nfrom functools import reduce\n\ndef gcd(*numbers):\n return reduce(math.gcd, numbers)\n\ndef gcd_list(numbers):\n return reduce(fractions.gcd, numbers)\n \nfor i in range(n):\n if i==0:\... | ['Time Limit Exceeded', 'Accepted'] | ['s060511687', 's860046763'] | [1634844.0, 17696.0] | [2205.0, 213.0] | [420, 781] |
p03061 | u655975843 | 2,000 | 1,048,576 | There are N integers, A_1, A_2, ..., A_N, written on the blackboard. You will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written. Find the maximum possible greatest common divisor of the N integers on the blackboard afte... | ['import sys\nimport fractions\nfrom functools import reduce\nns = lambda: sys.stdin.readline().rstrip()\nni = lambda: int(ns())\nnm = lambda: map(int, sys.stdin.readline().split())\nnl = lambda: list(nm())\nnsl = lambda: map(str, sys.stdin.readline().split())\ndef gcd_list(numbers):\n return reduce(fractions.gcd, n... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Time Limit Exceeded', 'Wrong Answer', 'Accepted'] | ['s289428237', 's836779273', 's845247901', 's893569201', 's935010947', 's942897073', 's218418017'] | [16156.0, 16104.0, 16156.0, 16164.0, 16124.0, 16156.0, 14644.0] | [169.0, 150.0, 169.0, 169.0, 2104.0, 167.0, 303.0] | [802, 537, 609, 574, 435, 573, 818] |
p03061 | u661707952 | 2,000 | 1,048,576 | There are N integers, A_1, A_2, ..., A_N, written on the blackboard. You will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written. Find the maximum possible greatest common divisor of the N integers on the blackboard afte... | ['#!/usr/bin/env python3.4\n# -*- coding: utf-8 -*-\n\n# abc125_a\nimport fractions, functools, itertools\n\n# input\nn = int(input())\nA = [int(s) for s in input().split()]\n\ndef search_booby(B):\n b0 = [fractions.gcd(B[0], a) for a in B[1:]]\n b0.sort()\n return b0[1]\ndef gcd_list(l):\n return functools... | ['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s181413951', 's688182406', 's874782127', 's286359467'] | [16148.0, 16148.0, 16140.0, 16068.0] | [219.0, 210.0, 2104.0, 1633.0] | [515, 321, 502, 567] |
p03061 | u672494157 | 2,000 | 1,048,576 | There are N integers, A_1, A_2, ..., A_N, written on the blackboard. You will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written. Find the maximum possible greatest common divisor of the N integers on the blackboard afte... | ['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(a, b):\n if b == 0:\n return a\n if a == 0:\n return b\n elif a > b:\n return gcd(b, a % ... | ['Wrong Answer', 'Accepted'] | ['s787538774', 's677507183'] | [15608.0, 15604.0] | [545.0, 916.0] | [1308, 1435] |
p03061 | u682408064 | 2,000 | 1,048,576 | There are N integers, A_1, A_2, ..., A_N, written on the blackboard. You will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written. Find the maximum possible greatest common divisor of the N integers on the blackboard afte... | ['# input\nN = int(input())\nA = [int(x) for x in input().split()]\n\n\ndef gcd(x, y):\n if y == 0:\n return x\n else:\n return gcd(y, x % y)\n\n\ndef gcd_wrapper(x, y):\n if x >= y:\n return gcd(x, y)\n else:\n return gcd(y, x)\n\nif N == 2:\n print(max(A))\nelse:\n CD = [... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s206660972', 's323382692', 's361401432', 's716416928', 's393769316'] | [17684.0, 78080.0, 3444.0, 14052.0, 14584.0] | [333.0, 2109.0, 21.0, 323.0, 150.0] | [737, 551, 459, 692, 1259] |
p03061 | u687766076 | 2,000 | 1,048,576 | There are N integers, A_1, A_2, ..., A_N, written on the blackboard. You will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written. Find the maximum possible greatest common divisor of the N integers on the blackboard afte... | ['import math\nn = int(input())\nv = [int(i) for i in input().split()]\nif n == 2:\n print(max(v))\n\nl = [0 for i in range(n)]\nr = l[:]\nl[1] = v[0]\nr[-2] = v[-1]\n\n\ndef gcd(x, y):\n if y > x:\n x, y = y, x\n if y == 0:\n return 0\n if x % y == 0:\n return y\n return gcd(y, x % ... | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s032435291', 's054830242', 's466670323', 's868536796', 's877012694', 's376622754'] | [14280.0, 14436.0, 14280.0, 14180.0, 14280.0, 14436.0] | [176.0, 97.0, 148.0, 142.0, 135.0, 170.0] | [449, 466, 449, 449, 414, 380] |
p03061 | u691896522 | 2,000 | 1,048,576 | There are N integers, A_1, A_2, ..., A_N, written on the blackboard. You will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written. Find the maximum possible greatest common divisor of the N integers on the blackboard afte... | ['def euclid(x, y):\n while x % y != 0:\n temp = x\n x = y\n y = temp % y\n return y\n\nn = int(input())\ndata = list(map(int, input().split()))\narray = data\nL = []\nL.append(data[0])\nR = []\nR.append(data[n - 1])\nm = []\nfor i in range(n):\n L.append(euclid(L[i], data[i]))\ndata.rever... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s809960903', 's989618459', 's978696749'] | [14076.0, 14076.0, 14432.0] | [177.0, 2104.0, 194.0] | [445, 432, 494] |
p03061 | u692746605 | 2,000 | 1,048,576 | There are N integers, A_1, A_2, ..., A_N, written on the blackboard. You will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written. Find the maximum possible greatest common divisor of the N integers on the blackboard afte... | ['import fractions\n\nn=int(input())\nal=input().split()\nal_i = [int(s) for s in al]\nm = max(al_i)\ngm = 0\n\nfor x in range(n):\n t = al_i[x]\n al_i[x] = m\n g = al_i[0]\n for y in range(n):\n g = fractions.gcd(g,al_i[y]) \n al_i[x] = t\n if g>gm:\n gm = g\nprint(gm)\n', 'def gcd(a, b):\n wh... | ['Time Limit Exceeded', 'Runtime Error', 'Runtime Error', 'Time Limit Exceeded', 'Accepted'] | ['s102722169', 's103596969', 's861943557', 's958842164', 's574923946'] | [16156.0, 2940.0, 14428.0, 18496.0, 14428.0] | [2104.0, 17.0, 49.0, 2105.0, 184.0] | [274, 719, 624, 309, 385] |
p03061 | u693391925 | 2,000 | 1,048,576 | There are N integers, A_1, A_2, ..., A_N, written on the blackboard. You will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written. Find the maximum possible greatest common divisor of the N integers on the blackboard afte... | ['def gcd(a,b):\n while b!=0:\n a,b=b,a%b\n return a\n\nN = int(input())\nA= list(map(int,input().split()))\noutput=0\n\nfor i in range(N):\n M = [A[i-1]]\n hoge = A[i]\n A[i] = A[i-1]\n for k in range(N):\n M.append(gcd(M[k],A[k]))\n print(M)\n\n if... | ['Runtime Error', 'Accepted'] | ['s571482368', 's164871784'] | [138988.0, 14436.0] | [2104.0, 192.0] | [380, 378] |
p03061 | u698771758 | 2,000 | 1,048,576 | There are N integers, A_1, A_2, ..., A_N, written on the blackboard. You will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written. Find the maximum possible greatest common divisor of the N integers on the blackboard afte... | ['def gcd(x,y):\n if y>x:\n a=y\n y=x\n x=a\n a=1\n while a*y:\n a=x%y\n x=y\n y=a\n return x\n\na=input()\nb=list(map(int,input().split()))\nl=[0]\nr=[0]\ng=[]\nfor a in range(len(b)-1):\n l.append(gcd(l[-1],b[a]))\n r.append(gcd(r[-1],b[-1-a]))\nprint(l)\npr... | ['Wrong Answer', 'Accepted'] | ['s785114667', 's391829306'] | [15156.0, 14436.0] | [202.0, 182.0] | [373, 355] |
p03061 | u703528810 | 2,000 | 1,048,576 | There are N integers, A_1, A_2, ..., A_N, written on the blackboard. You will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written. Find the maximum possible greatest common divisor of the N integers on the blackboard afte... | ['from math import gcd\n\nN=int(input())\nA=list(map(int,input().split()))\n\nif N==2:\n print(max(A))\nelse:\n L=[0 for _ in range(N)]\n R=[0 for _ in range(N)]\n L[0]=A[0]\n R[-1]=A[-1]\n for i in range(1,N):\n L[i]=gcd(A[i-1],L[i-1])\n R[N-1-i]=gcd(A[N-i],R[N-i])\n print(L)\n pr... | ['Wrong Answer', 'Accepted'] | ['s019902433', 's278257904'] | [24500.0, 21036.0] | [158.0, 143.0] | [410, 384] |
p03061 | u708255304 | 2,000 | 1,048,576 | There are N integers, A_1, A_2, ..., A_N, written on the blackboard. You will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written. Find the maximum possible greatest common divisor of the N integers on the blackboard afte... | ['def gcd(m, n):\n while n:\n m, n = n, m % n\n return m\n\n\nN = int(input())\nA = list(map(int, input().split()))\n# gcd_list = []\n# hoge = gcd(A[0], A[1])\n\n# gcd_list.append(gcd(hoge, A[i]))\n# gcd_list.sort()\n# print(gcd_list[len(gcd_list)-2])\nA.sort()\nmax_A = max(A)\ngcd_list = []\nfor i in ... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s217308788', 's514635098', 's420058723'] | [2940.0, 14052.0, 14076.0] | [17.0, 2104.0, 186.0] | [561, 605, 475] |
p03061 | u713492631 | 2,000 | 1,048,576 | There are N integers, A_1, A_2, ..., A_N, written on the blackboard. You will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written. Find the maximum possible greatest common divisor of the N integers on the blackboard afte... | ['n = int(input())\nA = map(int, input().split())\n\ndef gcd(a, b):\n if a < b:\n a, b = b, a\n if b == 0:\n return a\n return gcd(b, a % b)\n\nX = [0] * (n + 1)\nY = [0] * (n + 1)\n\nfor i in range(n):\n X[i+1] = gcd(X[i], A[i])\n Y[n-1-i] = gcd(Y[n-i], A[n-1-i])\n\ngcds = []\n\nfor i in range(n+1):\n gcds... | ['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Time Limit Exceeded', 'Time Limit Exceeded', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s000809635', 's072722175', 's182319442', 's221296146', 's385042391', 's615529002', 's700860851', 's715200121', 's749603699', 's759408927', 's127240519'] | [12096.0, 16132.0, 16148.0, 16140.0, 16152.0, 16152.0, 16144.0, 100252.0, 14076.0, 14584.0, 14436.0] | [30.0, 2105.0, 2104.0, 2104.0, 2104.0, 2104.0, 2104.0, 2104.0, 191.0, 229.0, 225.0] | [342, 309, 436, 363, 317, 435, 309, 369, 330, 349, 347] |
p03061 | u723583932 | 2,000 | 1,048,576 | There are N integers, A_1, A_2, ..., A_N, written on the blackboard. You will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written. Find the maximum possible greatest common divisor of the N integers on the blackboard afte... | ['#from fractions import gcd\n\ndef gcd(a,b):\n r=a%b\n while r!=0:\n a=b\n b=r\n r=a%b\n return b\nclass SegTree():\n def __init__(self, lists, function, basement):\n self.n = len(lists)\n self.K = (self.n-1).bit_length()\n self.func = function\n self.baseme... | ['Runtime Error', 'Accepted'] | ['s858913027', 's523833375'] | [14440.0, 14440.0] | [86.0, 1977.0] | [1697, 1727] |
p03061 | u728274111 | 2,000 | 1,048,576 | There are N integers, A_1, A_2, ..., A_N, written on the blackboard. You will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written. Find the maximum possible greatest common divisor of the N integers on the blackboard afte... | ['import math\n\nn = int(input())\na = [int(xi) for xi in input().split()]\n\nL=[a[0]]\ngcdl = a[0]\nR=[a[n-1]]\ngcdr = a[n-1]\nfor xi in range(1,n):\n gcdl = math.gcd(gcdl,a[xi])\n L.append(gcdl)\n\nfor xi in range(n-2,-1,-1):\n gcdr = math.gcd(gcdr,a[xi])\n R.append(gcdr)\n\nR.reverse()\n\nprint(R)\nprint... | ['Wrong Answer', 'Accepted'] | ['s565523460', 's231050711'] | [27632.0, 24616.0] | [245.0, 128.0] | [492, 510] |
p03061 | u729133443 | 2,000 | 1,048,576 | There are N integers, A_1, A_2, ..., A_N, written on the blackboard. You will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written. Find the maximum possible greatest common divisor of the N integers on the blackboard afte... | ["def main():\n from fractions import gcd\n def update(k,x):\n k+=N0-1\n data[k]=x\n while k+1:\n k=~-k//2\n data[k]=gcd(data[2*k+1],data[2*k+2])\n def query(l,r):\n L,R=l+N0,r+N0\n s=0\n while L<R:\n if R&1:\n R-=1\n ... | ['Time Limit Exceeded', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s253253644', 's361443179', 's747074264', 's500869335'] | [16112.0, 16120.0, 16148.0, 20532.0] | [2104.0, 188.0, 2104.0, 113.0] | [695, 174, 542, 160] |
p03061 | u732870425 | 2,000 | 1,048,576 | There are N integers, A_1, A_2, ..., A_N, written on the blackboard. You will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written. Find the maximum possible greatest common divisor of the N integers on the blackboard afte... | ['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\nL = [0] * (N+1)\nR = [0] * (N+1)\nfor i in range(1, N):\n L[i] = gcd(L[i-1], A[i-1])\nfor i in range(N-1)[::-1]:\n R[i] = gcd(R[i+1], A[i+1])\n\nM = [gcd(L[i], R[i+... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s306214503', 's359012845', 's197897077'] | [14052.0, 14432.0, 14524.0] | [206.0, 2104.0, 205.0] | [339, 377, 337] |
p03061 | u735186902 | 2,000 | 1,048,576 | There are N integers, A_1, A_2, ..., A_N, written on the blackboard. You will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written. Find the maximum possible greatest common divisor of the N integers on the blackboard afte... | ['def gcd(a,b):\n if b==0:\n return a\n else:\n return gcd(b,a%b)\n\nN = int(input())\nA = list(map(int, input().split()))\nA.sort()\nB = []\nC = []\nfor i in range(1,N):\n B.append(gcd(A[0],A[i]))\n C.append(gcd(A[1],A[i]))\nB.sort()\nC.sort()\nprint(B[1],C[1])\n', 'def gcd(a,b):\n if b==0:\n return a\n ... | ['Runtime Error', 'Accepted'] | ['s769665806', 's573610804'] | [14080.0, 14488.0] | [274.0, 203.0] | [255, 324] |
p03061 | u759412327 | 2,000 | 1,048,576 | There are N integers, A_1, A_2, ..., A_N, written on the blackboard. You will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written. Find the maximum possible greatest common divisor of the N integers on the blackboard afte... | ['import numpy as np\nN = int(input())\nA = sorted(list(map(int,input().split())))\nans = []\n\nfor n in range(N):\n B = A[:n]+A[n+1:]\n ans+=[np.gcd.reduce(B)]\n\nprint(min(ans))', 'from math import *\nN = int(input())\nA = list(map(int,input().split()))\nL = (N+1)*[0]\nR = (N+1)*[0]\nans = []\n\nfor n in range(N):\... | ['Wrong Answer', 'Accepted'] | ['s561289130', 's747214983'] | [38476.0, 24884.0] | [2206.0, 128.0] | [170, 267] |
p03061 | u764956288 | 2,000 | 1,048,576 | There are N integers, A_1, A_2, ..., A_N, written on the blackboard. You will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written. Find the maximum possible greatest common divisor of the N integers on the blackboard afte... | [' def gcd(x, y):\n a = max(x, y)\n b = min(x, y)\n if b == 0:\n return a\n remainder = a % b\n if remainder == 0:\n return b\n return gcd(b, remainder)\n\n\nN = int(input())\nintegers = [int(x) for x in input().split()]\n\nleft = [0]\nright = [0]\n\nfor i in range(N):\n left.append(g... | ['Runtime Error', 'Accepted'] | ['s813913192', 's024606100'] | [2940.0, 14436.0] | [17.0, 281.0] | [510, 479] |
p03061 | u765865533 | 2,000 | 1,048,576 | There are N integers, A_1, A_2, ..., A_N, written on the blackboard. You will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written. Find the maximum possible greatest common divisor of the N integers on the blackboard afte... | ['N = int(input())\n\nA = list(map(int, input().split()))\nA=list(set(A))\n\nprint(A)\n\ndef gcd(a, b):\n while b > 0:\n a, b = b, a%b\n return a\n\nl1=[]\n\n\nif len(A)==1:\n ans=A[0]\n\nelif len(A)==2:\n ans=max(A)\n\nelif len(A)==3:\n a=gcd(A[0],A[1])\n b=gcd(A[0],A[2])\n c=gcd(A[2],A[1])\n an... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s062750014', 's226058450', 's280276473', 's302127776', 's327034109', 's350408283', 's443808505', 's848536766', 's866889949', 's868588262', 's883240174', 's595333690'] | [14524.0, 14488.0, 14076.0, 14400.0, 14060.0, 14400.0, 14488.0, 21380.0, 14436.0, 14584.0, 14076.0, 14060.0] | [45.0, 244.0, 136.0, 44.0, 139.0, 147.0, 237.0, 408.0, 44.0, 164.0, 47.0, 165.0] | [571, 617, 342, 578, 306, 445, 547, 984, 577, 398, 352, 398] |
p03061 | u785578220 | 2,000 | 1,048,576 | There are N integers, A_1, A_2, ..., A_N, written on the blackboard. You will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written. Find the maximum possible greatest common divisor of the N integers on the blackboard afte... | ['from fractions import*\nN=int(input())\na = list(map(int,input().split()))\nB=[0]\na=range(N)\nfor x in a:B+=[gcd(B[-1],A[x])]\nw=M=0\nfor x in a[::-1]:M=max(M,gcd(w,B[x]));w=gcd(w,A[x])\nprint(M)', 'n=int(input())\na=list(map(int,input().split()))\nL=[0]\nR=[0]\ndef gcd(x,y):\n if x==0:return y\n else:return ... | ['Runtime Error', 'Accepted'] | ['s056216629', 's364160899'] | [2940.0, 14584.0] | [17.0, 204.0] | [191, 275] |
p03061 | u794910686 | 2,000 | 1,048,576 | There are N integers, A_1, A_2, ..., A_N, written on the blackboard. You will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written. Find the maximum possible greatest common divisor of the N integers on the blackboard afte... | ['def gcd(a,b):\n while b:\n a,b=b,a%b\n return a\n\nn=int(input())\na=list(map(int,input().split()))\n\ntemp=a[0]\nans=[]\nfor i in range(1,n):\n g=gcd(a[i],temp)\n ans.append(g)\nans=sorted(ans)\n\ntry:\n print(ans[1])\nexcept:\n print(ans[0])\n', 'def gcd(a,b):\n while b:\n a,b=b,a... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s296489571', 's328692043', 's376397783', 's735442010'] | [14076.0, 14080.0, 14492.0, 14524.0] | [127.0, 124.0, 195.0, 180.0] | [251, 217, 397, 364] |
p03061 | u797016134 | 2,000 | 1,048,576 | There are N integers, A_1, A_2, ..., A_N, written on the blackboard. You will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written. Find the maximum possible greatest common divisor of the N integers on the blackboard afte... | ['def gcd(x,y):\n if y == 0:\n return x\n return gcd(x%y, y)\n\nn = int(input())\na = list(map(int, input().split()))\nL = [0]\nR = [0]\nnow1 = 0\nnow2 = 0\nans = 0\n\nfor i in range(n-1):\n now1 = gcd(now1,a[i])\n L.append(now1)\n\n now2 = gcd(now2,a[-i-1])\n R.append(now2)\n\nfor i in range(n... | ['Runtime Error', 'Accepted'] | ['s996818755', 's946191164'] | [14076.0, 14076.0] | [99.0, 205.0] | [352, 337] |
p03061 | u798129018 | 2,000 | 1,048,576 | There are N integers, A_1, A_2, ..., A_N, written on the blackboard. You will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written. Find the maximum possible greatest common divisor of the N integers on the blackboard afte... | ['from functools import reduce\ninf = 10**10\nimport sys\ninput = sys.stdin.readline\ndef gcd_list(numbers):\n return reduce(math.gcd,numbers)\nn = int(input())\na = list(map(int,input().split()))\nindex = inf\nif n == 2:\n print(max(a))\nelse:\n a.sort()\n if math.gcd(a[0],a[n-1]) == 1:\n print(max(... | ['Runtime Error', 'Accepted'] | ['s832396674', 's803283927'] | [14640.0, 14636.0] | [74.0, 470.0] | [598, 736] |
p03061 | u798678713 | 2,000 | 1,048,576 | There are N integers, A_1, A_2, ..., A_N, written on the blackboard. You will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written. Find the maximum possible greatest common divisor of the N integers on the blackboard afte... | ['# from math import gcd\n\ndef gcd(x, y): \n \n while(y): \n x, y = y, x % y \n \n return x \n\ndef cR(A, i):\n if i == len(A):\n return 0\n else:\n g = 0\n for i in range(i, len(A)):\n g = gcd(g, A[i])\n return g\n\ndef cL(A, i):\n if i == 1:\n return... | ['Wrong Answer', 'Accepted'] | ['s049320905', 's304166792'] | [14928.0, 14428.0] | [239.0, 180.0] | [723, 467] |
p03061 | u800058906 | 2,000 | 1,048,576 | There are N integers, A_1, A_2, ..., A_N, written on the blackboard. You will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written. Find the maximum possible greatest common divisor of the N integers on the blackboard afte... | ['import math\nfrom itertools import accumulate\n\nn = int(input())\na = list(map(int, input().split()))\n\nfromright = list(accumulate(a, math.gcd))\na.reverse()\nfromleft = list(accumulate(a, math.gcd))\nfromleft.reverse()\n\ngcd = []\n\ngcd.append(fromleft[1])\n\nfor i in range(1, n-1):\n gcd.append(math.gcd(fromri... | ['Wrong Answer', 'Accepted'] | ['s174648794', 's176243823'] | [24936.0, 24976.0] | [97.0, 96.0] | [381, 353] |
p03061 | u802977614 | 2,000 | 1,048,576 | There are N integers, A_1, A_2, ..., A_N, written on the blackboard. You will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written. Find the maximum possible greatest common divisor of the N integers on the blackboard afte... | ['\n\nimport fractions\nclass segment_tree:\n \n def __init__(self, init_val, Input):\n \n n=len(Input)\n self.init_val = init_val\n self.num = 2 ** (n - 1).bit_length()\n self.seg = [init_val] * 2 * self.num\n for i in range(n):\n self.seg[i + self.num - 1] = ... | ['Time Limit Exceeded', 'Time Limit Exceeded', 'Accepted'] | ['s221555815', 's830060047', 's694703884'] | [16152.0, 16156.0, 14488.0] | [2104.0, 2104.0, 235.0] | [2048, 262, 395] |
p03061 | u806976856 | 2,000 | 1,048,576 | There are N integers, A_1, A_2, ..., A_N, written on the blackboard. You will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written. Find the maximum possible greatest common divisor of the N integers on the blackboard afte... | ['from math import gcd\nn=int(input())\na=list(map(int,input().split()))\nl=[0 for i in range(n)]\nr=[0 for i in range(n)]\nl[0]=a[0]\nr[0]=a[-1]\nfor i in range(n-1):\n l[i+1]=gcd(l[i],a[i+1])\nfor i in range(n-1):\n r[i+1]=gcd(r[i],a[-2-i])\nans=[0 for i in range(n)]\nfor i in range(1,n-1):\n ans[i]=gcd(l[i-... | ['Wrong Answer', 'Accepted'] | ['s896698663', 's987315680'] | [24484.0, 20564.0] | [140.0, 1111.0] | [371, 2077] |
p03061 | u813102292 | 2,000 | 1,048,576 | There are N integers, A_1, A_2, ..., A_N, written on the blackboard. You will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written. Find the maximum possible greatest common divisor of the N integers on the blackboard afte... | ["import fractions\nfrom functools import reduce\n\ndef gcd_list(numbers):\n return reduce(fractions.gcd, numbers)\n\ndef main():\n n = int(input())\n a = list(map(int, input().split()))\n\n tmp = gcd_list(a)\n ans = 0\n for i in range(n):\n a_ = a.copy()\n a_.pop(i)\n res = gcd_l... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s071302154', 's831113761', 's695740010'] | [16056.0, 16600.0, 14060.0] | [2104.0, 2104.0, 221.0] | [414, 480, 345] |
p03061 | u814781830 | 2,000 | 1,048,576 | There are N integers, A_1, A_2, ..., A_N, written on the blackboard. You will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written. Find the maximum possible greatest common divisor of the N integers on the blackboard afte... | ['N = int(input())\nA = [int(i) for i in input().split()]\n\ndef gcd(a, b):\n if b == 0:\n return a\n return gcd(b, a % b)\n\nres = [0] * N\nl = [0] * (N + 1)\nr = [0] * (N + 1)\n\nfor i in range(N):\n l[i+1] = gcd(l[i], A[i])\n\nfor i in range(N, 0, -1):\n r[i-1] = gcd(r[i], A[i-1])\n\nfor i in ran... | ['Wrong Answer', 'Accepted'] | ['s707757845', 's441975026'] | [14056.0, 14052.0] | [221.0, 220.0] | [337, 354] |
p03061 | u822725754 | 2,000 | 1,048,576 | There are N integers, A_1, A_2, ..., A_N, written on the blackboard. You will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written. Find the maximum possible greatest common divisor of the N integers on the blackboard afte... | ['import numpy as np\ndef gcd(a, b):\n\tif a > b:\n\t\ta, b = b, a\n\tif b == 0:\n\t\treturn a\n\telse:\n\t\treturn gcd(b, a % b)\nn = int(input())\na = np.array([int(x) for x in input().split()])\nnp.sort(a)\nl = np.zeros(n + 1)\nr = np.zeros(n + 1)\nm = np.zeros(n)\nfor i in range(n):\n\tl[i + 1] = gcd(l[i], a[i])\nf... | ['Runtime Error', 'Accepted'] | ['s325926423', 's263400015'] | [23112.0, 23084.0] | [254.0, 1999.0] | [417, 417] |
p03061 | u829859091 | 2,000 | 1,048,576 | There are N integers, A_1, A_2, ..., A_N, written on the blackboard. You will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written. Find the maximum possible greatest common divisor of the N integers on the blackboard afte... | ['from fractions import gcd\nfrom functools import reduce\n\ndef gcd_list(numbers):\n return reduce(gcd, numbers)\n\nN = int(input())\nA = list(map(int, input().split()))\n\nmax_gcd = 1\ni_gcd = gcd_list(A[1:])\nfor i in range(1, N):\n if max_gcd < i_gcd:\n max_gcd = i_gcd\n i_gcd = gcd_list(A[:(i-1)] ... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s062838454', 's541548047', 's837425175'] | [16068.0, 16084.0, 14436.0] | [2104.0, 2104.0, 201.0] | [328, 301, 461] |
p03061 | u830054172 | 2,000 | 1,048,576 | There are N integers, A_1, A_2, ..., A_N, written on the blackboard. You will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written. Find the maximum possible greatest common divisor of the N integers on the blackboard afte... | ['import fractions\nfrom functools import reduce\n\ndef gcd(numbers):\n return reduce(fractions.gcd, numbers)\n\nN = int(input())\nA = list(map(int, input().split()))\n\nans = []\n\nif len(A) == 1:\n ans.append(A[0])\nelse:\n ans.append(gcd(A[1:]))\n ans.append(gcd(A[:N]))\n\n for i in range(1, N-1):\n ... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s002005018', 's956113402', 's803593179'] | [22628.0, 9008.0, 21200.0] | [2206.0, 25.0, 869.0] | [416, 406, 930] |
p03061 | u842964692 | 2,000 | 1,048,576 | There are N integers, A_1, A_2, ..., A_N, written on the blackboard. You will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written. Find the maximum possible greatest common divisor of the N integers on the blackboard afte... | ['#ABC125_C\nimport fractions\nfrom functools import reduce\n \ndef gcd(nums):\n return reduce(fractions.gcd,nums)\n \nN=int(input())\nA=list(map(int,input().split()))\nans=1\n \nfor i in range(N):\n temp=A.copy()\n temp.reduce(temp[i])\n if gcd(temp) > ans:\n ans=gcd(temp)\nprint(ans) ', '#A... | ['Runtime Error', 'Time Limit Exceeded', 'Time Limit Exceeded', 'Accepted'] | ['s045837434', 's609531287', 's896088408', 's418806674'] | [16096.0, 16152.0, 16060.0, 14584.0] | [62.0, 2104.0, 2104.0, 204.0] | [296, 297, 293, 455] |
p03061 | u844005364 | 2,000 | 1,048,576 | There are N integers, A_1, A_2, ..., A_N, written on the blackboard. You will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written. Find the maximum possible greatest common divisor of the N integers on the blackboard afte... | ['\nn = int(input())\na = list(map(int, input().split()))\n\n\nimport sys\nif n == 2:\n print(max(a))\n sys.exit()\n\n\ndef gcd(x, y):\n while y:\n x, y = y, x % y\n return x\n\n\ng = a[0]\ngcd_left = [g]\nfor i in range(n-1):\n g = gcd(g, a[i+1])\n gcd_left.append(g)\n\ng = a[n-1]\ngcd_right =... | ['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s295137195', 's757954202', 's812063773', 's975293249', 's811931755'] | [14332.0, 14056.0, 14584.0, 14524.0, 14584.0] | [133.0, 197.0, 64.0, 43.0, 192.0] | [541, 541, 310, 309, 541] |
p03061 | u844789719 | 2,000 | 1,048,576 | There are N integers, A_1, A_2, ..., A_N, written on the blackboard. You will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written. Find the maximum possible greatest common divisor of the N integers on the blackboard afte... | ['import itertools\nN = int(input())\nA = [int(_) for _ in input().split()]\ngcd = lambda x, y: gcd(y, x % y) if x % y else y\nG = list(itertools.accumulate(A, func=gcd))\ng = G[-1]\nif G[0] == g:\n ans = list(itertools.accumulate(A[1:], func=gcd))[-1]\nelse:\n for i in range(1, N - 1):\n if G[i] == g:\n ... | ['Runtime Error', 'Accepted'] | ['s588430147', 's046080123'] | [14528.0, 14528.0] | [103.0, 174.0] | [484, 371] |
p03061 | u860478135 | 2,000 | 1,048,576 | There are N integers, A_1, A_2, ..., A_N, written on the blackboard. You will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written. Find the maximum possible greatest common divisor of the N integers on the blackboard afte... | ['import fractions\nimport copy\n\nn1 = int(input())\nnl1 = [int(i1) for i1 in input().split()]\n\nr1 = 0\n\nnl1.sort(reverse=True)\nfor i2 in range(n1):\n nl2 = copy.copy(nl1)\n if i2 == 0:\n nl2[i2] = nl1[1]\n else:\n nl2[i2] = nl1[i2 - 1]\n r2 = nl2[0]\n for i3 in range(n1 - 1):\n ... | ['Time Limit Exceeded', 'Wrong Answer', 'Time Limit Exceeded', 'Runtime Error', 'Runtime Error', 'Time Limit Exceeded', 'Time Limit Exceeded', 'Wrong Answer', 'Time Limit Exceeded', 'Time Limit Exceeded', 'Accepted'] | ['s138002320', 's209061084', 's253846475', 's313886558', 's349610831', 's492047867', 's599033501', 's660423779', 's794495728', 's990024368', 's137605343'] | [16068.0, 16064.0, 16080.0, 3064.0, 3064.0, 16084.0, 16148.0, 16064.0, 16084.0, 16132.0, 14180.0] | [2104.0, 2104.0, 2104.0, 17.0, 17.0, 2104.0, 2104.0, 2104.0, 2104.0, 2104.0, 294.0] | [414, 599, 367, 356, 365, 402, 654, 594, 351, 391, 519] |
p03061 | u860649643 | 2,000 | 1,048,576 | There are N integers, A_1, A_2, ..., A_N, written on the blackboard. You will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written. Find the maximum possible greatest common divisor of the N integers on the blackboard afte... | ['N = int(input())\nA = list(map(int, input().split()))\n\ndef gcd(a, b):\n while b:\n a, b = b, a%b\n return a\n\nL, R = [0]*(N+1), [0]*(N+1)\nfor i in range(1,N+1):\n L[i] = gcd(L[i-1], A[i-1])\n R[N-i] = gcd(R[N+1-i], A[N-i])\n\nans = 0\nfor i in range(N):\n ans = max(0, gcd(L[i], R[N-i]))\n\np... | ['Wrong Answer', 'Accepted'] | ['s115633571', 's518695011'] | [14052.0, 14080.0] | [192.0, 197.0] | [310, 312] |
p03061 | u864273141 | 2,000 | 1,048,576 | There are N integers, A_1, A_2, ..., A_N, written on the blackboard. You will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written. Find the maximum possible greatest common divisor of the N integers on the blackboard afte... | ['N=int(input())\nA=list(map(int,input().split()))\n\nn=0\nsm=0\nif A[0]>0:\n mn=A[0]\nelse:\n mn=(-1)*A[0]\n\n\nfor i in range(0,N):\n if A[i]<0:\n n=n+1\n AA=A.pop(i)\n A.insert(i,(-1)*AA)\n sm=sm+AA*(-1)\n if (-1)*AA<mn:\n mn=(-1)*AA\n else:\n sm=sm+A[i]\n if A[i]<mn:\n mn=A[i]\n\n... | ['Wrong Answer', 'Accepted'] | ['s314482466', 's424786386'] | [14584.0, 14076.0] | [71.0, 176.0] | [339, 526] |
p03061 | u868628468 | 2,000 | 1,048,576 | There are N integers, A_1, A_2, ..., A_N, written on the blackboard. You will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written. Find the maximum possible greatest common divisor of the N integers on the blackboard afte... | ['def gcd(a,b):\n if a < b:\n a,b = b,a\n if b == 0:\n return a\n if a%b == 0:\n return b\n return gcd(b, a%b)\nN = int(input())\nA = map(int,input().split())\ng1=[0 for i in range(N)]\ng2=[0 for i in range(N)]\ng1[0]=a[0]\ng2[N-1]=a[N-1]\nfor i in range(1,N):\n g1[i]=gcd(g1[i-1],a[i])... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s274625469', 's322338363', 's792571868', 's857168742', 's148925638'] | [12008.0, 11744.0, 11132.0, 12004.0, 14436.0] | [38.0, 36.0, 29.0, 37.0, 191.0] | [461, 461, 464, 461, 467] |
p03061 | u874918673 | 2,000 | 1,048,576 | There are N integers, A_1, A_2, ..., A_N, written on the blackboard. You will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written. Find the maximum possible greatest common divisor of the N integers on the blackboard afte... | ['def 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\nimport random\n \nn = int(input())\na = list(map(int, input().split()))\n \ntmpgcd = list()\ntmpgcd.append(gcd(a[0], a[-1]))\n\ntmpgcd = sorted(tmpgcd)\nmini = tmpgcd[0]\n\nresult = 0\nfor i in... | ['Wrong Answer', 'Accepted'] | ['s227478658', 's210712855'] | [15000.0, 14400.0] | [2104.0, 211.0] | [456, 446] |
p03061 | u887207211 | 2,000 | 1,048,576 | There are N integers, A_1, A_2, ..., A_N, written on the blackboard. You will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written. Find the maximum possible greatest common divisor of the N integers on the blackboard afte... | ['def ans():\n N = int(input())\n A = list(map(int,input().split()))\n\n def gcd(m, n):\n while n:\n m, n = n, m%n\n return m\n\n res = set()\n x = min(A)\n for i in range(N):\n res.add(gcd(A[i], x))\n\n b = A[0]\n for a in A[1:]:\n b = gcd(a, b)\n print(list(res)[b-1])\nans()', 'N = int(input... | ['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s120644151', 's356590891', 's844504515', 's932237544'] | [14060.0, 14080.0, 14080.0, 14052.0] | [130.0, 86.0, 172.0, 183.0] | [283, 308, 330, 290] |
p03061 | u891635666 | 2,000 | 1,048,576 | There are N integers, A_1, A_2, ..., A_N, written on the blackboard. You will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written. Find the maximum possible greatest common divisor of the N integers on the blackboard afte... | ['import math\n\nn = int(input())\nnums = list(map(int, input().split()))\n\nif n == 2:\n print(max(nums))\nelse:\n l_gcds = [nums[0]]\n r_gcds = [nums[-1]]\n for i in range(1, n - 1):\n l = math.gcd(l_gcds[-1], nums[i])\n r = math.gcd(r_gcds[-1], nums[n - i - 1])\n l_gcds.append(l)\n ... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s122951039', 's161530790', 's649349843'] | [14180.0, 14440.0, 14452.0] | [43.0, 42.0, 188.0] | [361, 326, 573] |
p03061 | u899909022 | 2,000 | 1,048,576 | There are N integers, A_1, A_2, ..., A_N, written on the blackboard. You will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written. Find the maximum possible greatest common divisor of the N integers on the blackboard afte... | ['def gcd(a,b):\n while b!=0:\n a,b=b,a%b\n return a\n\nn = int(input())\na = list(map(int, input().split()))\nleft, right = [0] * (n+1), [0] * (n+1)\nprint(left, right)\nfor i in range(n):\n left[i+1] = gcd(left[i], a[i])\nfor i in reversed(range(n)):\n right[i] = gcd(right[i+1], a[i])\nans = 0\nfor i in ra... | ['Wrong Answer', 'Accepted'] | ['s591079343', 's313933832'] | [14488.0, 14400.0] | [208.0, 200.0] | [387, 367] |
p03061 | u905268546 | 2,000 | 1,048,576 | There are N integers, A_1, A_2, ..., A_N, written on the blackboard. You will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written. Find the maximum possible greatest common divisor of the N integers on the blackboard afte... | ['def gcd(a, b):\n if b == 0: return a\n return gcd(b, a % b)\n\n\nN = int(input())\nA = list(map(int, input().split()))\n\nA.sort()\nans = 1\n\nfor i in range(N):\n B = A[:]\n B.pop(i)\n tmp = B[0];\n for j in B:\n if (ans > j):\n break\n tmp = gcd(tmp, j)\n ans = max(... | ['Wrong Answer', 'Accepted'] | ['s306566229', 's123171446'] | [14080.0, 14436.0] | [2104.0, 234.0] | [327, 344] |
p03061 | u906093973 | 2,000 | 1,048,576 | There are N integers, A_1, A_2, ..., A_N, written on the blackboard. You will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written. Find the maximum possible greatest common divisor of the N integers on the blackboard afte... | ['N = int(input())\nA = list(map(int, input().split()))\n\nfrom functools import reduce\nimport fractions\n\ndef gcd(num_list):\n return reduce(fractions.gcd, num_list)\n\nkys = []\n\nfor i in range(N):\n B = A.copy()\n B.pop(i)\n kys.append(gcd(B))\n\nprint(max(kys))', 'N = int(input())\nA = list(map(int, ... | ['Time Limit Exceeded', 'Time Limit Exceeded', 'Time Limit Exceeded', 'Accepted'] | ['s127518950', 's193011572', 's249881433', 's552260726'] | [14060.0, 14080.0, 14076.0, 14400.0] | [2104.0, 2104.0, 2104.0, 241.0] | [262, 315, 276, 515] |
p03061 | u916637712 | 2,000 | 1,048,576 | There are N integers, A_1, A_2, ..., A_N, written on the blackboard. You will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written. Find the maximum possible greatest common divisor of the N integers on the blackboard afte... | ['def gcd(a, b):\n\twhile b:\n\t\ta, b = b, a % b\n\treturn a\n\nn=int(input())\nA=list(map(int, input().split()))\n#a=1\ninit=1\n#maxa=99999999999999999999999999\n#maxa=A[1]\nB1=[]\nfor i in A:\n if init==1:\n a=i\n init=0\n B1.append(a)\n else:\n a=gcd(a,i)\n B1.append(a)\n\ni... | ['Wrong Answer', 'Accepted'] | ['s475731265', 's947047510'] | [14076.0, 14076.0] | [181.0, 184.0] | [712, 734] |
p03061 | u918845030 | 2,000 | 1,048,576 | There are N integers, A_1, A_2, ..., A_N, written on the blackboard. You will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written. Find the maximum possible greatest common divisor of the N integers on the blackboard afte... | ['from collections import defaultdict\n\n\ndef gcv(a, b):\n if b == 0:\n return a\n else:\n return gcv(b, a % b)\n\n\ndef solve(n, a):\n if n == 2 and a[0] == a[1]:\n return a[0]\n n_dict = defaultdict(int)\n for i in range(len(a)):\n for j in range(len(list(a)) - i):\n ... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s328645339', 's837242083', 's335081101'] | [19892.0, 2940.0, 14384.0] | [2104.0, 18.0, 200.0] | [785, 1000, 575] |
p03061 | u923662841 | 2,000 | 1,048,576 | There are N integers, A_1, A_2, ..., A_N, written on the blackboard. You will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written. Find the maximum possible greatest common divisor of the N integers on the blackboard afte... | ['import math\nfrom functools import reduce\ninput()\nA = list(map(int,input().split()))\n\nans = 1\nfor i in range(N):\n g = reduce(math.gcd,A[:i]+A[i+1:])\n ans = max(ans,g)\nprint(ans)', 'import math\nfrom collections import deque\nN = int(input())\nA = list(map(int,input().split()))\n\nM = 0\nL = deque([0])\n... | ['Runtime Error', 'Accepted'] | ['s849828438', 's757587856'] | [20892.0, 20892.0] | [56.0, 495.0] | [182, 305] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.