s_id
stringlengths
10
10
p_id
stringlengths
6
6
u_id
stringlengths
10
10
date
stringlengths
10
10
language
stringclasses
1 value
original_language
stringclasses
11 values
filename_ext
stringclasses
1 value
status
stringclasses
1 value
cpu_time
stringlengths
1
5
memory
stringlengths
1
7
code_size
stringlengths
1
6
code
stringlengths
1
539k
s479006907
p03460
u637175065
1516645921
Python
PyPy3 (2.4.0)
py
Runtime Error
1543
211672
2077
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools sys.setrecursionlimit(10**7) inf = 10**20 eps = 1.0 / 10**15 mod = 10**9+7 def LI(): return [int(x) for x in sys.stdin.readline().split()] def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()] def LF()...
s726098141
p03460
u284102701
1516596089
Python
Python (3.4.3)
py
Runtime Error
18
2940
1274
#include <bits/stdc++.h> //#include <math.h> using namespace std; #define INF 1.1e9 #define LINF 1.1e18 #define FOR(i,a,b) for (int i=(a);i<(b);++i) #define REP(i,n) FOR(i,0,n) #define ALL(v) (v).begin(),(v).end() #define pb push_back #define pf push_front #define fi first #define se second #define BIT(x,n) bitset<n>(...
s832283957
p03460
u942033906
1516591606
Python
Python (3.4.3)
py
Runtime Error
559
35444
423
N,K = map(int,input().split()) KK = 2*K whites = [[0 for i in range(KK)] for j in range(K)] total = [[0 for i in range(KK)] for j in range(K)] for i in range(N): x,y,c = input().split() x,y = int(x), int(y) if c == 'B': y += K xx = x % K yy = y % KK whites[xx][yy] += 1 ans = 0 for y in range(K): tmp = sum(w...
s851902346
p03460
u555811857
1516590551
Python
Python (3.4.3)
py
Runtime Error
799
12020
1480
# -*- coding: utf-8 -*- import heapq import math import sys def hanten(c): if c == 'B': return 'W' else: return 'B' tmp = input() N, K = [int(a) for a in tmp.split()] all_num = {'B': 0, 'W': 0} requirements = [[0 for x in range(K)] for y in range(K)] for n in range(N): tmp = input() x,...
s062054842
p03462
u110383845
1532144483
Python
Python (3.4.3)
py
Runtime Error
17
3064
2334
#include <bits/stdc++.h> using namespace std; using lint = long long int; constexpr lint MOD = 1000000007; vector<lint> fac, facInv, inv; void facInit(int nmax) { fac = facInv = inv = vector<lint>(nmax + 1, 1); for (int i = 2; i <= nmax; i++) { fac[i] = fac[i-1] * i % MOD; inv[i] = MOD - i...
s466918629
p03463
u246366098
1600996142
Python
Python (3.8.2)
py
Runtime Error
29
9064
77
n,a,b=map(int,input.split()) if (a-b)%2==0:print('Alice') else:print('Borys')
s519270095
p03463
u898967808
1599880121
Python
Python (3.8.2)
py
Runtime Error
30
9144
89
n,a,b = map(int,input().split()) if (b-a)%2 == 0: print('Borys') else: pritn('Alice')
s357950841
p03463
u285891772
1597983193
Python
Python (3.8.2)
py
Runtime Error
32
10088
1215
import sys, re from collections import deque, defaultdict, Counter from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd from itertools import accumulate, permutations, combinations, product, groupby, combinations_with_replacement from operator import itemgetter, mul from copy import deepcopy from s...
s558293775
p03463
u434649140
1593488315
Python
Python (3.8.2)
py
Runtime Error
24
8840
165
#include <bits/stdc++.h> using namespace std; int main() { int n,A,B; cin>>n>>A>>B; int anx=B-A-1; if(ans%2==0) cout<<"Borys"; else cout<<"Alice"; }
s331575266
p03463
u841021102
1593047512
Python
Python (3.8.2)
py
Runtime Error
25
8960
109
n, a, b = map(int, input().split()) if (n + b) % 2 == 0: print("Alice") elif (n + b) % 2 != 0: print("Bor
s496202092
p03463
u672475305
1591654274
Python
PyPy3 (2.4.0)
py
Runtime Error
167
38256
370
from math import ceil k = int(input()) A = list(map(int,input().split()))[::-1] if A[0]!=2: print(-1) exit() flg = True ans = [2,3] for i in range(1, k): m = A[i]*(ceil(ans[0]/A[i])) n = A[i]*(ceil(ans[1]/A[i])) if not m<=ans[1]<=n: flg = False break else: ans = [m,...
s284058974
p03463
u408620326
1590806107
Python
Python (3.4.3)
py
Runtime Error
17
2940
112
N, A, B = [int(x) for x in input().strip().split()] if (A - B) % 2 == 0: print('Alice') eles: print('Borys')
s726410775
p03463
u810778810
1587329649
Python
Python (3.4.3)
py
Runtime Error
17
2940
98
a=list(input()) x=int(a[1]) y=int(a[2]) if abs(x-y)%2==0: print("Alice") else: print("Borys")
s788742054
p03463
u923270446
1586964180
Python
Python (3.4.3)
py
Runtime Error
17
2940
92
n, a, b = map(int, input()) if (b - a) % 2 == 0: print("Alice") else: print("Borys")
s255837763
p03463
u902151549
1585911388
Python
Python (3.4.3)
py
Runtime Error
17
2940
80
N,A,B=map(int,input().split()) d=B-A if d%2==:print("Alice") else:print("Borys")
s495832378
p03463
u162612857
1583557992
Python
Python (3.4.3)
py
Runtime Error
18
2940
91
n, a, b = list(map(int(), input().split())) print("Borys" if (b - a) % 2 == 1 else "Alice")
s746587892
p03463
u902468164
1579474990
Python
Python (3.4.3)
py
Runtime Error
17
2940
96
n, a, b = [int(i) for i in input().splti(' ')] print('Alice' if abs(a-b) % 2 == 0 else 'Borys')
s512471402
p03463
u187109555
1574545500
Python
Python (3.4.3)
py
Runtime Error
18
2940
97
N, A, B = map(int, input().split()) if (A-B) % 2 == 0: print("Alice) else: print("Borys")
s851393364
p03463
u844789719
1570155132
Python
Python (3.4.3)
py
Runtime Error
17
3064
478
import math K = int(input()) A = [int(_) for _ in input().split()] l = r = 2 ''' if x children form groups consisting of y children each then z children are left => z=y*(x//y) => y*(math.ceil(z/y))<=x<y*(math.floor(z/y)+1) ''' #necessary conditions for a in A[::-1]: l = a * math.ceil(l / a) r = a * (math.floor...
s144101209
p03463
u347640436
1568169994
Python
Python (3.4.3)
py
Runtime Error
17
2940
99
N, A, B = map(int, input().split()) elif (B - A) % 2 == 0: print('Alice') else: print('Borys')
s957853004
p03463
u608777907
1566061320
Python
Python (3.4.3)
py
Runtime Error
17
3060
487
def solve(A): current_max = 2 current_min = 2 for a_k in reversed(A): if current_max < a_k: print('-1') return current_max = (current_max // a_k) * a_k + (a_k - 1) current_min = ((current_min - 1) // a_k + 1) * a_k current_min = max(current_min, a_k) ...
s181741735
p03463
u820047642
1565897979
Python
Python (3.4.3)
py
Runtime Error
17
2940
87
n,a,b=int(input().split()) if (b-a+1)%2==0: print("Borys") else: print("Alice")
s559208902
p03463
u921773161
1565436789
Python
Python (3.4.3)
py
Runtime Error
17
2940
123
print('Draw')n, a, b = map(int, input().split()) if (b-a) % 2 == 0: ans = 'Alice' else: ans = 'Borys' print(ans)
s837563294
p03463
u329058683
1559961476
Python
Python (3.4.3)
py
Runtime Error
17
2940
79
N,A,B=map(input().split()) if A-B%2==0: print("Alice") else: print("Borys")
s164037960
p03463
u545001286
1557180188
Python
Python (3.4.3)
py
Runtime Error
18
3064
323
T=int(input()) for t in range(T): a,b,c,d=map(int,input().split(' ')) l,x,y,o=(a+b)//(min(a,b)+1),0,0,"" if a*l<=b:y=a+b elif b*l<=a:x=a+b else:x,y=(a*l-b)//(l-1),(b*l-a)//(l-1) for i in range(c,d+1):o+="AB"[i%(l+1)==0] if i<=x else "BA"[(a+b-i+1)%(l+1)==0] if a+b-i+1<=y else "AB"[a-x+x//(l+1)-y//(l+1)==0] print...
s699888059
p03463
u545001286
1557180132
Python
Python (3.4.3)
py
Runtime Error
18
3064
329
T=int(input()) for t in range(T): a,b,c,d=map(int,input().split(' ')) l,x,y,o=(a+b)//(min(a,b)+1),0,0,"" if a*l<=b:y=a+b elif b*l<=a:x=a+b else:x,y=(a*l-b)//(l-1),(b*l-a)//(l-1) for i in range(c,d+1):o+="AB"[i%(l+1)==0] if i<=x else o+="BA"[(a+b-i+1)%(l+1)==0] if a+b-i+1<=y else o+="AB"[a-x+x//(l+1)-y//(l+1)==0] ...
s467246268
p03463
u303059352
1545581669
Python
Python (3.4.3)
py
Runtime Error
18
2940
889
#include <iostream> #include <cstdio> #include <cstdlib> #include <cstring> #include <cmath> #include <algorithm> #include <string> #include <sstream> #include <complex> #include <vector> #include <list> #include <queue> #include <deque> #include <stack> #include <map> #include <set> #include <array> #include <tuple> #...
s254807099
p03463
u102960641
1544647719
Python
Python (3.4.3)
py
Runtime Error
18
2940
106
n,a,b = map(int, input().split()) if b - a % 2 == 0: print("Alice") elif b - a % 2 == 1 print("Borys")
s996780018
p03463
u136647933
1544647661
Python
Python (3.4.3)
py
Runtime Error
17
2940
119
n,a,b=map(int,input().split()) bet=abs(b-a) if bet%2==0: winner='ALice' else: winner='Borys' print(winner)
s832436942
p03463
u102960641
1544647658
Python
Python (3.4.3)
py
Runtime Error
18
2940
106
n,a,b = map(int, input().split()) if b - a % 2 == 0: print("Alice") elif b - a % 2 == 1 print("Borys")
s336401339
p03463
u870965055
1530728639
Python
Python (3.4.3)
py
Runtime Error
17
2940
587
#include <bits/stdc++.h> using namespace std; using ll = long long; using vi = vector<ll>; using vvi= vector<vi>; using vs = vector<string>; #define rep(i,n) for(ll i = 0; i < (n); ++i) #define red(i,n) for(ll i = (n)-1; i >= 0; --i) #define all(a) begin(a),end(a) #define pb(a) push_back(a) #define mp(a,b) m...
s302914108
p03463
u058240079
1526309327
Python
Python (2.7.6)
py
Runtime Error
10
2568
94
n,a,b = map(int, raw_input().split() if (b-a) % 2 == 0: print "Alice" else: print "Borys"
s500757091
p03463
u610441939
1522355522
Python
Python (3.4.3)
py
Runtime Error
272
19244
289
# -*- coding: utf-8 -*- import numpy n = int(input()) a = [int(i) for i in input().split()] dp = 1 for i in range(0, len(a)): dp = (dp | (dp << a[i])) asum = 0 for i in range(0, len(a)): asum += a[i] for i in range(int((asum + 1) / 2), asum + 1): if (dp >> i) & 1: print(i) break
s131869066
p03463
u454481887
1517610232
Python
Python (3.4.3)
py
Runtime Error
17
2940
84
N,A,B = int.input() M = A+B if (M%2==1): print("Borys") else: print("Alice")
s548580296
p03463
u454481887
1517610086
Python
Python (3.4.3)
py
Runtime Error
18
2940
91
N,A,B = map(int.input()) M = N+A+B if (M%2==1): print("Borys") else: print("Alice")
s627367222
p03463
u454481887
1517609969
Python
Python (3.4.3)
py
Runtime Error
18
2940
87
N,A,B = map(int.input()) if ((N+A+B)%2==1): print("Borys") else: print("alice")
s067749466
p03463
u745997547
1517371102
Python
Python (3.4.3)
py
Runtime Error
17
2940
117
# N, A, B = list(map(int, input().rstpir().split())) # if (B-A-1)%2==0: print('Borys') else: print('Alice')
s029302757
p03463
u757738907
1516467078
Python
Python (3.4.3)
py
Runtime Error
17
2940
48
txt = input() txt = input.split() print(1, 1, 1)
s265788709
p03463
u297574184
1516065243
Python
Python (3.4.3)
py
Runtime Error
17
3060
248
from math import ceil, floor K = int(input()) As = list(map(int, input().split())) L = 2 R = 2 for A in reversed(As): if R // A * A < L: print('-1') exit() L = ceil(L / A) * A R = floor(R / A) * A + A - 1 print(L, R)
s256562901
p03463
u057463552
1515989971
Python
Python (3.4.3)
py
Runtime Error
17
3064
1005
import sys K = int(input()) A = [int(x) for x in input().split()] A.reverse() jmax, jmin = 2,2 if A[0] != 2: print(-1) sys.exit() """max""" for i in range(0,K-1): drop_num = [] for j in range(0,A[i]): #脱落者数の候補を入れていく if ( jmax + j ) % A[i+1] == 0: drop_num.append(j) if dr...
s425031896
p03463
u293579463
1515989337
Python
Python (3.4.3)
py
Runtime Error
18
3064
861
K = int(input()) A = [int(i) for i in input().split()] Max, Min = 0, 0 error = -1 def N_max(a, Max, Min): if Max > a and Min%a != 0: return a*(Min//a + 2) - 1 elif Max > a and Min%a == 0: return a*(Min//a + 1) - 1 else: return a*2 -1 def N_min(a, m): if m > a: ...
s521517803
p03463
u943004959
1515986698
Python
PyPy3 (2.4.0)
py
Runtime Error
167
38640
330
import itertools def solve(): n = int(input()) A = list(set(map(int, input().split(" ")))) sum_list = [] for i in range(1, n + 1): for ele in list(itertools.combinations(A, i)): sum_list.append(sum(ele)) sum_list.sort() length = len(sum_list) print(sum_list[length // 2]...
s185057181
p03463
u125050519
1515983407
Python
Python (3.4.3)
py
Runtime Error
17
2940
149
moji = input() N = moji[0] A = moji[2] B = moji[4] res = "" if ((int)(B) - (int)(A))%2 == 0: res = "Alice" else: res = "Borys" print(res)
s615299280
p03463
u858136677
1515983392
Python
Python (3.4.3)
py
Runtime Error
17
2940
371
n,a,b = map(int,input().split()) if n%2 == 0 if a == 1: if b == n or b == 2: print('Borys') else: print('Alice') if b == n print('Alice') else: if a == 1: if b == n-1: print('Borys') else: print('Alice') elif b == n: if a == n-1: print('Alice') else: print('Borys') else: if (b-a)%...
s966405842
p03463
u401093859
1515983136
Python
Python (2.7.6)
py
Runtime Error
10
2568
136
N_A_B = list(map(int, input())) if N_A_B[2] - N_A_B[1] %2 == 0: print("Borys") elif N_A_B[2] - N_A_B[1] %2 == 1: print("Alice")
s737241176
p03463
u125050519
1515982439
Python
Python (3.4.3)
py
Runtime Error
17
2940
134
N = input() A = input() B = input() res = "" if ((int)(B) - (int)(A))%2 == 0: res = "Alice" else: res = "Borys" print(res)
s131710415
p03463
u399810298
1515982059
Python
Python (3.4.3)
py
Runtime Error
17
2940
117
import math N,A,B=[int(i) for i in raw_input().split()] if B-A % 2 ==0: print("Alice") else: print("Borys")
s085161822
p03463
u692632484
1515981791
Python
Python (3.4.3)
py
Runtime Error
17
2940
175
a,b,c=[int(i) for i in input().split()] 2 flag=(abs(b-c)%2)==0 if flag: print("Alice") else: print("Borys")
s012663422
p03464
u644907318
1599013686
Python
PyPy3 (7.3.0)
py
Runtime Error
116
85924
440
import math K = int(input()) A = list(map(int,input().split())) if A[N-1]!=2: print(-1) elif K==1: print(2,3) else: nmin = 2 nmax = 2+A[K-1]-1 flag = 0 for i in range(K-2,-1,-1): b = A[i] nmin = math.ceil(nmin/b)*b nmax = math.floor(nmax/b)*b if nmin>nmax: ...
s709653288
p03464
u706414019
1599000945
Python
Python (3.8.2)
py
Runtime Error
106
21296
345
import sys,math,collections,itertools input = sys.stdin.readline K=int(input()) A=list(map(int,input().split()))[::-1] ans =2 for i in range(1,K): if A[i] >= A[i-1]*2: print(-1) exit() elif A[i-1]<=A[i]<A[i-1]*2: ans = A[i] elif A[i-1]>A[i]: ans = math.ceil(A[i-1]/A[i])*A[i...
s880351896
p03464
u545368057
1598532990
Python
Python (3.8.2)
py
Runtime Error
201
20508
430
n = int(input()) As = list(map(int, input().split())) def f(m): debug = m for a in As: i = m // a m = i * a return m # 二部探索? l = 1 r = 10**5+1 while r-l > 1: m = (r+l)//2 if f(m) <= 1: l = m else: r = m ans1 = r l = 1 r = 10**5 + 1 while r-l > 1: m = (r+l)//2 if f(m...
s292086639
p03464
u489959379
1595540980
Python
Python (3.8.2)
py
Runtime Error
79
20536
762
import sys sys.setrecursionlimit(10 ** 7) input = sys.stdin.readline f_inf = float('inf') mod = 10 ** 9 + 7 def resolve(): k = int(input()) A = list(map(int, input().split()))[::-1] if A[0] != 2: print(-1) else: prev_min, prev_max = 2, 3 for i in range(1, k): a = ...
s238953469
p03464
u793868662
1593362646
Python
PyPy3 (7.3.0)
py
Runtime Error
91
74744
918
# from collections import deque k = int(input()) a = list(map(int, input().split())) now = [2] if k == 1: print("2 3") if a[0] == 2 else print(-1) else: for i in reversed(range(1,k)): nxt = [] for j in range(len(now)): test = now[j] ...
s687163736
p03464
u793868662
1593362005
Python
PyPy3 (7.3.0)
py
Runtime Error
2216
450084
816
def resolve(): # from collections import deque k = int(input()) a = list(map(int, input().split())) ra = a[::-1] now = [2] for i in range(k-1): nxt = [] for j in range(len(now)): test = now[j] nxtd = ra[i+1] if test % ra[i] == 0: ...
s729457731
p03464
u187516587
1590878591
Python
Python (3.4.3)
py
Runtime Error
157
14252
308
K=int(input()) A=list(map(int,input().split())) mb=Mb=2 t=1 for i in A[::-1]: if Mb//i*i>=mb: Ma=(Mb//i+1)*i-1 else: t=0 if mb%i==0: ma=mb elif (mb//i+1)*i<=Mb: ma=(mb//i+1)*i else: t=0 mb=ma Mb=Ma if t: print(ma,Ma) else: print(-1)
s095732183
p03464
u779455925
1580499314
Python
PyPy3 (2.4.0)
py
Runtime Error
220
64476
475
# input = sys.stdin.readline from bisect import * from collections import * from heapq import * import copy K=int(input()) A=list(map(int,input().split())) if A[-1]!=2: print(-1) exit() maX=2 miN=2 for i in range(K-1,-1,-1): if A[i]//maX>=2: print(-1) exit() if A[i]//miN>=2: m...
s483038035
p03464
u779455925
1580498643
Python
PyPy3 (2.4.0)
py
Runtime Error
228
64476
441
# input = sys.stdin.readline from bisect import * from collections import * from heapq import * import copy K=int(input()) A=list(map(int,input().split())) if A[-1]!=2: print(-1) exit() maX=2 miN=2 for i in range(K-1,-1,-1): if A[i]//maX>=2: print(unko) if A[i]//miN>=2: miN=A[i] i...
s727524023
p03464
u779455925
1580497892
Python
PyPy3 (2.4.0)
py
Runtime Error
221
64476
686
# input = sys.stdin.readline from bisect import * from collections import * from heapq import * import copy K=int(input()) A=list(map(int,input().split())) if A[-1]!=2: print(-1) exit() maX=2 miN=2 Amax=2 for i in range(K-1,-1,-1): if A[i]//maX>=2 or i<K-1 and A[i]>(maX//A[i+1])*A[i+1]+maX%A[i+1]: ...
s697388275
p03464
u779455925
1580497764
Python
PyPy3 (2.4.0)
py
Runtime Error
215
64476
600
# input = sys.stdin.readline from bisect import * from collections import * from heapq import * import copy K=int(input()) A=list(map(int,input().split())) if A[-1]!=2: print(-1) exit() maX=2 miN=2 Amax=2 for i in range(K-1,-1,-1): if A[i]//maX>=2 or A[i]>(maX//A[i+1])*A[i+1]+maX%A[i+1]: print(-1...
s616138463
p03464
u511965386
1576552335
Python
PyPy3 (2.4.0)
py
Runtime Error
2107
63984
272
K = int(input()) A = [int(i) for i in input().split()] def solve() : A.pop() m, M = 2, 2 for a in A[::-1] : x = (2 * M - 1) // a if a * x < M : return [-1] M = a * x return [M, M + A[0] - 1] print(*solve())
s453077548
p03464
u511965386
1576552182
Python
PyPy3 (2.4.0)
py
Runtime Error
2107
63984
197
K = int(input()) A = [int(i) for i in input().split()] A.pop() m, M = 2, 2 for a in A[::-1] : x = (2 * M - 1) // a M = a * x if M >= 2 : print(M, M + A[0] - 1) else : print(-1)
s273551951
p03464
u123756661
1573528248
Python
PyPy3 (2.4.0)
py
Runtime Error
220
63984
216
k=int(input()) a=[int(i) for i in input().split()] chk=2 if a[-1]!=2: print(-1) exit() else: for i in range(k-1,0,-1): if a[i-1]>=a[i]*2: print(-1) exit() print(chk[2])
s428794703
p03464
u123756661
1573528093
Python
PyPy3 (2.4.0)
py
Runtime Error
214
63984
216
k=int(input()) a=[int(i) for i in input().split()] chk=2 if a[-1]!=2: print(-1) exit() else: for i in range(n-1,0,-1): if a[i-1]>=a[i]*2: print(-1) exit() print(chk[2])
s674928730
p03464
u123756661
1573527849
Python
PyPy3 (2.4.0)
py
Runtime Error
231
63984
119
k=int(input()) a=[int(i) for i in input().split()] chk=2 if a[-1]!=2: print(-1) exit() else: print(chk[2])
s632918602
p03464
u123756661
1573498720
Python
PyPy3 (2.4.0)
py
Runtime Error
193
56304
313
k=int(input()) a=[int0(i) for i in input().split()] ans=0 chk=2 if a[-1]!=2: print(-1) exit() elif k==1 and a[0]==2: print(2,3) exit() for i in range(k-1,1,-1): if a[i]>=chk*2: print(-1) exit() if a[i]<chk: a[i]=(a[i]+chk)//a[i]*a[i] chk=a[i] print(a[0],(a[0]+a[1]*2)//a[0]*a[0]-1)
s077849789
p03464
u123756661
1573490189
Python
PyPy3 (2.4.0)
py
Runtime Error
220
63984
297
k=int(input()) a=[int(i) for i in input().split()] ans=0 chk=2 if a[-1]!=2: print(-1) exit() elif k==1 and a[0]==2: print(2,2) exit() for i in range(n-1,-1,-1): if a[i]>=chk*2: print(-1) exit() if a[i]<chk: a[i]=(a[i]+chk)//a[i]*a[i] chk=a[i] print(a[0],a[1]*2-1)
s618586709
p03464
u123756661
1573489998
Python
PyPy3 (2.4.0)
py
Runtime Error
214
63984
300
k=int(input()) a=[int(i) for i in input().split()] ans=0 chk=2 if a[-1]!=2: print(-1) exit() elif k==1 and a[0]==2: print(2,2) exit() for i in range(n-1,-1,-1): if a[i]>=chk*2: print(-1) exit() if a[i]<chk: a[i]=(a[i]+chk)//a[i]*a[i] chk=a[i] print(a[0],a[1]*2-1)
s174775988
p03464
u123756661
1573444956
Python
PyPy3 (2.4.0)
py
Runtime Error
211
63984
114
k=int(input()) a=[int(i) for i in input().split()] ans=0 chk=0 if a[-1]!=2: print(-1) else: print(ans[1])
s026989472
p03464
u983918956
1572156734
Python
Python (3.4.3)
py
Runtime Error
285
14556
641
K = int(input()) A = list(map(int,input().split()))[::-1] + [1] # 切り上げ def ceil(a, b): return -(-a//b) # [a, b) に含まれるcの倍数のうち最小,最大のものを返す def query(a, b, c): l = c * ceil(a, c) r = c * (ceil(b, c) - 1) if l <= r: return True, l, r else: return False, -1, -1 cand = [2,2] for i in ran...
s528752403
p03464
u983918956
1572155774
Python
Python (3.4.3)
py
Runtime Error
285
14428
685
K = int(input()) A = list(map(int,input().split()))[::-1] + [1] # 切り上げ def ceil(a, b): return -(-a//b) # [a, b) に含まれるcの倍数のうち最小,最大のものを返す def query(a, b, c): l = c * ceil(a, c) r = c * (ceil(b, c) - 1) if l <= r: return True, l, r else: return False, -1, -1 cand = [2,2] for i in ran...
s903763447
p03464
u009348313
1570119763
Python
PyPy3 (2.4.0)
py
Runtime Error
217
63984
292
K = int(input()) A = list(map(int,input().split())) for i in range(K-2,-1,-1): if A[i] >= A[i+1]*2: print(-1) exit() elif A[i] >= A[i+1]: maxn = A[i] minn = A[i] else: maxn = ((A[i+1]*2-1)//A[i])*A[i] minn = (A[i+1]//A[i]+1)*A[i] maxn += A[0]-1 print(minn,maxn)
s984588816
p03464
u677523557
1568664996
Python
Python (3.4.3)
py
Runtime Error
141
14224
342
K = int(input()) A = list(map(int, input().split())) M = 2 L = 2 ok = True for i in range(K-1, 0, -1): a, b = A[i], A[i-1] nM = (M//b)*b if M%b != 0: nM += b if nM >= M + a: ok = False break nL = (L+a-1)//b * b L, M = nL, nM if not ok: print(-1) else: L = L...
s708086011
p03464
u619819312
1566734824
Python
Python (3.4.3)
py
Runtime Error
2104
14224
326
k=int(input()) a=list(map(int,input().split())) l,r=1,10**18 def f(x,a): for i in a: x=max(0,x-x%i) return x while r-l>1: t=(l+r)//2 if f(t,a)>2: r=t else: l=t p,q=1,10**18 while q-p>1: t=(p+q)//2 if f(t,a)<=1: p=t else: q=t print(*(q,l) if q<=l el...
s977089700
p03464
u619819312
1566734610
Python
Python (3.4.3)
py
Runtime Error
1310
14224
319
k=int(input()) a=list(map(int,input().split())) l,r=1,10**18 def f(x,a): for i in a: x=x-x%i return x while r-l>1: t=(l+r)//2 if f(t,a)>2: r=t else: l=t p,q=1,10**18 while q-p>1: t=(p+q)//2 if f(t,a)<=1: p=t else: q=t print(*(q,l) if q<=l else -1)
s293180085
p03464
u619819312
1566734584
Python
PyPy3 (2.4.0)
py
Runtime Error
407
63984
319
k=int(input()) a=list(map(int,input().split())) l,r=1,10**18 def f(x,a): for i in a: x=x-x%i return x while r-l>1: t=(l+r)//2 if f(t,a)>2: r=t else: l=t p,q=1,10**18 while q-p>1: t=(p+q)//2 if f(t,a)<=1: p=t else: q=t print(*(q,l) if q<=l else -1)
s700672028
p03464
u608777907
1566061103
Python
Python (3.4.3)
py
Runtime Error
17
2940
433
def solve(A): current_max = 2 current_min = 2 for a_k in reversed(A): if current_max < a_k: print('-1') return current_max = (current_max // a_k) * a_k + (a_k - 1) current_min = ((current_min - 1) // a_k + 1) * a_k print(f"{current_min} {current_max}") ...
s066745497
p03464
u315485238
1556239343
Python
Python (3.4.3)
py
Runtime Error
325
14224
580
K = int(input()) A = list(map(int, input().split())) def winner_count(N, A=A): for a in A: N = a*(N//a) return N class lazy_eval_list(list): def __init__(self, func, a): super().__init__(a) self._func = func def __getitem__(self, key): return self._func(super()...
s995769711
p03464
u315485238
1556168341
Python
Python (3.4.3)
py
Runtime Error
319
14252
637
K = int(input()) A = list(map(int, input().split())) def winner_count(N, A=A): for a in A: N = a*(N//a) return N class lazy_eval_list(list): def __init__(self, func, a): super().__init__(a) self._func = func def __getitem__(self, key): return self._func(super()...
s843378456
p03464
u315485238
1556167961
Python
Python (3.4.3)
py
Runtime Error
321
14252
585
K = int(input()) A = list(map(int, input().split())) def winner_count(N, A=A): for a in A: N = a*(N//a) return N class lazy_eval_list(list): def __init__(self, func, a): super().__init__(a) self._func = func def __getitem__(self, key): return self._func(super()...
s808881924
p03464
u785989355
1553229750
Python
Python (3.4.3)
py
Runtime Error
44
14436
520
K=int(input()) A=list(map(int,input().split())) A=A[::-1] min_t_num=2 max_t_num=2 if A[0]==2: flg=True for i in range(1,K): prev_min=min_t_num prev_max=max_t_num min_t_num=(min_t_num//A[i]+1)*A[i] max_t_num=int(np.floor(max_t_num/A[i]))*A[i]+A[i]-1 if A[i-1]*(min_t_num...
s893768598
p03464
u631277801
1552474775
Python
Python (3.4.3)
py
Runtime Error
2104
14252
1582
import sys stdin = sys.stdin sys.setrecursionlimit(10**6) def li(): return map(int, stdin.readline().split()) def li_(): return map(lambda x: int(x)-1, stdin.readline().split()) def lf(): return map(float, stdin.readline().split()) def ls(): return stdin.readline().split() def ns(): return stdin.readline().rstrip(...
s233456052
p03464
u619631862
1546549335
Python
PyPy3 (2.4.0)
py
Runtime Error
234
63984
347
def i1(): return int(input()) def i2(): return [int(i) for i in input().split()] n=i1() a=i2() c=[] if a[0]>=a[1]: c.append(a[0]*2-1) c.append(a[0]) else: d=a[1]//a[0]+1 c.append(a[0]*d) c.append(a[0]*(d+1)-1) s=min(c) ss=0 for i in a: if s/i>=1: s=s-s%i else: ss=1 if ss==1: print(-1) els...
s917324230
p03464
u619631862
1546399549
Python
PyPy3 (2.4.0)
py
Runtime Error
232
63984
362
def i1(): return int(input()) def i2(): return [int(i) for i in input().split()] n=i1() a=i2() c=[] if a[0]>=a[1]: c.append(a[0]*2-1) c.append(a[0]) else: d=a[1]//a[0]+1 c.append(a[0]*d) d=(a[0]*d)//a[1]+1 c.append(a[1]*d) s=min(c) ss=0 for i in a: if s/i>=1: s=s-s%i else: ss=1 if ss==1: ...
s443633210
p03464
u619631862
1546398507
Python
PyPy3 (2.4.0)
py
Runtime Error
229
63984
350
def i1(): return int(input()) def i2(): return [int(i) for i in input().split()] n=i1() a=i2() c=[] if a[0]>=a[1]: c.append(a[0]*2-1) c.append(a[0]) else: d=a[1]//a[0]+1 c.append(a[0]*d) d=(a[0]*d)//a[1]+1 c.append(a[1]*d) s=0 for i in range(1,len(a))[::-1]: if a[i]*2<=a[i-1]: s=1 if s==1: print(...
s341574599
p03464
u810735437
1545354483
Python
Python (3.4.3)
py
Runtime Error
17
3060
720
# 後ろから順に考える # 最後のA_Kは必ず2である必要がある # A_Kの前には2~3人である必要がある # ... K = int(input()) As = list(map(int, input().split())) As.reverse() fail = False if As[0] != 2: fail = True else: mn = 2 mx = 3 for a in As[1:]: # 今 [mn, mx] = [4, 13], a = 3だとする # a人組をつくったあとにありうる数は3の倍数なので、ここでは6, 9, 12のみありうる ...
s389496168
p03464
u240793404
1543503008
Python
Python (3.4.3)
py
Runtime Error
65
15020
306
from math import ceil n=int(input()) l=list(map(int,input().split()))[::-1] a=l[0] ans=0 for i in range(1,len(l)): if 2*a<=l[i]: ans=-1 break a=l[i] if ans != -1: m= ceil(l[-2]/l[-1])*l[-1] M= (2*l[-2]-1)//l[-1]*l[-1]+l[-1]-1 print(str(m)+' '+str(M)) else: print(-1)
s863985715
p03464
u858136677
1539316992
Python
Python (3.4.3)
py
Runtime Error
236
14396
955
def minandmax(bottom,up,mod): #bottom< n < upなるmodで割り切れるnの値の最大値と最小値を返す if bottom%mod == 0: mnm = bottom else: mnm = bottom + (mod-bottom%mod) if mnm > up: mnm = None if up%mod == 0: mxm = up else: mxm = up - up%mod if mxm < bottom: ...
s750645862
p03464
u706937664
1530833352
Python
Python (2.7.6)
py
Runtime Error
11
2696
1757
f = open("data.txt", 'r') file = f.read() f.close() lines = file.split("\n") r = lines[1].split(" ") serach_flag = True old_mid = -1 min = 0 max = 10**9 mid = 0 low = -1 high = -1 while(serach_flag): mid = (min + max) / 2 val = mid for k in r: val = val - (val % int(k)) #print(min, mid, ...
s221906538
p03464
u671215535
1529085118
Python
Python (3.4.3)
py
Runtime Error
17
3064
608
res = 0 if A[N - 1] != 2: res = -1 else: N_possible = [2,3] i = N - 2 while i >= 0: #print(i,N_possible) N_new = [] for n in N_possible: if n % A[i] == 0: temp = n / A[i] x = 0 while x < A[i]: N_new.a...
s997444617
p03464
u589199964
1519278448
Python
Python (3.4.3)
py
Runtime Error
2124
442948
1214
def find_min_candidates(i, Ni): if i < 0: return Ni if Ni % A[i] != 0 or (i+1 in invalid_memo and Ni in invalid_memo[i+1]): return -1 for candidate in range(Ni, Ni+A[i]): res = find_min_candidates(i-1, candidate) if res > 0: return res else: if...
s689905919
p03464
u745997547
1517376150
Python
Python (3.4.3)
py
Runtime Error
130
14436
443
# K = int(input()) A = list(map(int, input().split())) # if A[-1]!=2: print(-1) exit() if A[-2]!=2 and A[-2]!=3: print(-1) exit() # min_n = 2 max_n = 3 for i in A[::-1][1:]: a = (min_n - 1)//i b = max_n//i if a==b: print(-1) exit() if min_n%i==0: pass else:...
s687570691
p03464
u057463552
1515995962
Python
Python (3.4.3)
py
Runtime Error
46
14400
471
import sys K = int(input()) A = [int(x) for x in input().split()] A.reverse() jmax, jmin = 2,2 if A[0] != 2: print(-1) sys.exit() for i in range(0,K-1): # 0<=i<=K-2 A[K-2]は2ラウンドの組.Kラウンドから2ラウンドまで Round = list(range(jmin,jmax+1)) if not(0 in Round % A[i]): print(-1) sys.exit() jmin ...
s165780116
p03464
u057463552
1515994420
Python
Python (3.4.3)
py
Runtime Error
48
14868
873
import sys K = int(input()) A = [int(x) for x in input().split()] A.reverse() jmax, jmin = 2,2 #print(A) for h in range(0,K): if A[h] <= A[h+1]: print(-1) sys.exit() if A[0] != 2: print(-1) sys.exit() for i in range(0,K-1): # 0<=i<=K-2 A[K-2]は2ラウンドの組.Kラウンドから2ラウンドまで drop_num = [] ...
s632299538
p03464
u590211278
1515989248
Python
Python (3.4.3)
py
Runtime Error
429
33716
890
import math k = int(input()) a = list(map(int,input().split(' '))) kouho = [] for i in range(k+1+1): kouho.append(set()) # kouhoは、ラウンドiに臨んだ人の数 kouho[k+1].add(2) # ラウンドi-1に参加した人数の候補は、 # kouho[i] +0,+1,,,,+ラウンドiのa -1。 # かつ、ラウンドi-2のa で割り切れること。 for i in range(k,1-1,-1): #各ラウンドへの参加候補数を上げる。 for x in kouho[i+1]...
s456142946
p03464
u688375653
1515989002
Python
Python (3.4.3)
py
Runtime Error
2104
14436
510
def prime_decomposition(n): i = 2 table = [] while i * i <= n: while n % i == 0: n /= i table.append(i) i += 1 if n > 1: table.append(n) return table input() test=input().split(" ") test=list(map(int, test)) suma=1 for i in test: suma *= i test1 = prime_decomposition(suma) test1 = l...
s824572726
p03464
u939702463
1515988997
Python
Python (3.4.3)
py
Runtime Error
42
14428
465
K = int(input()) A = list(map(int, input().split())) if A[K - 1] != 2: ans = -1 else: for i in reversed(range(K - 1)): if A[i] >= A[i + 1] * 2: ans = -1 break elif A[i] >= A[i + 1]: ans = A[i] elif A[i] < A[i + 1]: ans = A[i] * ((A[i + 1...
s001362137
p03464
u939702463
1515988743
Python
Python (3.4.3)
py
Runtime Error
107
14428
446
K = int(input()) A = list(map(int, input().split())) if A[K - 1] != 2: ans = -1 else: for i in reversed(range(K - 1)): if A[i] >= A[i + 1] * 2: ans = -1 break elif A[i] >= A[i + 1]: ans = A[i] elif A[i] < A[i + 1]: ans = A[i] * ((A[i + 1...
s623759462
p03464
u327248573
1515988291
Python
Python (3.4.3)
py
Runtime Error
2104
15020
579
# -- coding: utf-8 -- from math import ceil round_no = int(input()) args = list(map(int, input().split(' ')))[::-1] cand_min = 3 if args[0] == 2 and args[1] <= 3: for i in range(2, round_no): if args[i-1] <= args[i] <= 2 + 2 ** i: cand_min = args[i] elif args[i-1] > args[i]: ...
s877473822
p03464
u637175065
1515987918
Python
Python (3.4.3)
py
Runtime Error
162
16648
1229
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools sys.setrecursionlimit(10**7) inf = 10**20 eps = 1.0 / 10**15 mod = 10**9+7 def LI(): return [int(x) for x in sys.stdin.readline().split()] def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()] def LF()...
s468924396
p03464
u767873777
1515987903
Python
Python (3.4.3)
py
Runtime Error
665
25448
491
#! /usr/bin/env python # coding: utf-8 import numpy as np def slove(k, a): a = np.array(a, dtype=np.int64) if a[-1] > 3 or a[-2] > 3: return -1 diff = a[:-1] - (2*a[1:]) if (diff >= 0).any(): return -1 minNum = a[0] while (minNum < a.max()): minNum += minNum max...