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
s047478464
p03699
u444856278
1546487351
Python
Python (3.4.3)
py
Runtime Error
24
3572
1124
from sys import stderr, setrecursionlimit, exit from functools import reduce from operator import add setrecursionlimit(2147483647) def f(n=1, flag=False): res = [] for _ in range(n): line = [int(i) for i in input().split()] if flag or len(line) == 1: res.append(line[0]) ...
s803769313
p03699
u126823513
1546430301
Python
Python (3.4.3)
py
Runtime Error
18
2940
297
int_n = int(input()) ar_int_s = list() for i in range(int_n): ar_int_s.append(int(input())) minused = list() for i in range(int_n): if (sum(ar_int_s) - sum(minused)) % 10 != 0: break else: minused.append(sorted(ar_int_s)[i:i]) print(sum(ar_int_s) - sum(minused))
s266404702
p03699
u785578220
1545580967
Python
Python (3.4.3)
py
Runtime Error
17
3060
348
#C Bugged import numpy as np a = int(input()) k = [] k10 = [] s = 0 for j in range(a): i = int(input()) if i % 10 == 0: k10.append(i) s += i else: k.append(i) k.sort() c = np.array(k) l = c.sum() if l%10==0 and len(k) !=0: l = l - c[0] s = s + l elif:len(k) == 0 s = 0 ...
s904947225
p03699
u785578220
1545580900
Python
Python (3.4.3)
py
Runtime Error
17
3060
343
#C Bugged import numpy as np a = int(input()) k = [] k10 = [] s = 0 for j in range(a): i = int(input()) if i % 10 == 0: k10.append(i) s += i else: k.append(i) k.sort() c = np.array(k) l = c.sum() if l%10==0 and len(k) !=0: l = l - c[0] s = s + l elif:l == 0 s = 0 else:...
s039668902
p03699
u785578220
1545579614
Python
Python (3.4.3)
py
Runtime Error
155
12488
339
#C Bugged import numpy as np a = int(input()) k = [] k10 = [] s = 0 for j in range(a): i = int(input()) if i % 10 == 0: k10.append(i) ll = ll + i else: k.append(i) c = np.array(k) s += c.sum() if s%10==0 and len(k) !=0: s = s - k[0] s = s + ll elif s%10 ==0: s = 0 ...
s963223035
p03699
u576434377
1544153067
Python
Python (3.4.3)
py
Runtime Error
18
3192
530
def get_sum(n, index, s, slist): if index == n: if s % 10 == 0: s = 0 return s left = get_sum(n, index + 1, s + slist[index], slist) right = get_sum(n, index + 1, s, slist) return max(left, right) N = int(input()) sl = [] for n in range(N): sl.append(int(input())) sum ...
s916178529
p03699
u667458133
1543610712
Python
Python (3.4.3)
py
Runtime Error
18
2940
263
N = int(input()) s = [int(input()) for _ in range(N)] result = sum(s) if result % 10 == 0: while True: min_s = min(s) if min_s % 10 == 0: s.remove(min_s) else: result -= min_s break print(result)
s264911883
p03699
u513081876
1542671270
Python
Python (3.4.3)
py
Runtime Error
17
2940
212
n = int(input()) s = [int(input()) for i range(n)] summ = sum(s) ans = [0]*summ for i in range(n): ans[i] -= s[i] ans.sort(reverse = True) for i in ans: if i % 10 != 0: print(i) break else: print(0)
s135246795
p03699
u513081876
1542671184
Python
Python (3.4.3)
py
Runtime Error
19
2940
195
n = int(input()) s = [int(input()) for i range(n)] summ = sum(s) ans = [0]*summ for i in range(n): ans[i] -= a[i] ans.sort(reverse = True) for i in ans: if i % 10 != 0: print(i) break
s228594669
p03699
u513081876
1542671023
Python
Python (3.4.3)
py
Runtime Error
17
2940
111
n = int(input()) s = [int(input()) for i range(n)] summ = sum(s) ans = [0]*summ for i in range(n): ans[i] -=
s873087572
p03699
u791664126
1541214739
Python
Python (3.4.3)
py
Runtime Error
17
2940
128
n=int(input()) l=sorted([int(input()) for _ in range(n)]) s=sum(l) for i in l[::-1]: if i%10>0:k=s-i print(s if s%10>0 else k)
s043325118
p03699
u426108351
1541009124
Python
Python (3.4.3)
py
Runtime Error
786
11380
441
N = int(input()) s = [] for i in range(N): s.append(int(input())) stot = sum(s) #i個のうちいくつか使ってjにできるか dp = [[False for i in range(stot+101)] for j in range(N+1)] dp[0][0] = True for i in range(N): for j in range(stot): dp[i+1][j+s[i]] = dp[i][j] or dp[i+1][j+s[i]] dp[i+1][j] = dp[i][j] or dp[i+1][...
s804373644
p03699
u052332717
1540912588
Python
Python (3.4.3)
py
Runtime Error
17
2940
219
n = int(input()) li = [] for i in range(n): li.append(int(input())) li.sort() while True: if sum(li)%10 != 0: print(sum(li)) break else: li.pop(0)
s617261814
p03699
u513081876
1538016114
Python
Python (3.4.3)
py
Runtime Error
17
3060
287
s = [int(input()) for i in range(N)] s_shadow = [i for i in s if i % 10 != 0] ans = sum(s) if ans % 10 == 0: if len(s_shadow) == 0: ans = 0 else: ans = sum(s)-s_shadow[0] for i in s_shadow: ans = max(ans, anss-i) print(ans)
s391641427
p03699
u599547273
1533405756
Python
Python (3.4.3)
py
Runtime Error
17
3060
237
n = int(input()) a = [int(input()) for _ in range(n)] sum_a = sum(a) if sum_a % 10 == 0: can_nums = filter(lambda x: x%10 != 0, set(a)) if len(list(can_nums)) == 0: print(0) else: print(sum_a - min(can_nums)) else: print(sum_a)
s678105816
p03699
u597436499
1529432079
Python
Python (3.4.3)
py
Runtime Error
17
2940
672
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int sum = 0; int min = Integer.MAX_VALUE; for (int i = 0; i < N; i++) { int s = sc.nextInt(); sum += s; ...
s106323897
p03699
u591295155
1525661542
Python
Python (3.4.3)
py
Runtime Error
17
3060
150
N = int(input()) s = [int(input()) for _ in range(N)] s0 = sorted(s)[::-1] tot = sum(s) i = 0 while tot%10 == 0: tot -= s[i] i += 1 print(tot)
s415285774
p03699
u667024514
1522013491
Python
Python (3.4.3)
py
Runtime Error
17
2940
117
n = int(input()) li = [] for i in range(n):li.append(int(input()) if sum(li) % 10 == 0:print("0") else:print(sum(li))
s482415971
p03699
u390958150
1519693887
Python
Python (3.4.3)
py
Runtime Error
18
3060
181
n = int(input()) A = [int(input()) for i in range(n)] B = [] for a in A: if a % 10 != 0: B.append(a) ans = sum(A) if ans % 10 == 0: ans -= min(B) print(ans)
s017794127
p03699
u966000628
1510304385
Python
Python (2.7.6)
py
Runtime Error
12
2568
255
N=int(raw_input()) lis = [] for i in range(0,N): num = int(raw_input()) lis.append(num) get = sum(lis) if sum(lis) % 10 == 0: for j in range(0,N): lis.remove(min(lis)) if min(lis) % 10 != 0: print get - min(lis) else: print 0 else: print get
s629140728
p03699
u966000628
1510304314
Python
Python (2.7.6)
py
Runtime Error
10
2568
236
N=int(raw_input()) lis = [] for i in range(0,N): num = int(raw_input()) lis.append(num) get = sum(lis) if sum(lis) % 10 == 0: for j in range(0,N) lis.remove(min(lis)) if min(lis) % 10 != 0 print get - min(lis) else: print get
s475336228
p03699
u966000628
1510303814
Python
Python (2.7.6)
py
Runtime Error
11
2568
236
N=int(raw_input()) lis = [] for i in range(0,N): num = int(raw_input()) lis.append(num) if sum(lis) % 10 == 0: if min(lis) % 10 != 0: print sum(lis)-min(lis) else: print sum(lis)-min(lis.remove(min(lis))) else: print sum(lis)
s838735209
p03699
u966000628
1510303508
Python
Python (2.7.6)
py
Runtime Error
10
2568
148
N=int(raw_input()) lis = [] for i in range(0,N): lis.append(int(raw_input())) if sum(lis) % 0 == 0: print sum(lis)-min(lis) else: print sum(lis)
s267533721
p03699
u966000628
1510303260
Python
Python (2.7.6)
py
Runtime Error
10
2696
138
N=int(raw_input()) lis = [] for i in N: lis.append(int(raw_input())) if sum(lis) % 0 == 0: print sum(lis)-min(lis) else: print sum(lis)
s326316570
p03699
u943004959
1508880917
Python
Python (3.4.3)
py
Runtime Error
18
3064
489
def solve(): n = int(input()) s = [] for i in range(n): s.append(int(input())) s.sort() score = sum(s) i = 0 flag = True if not score % 10: if n == 1: flag = False while 1: if s[i] % 10: score -= s[i] break...
s465400206
p03699
u943004959
1508880674
Python
Python (3.4.3)
py
Runtime Error
18
3060
446
def solve(): n = int(input()) s = [] for i in range(n): s.append(int(input())) s.sort() score = sum(s) i = 0 flag = True if not score % 10: while 1: if s[i] % 10: score -= s[i] break i += 1 if i == n -...
s929448482
p03699
u813098295
1506196715
Python
Python (2.7.6)
py
Runtime Error
11
2568
265
N = int(raw_input()) s = [int(raw_input()) for _ in xrange(N)] s.sort() ans = sum(s) k = 0 for i in range(N): if S[i] % 10 != 0: k = S[i] break if ans % 10 == 0 and k == 0: print 0 elif ans % 10 != 0: print ans else: print ans-k
s378236715
p03699
u038052425
1504495358
Python
Python (3.4.3)
py
Runtime Error
22
3316
262
import sys N = int(input()) s = list() for i in range(N): s.append(int(input())) s.sort(reverse=True) point = sum(s) l = len(s) i = 0 while i <= l: if point % 10 != 0: print(point) sys.exit() point -= s.pop() i += 1 print("0")
s616951641
p03699
u762008592
1503600033
Python
Python (3.4.3)
py
Runtime Error
18
3060
182
N=int(input()) s_n=[int(input()) for i in range(N)] ans=sum(s_n) while ans%10==0: ans-=min(s_n) if ans%10==0: ans+=min(s_n) s_n.remove(min(s_n)) print(ans)
s788899025
p03699
u343437894
1499640112
Python
Python (3.4.3)
py
Runtime Error
17
3060
218
n = int(input()) s=[] for i in range(n): s.append(int(input())) if sum(s) % 10 != 0: print(sum(s)) elif filter(lambda x:x%10>0,s) == False: print(0) else: print(sum(s)-min(filter(lambda x:x%10>0,s)))
s541086048
p03699
u343437894
1499639863
Python
Python (3.4.3)
py
Runtime Error
17
2940
164
n = int(input()) s=[] for i in range(n): s.append(int(input())) if sum(s) % 10 != 0: print(sum(s)) else: print(sum(s)-min(filter(lambda x:x%10>0,s)))
s004258622
p03699
u343437894
1499639717
Python
Python (3.4.3)
py
Runtime Error
17
2940
163
n = int(input()) s=[] for i in range(n): s.append(int(input()) if sum(s) % 10 != 0: print(sum(s)) else: print(sum(s)-min(filter(lambda x:x%10>0,s)))
s733524897
p03699
u846552659
1498781561
Python
Python (3.4.3)
py
Runtime Error
17
2940
327
# -*- coding:utf-8 -*- import sys N = int(input()) s = sorted([ int(input()) for tmp in range(N) ]) total = sum(s) if total%10 != 0: print(total) else: for tmp in s: total -= tmp if total%10 != 0: print(total) sys.exit() else: pass print(0) [Shelli...
s303729365
p03699
u943460982
1498005987
Python
Python (3.4.3)
py
Runtime Error
18
3060
234
N = int(input()) s = [] for i in range(N): s.append(int(input())) if sum(s) % 10 != 0: print(sum(s)) else: for i in sorted(s): if i % 10 != 0: print(sum(s) - i) sys.exit() print(0)
s205192395
p03699
u240789102
1497472331
Python
Python (3.4.3)
py
Runtime Error
18
3064
399
import itertools DIM = int(input()) args = [int(input()) for a in range(DIM)] temp = list(map(lambda x:x%10, args)) if sum(temp) == 0: exit(0) i = DIM while(i>0): comb = list(itertools.combinations(args, i)) combMax = list(map(sum, comb)) for c in sorted(combMax, reverse=True): if c%10==0: ...
s978882377
p03699
u240789102
1497472307
Python
Python (3.4.3)
py
Runtime Error
18
3316
434
import itertools DIM = int(input()) args = [int(input()) for a in range(DIM)] temp = list(map(lambda x:x%10, args)) if sum(temp) == 0: exit(0) i = DIM while(i>0): comb = list(itertools.combinations(args, i)) combMax = list(map(sum, comb)) print(comb) print(combMax) for c in sorted(combMax, reve...
s549332122
p03699
u240789102
1497470383
Python
Python (3.4.3)
py
Runtime Error
18
3060
348
import itertools DIM = int(input()) args = [int(input()) for a in range(DIM)] i = DIM while(i>0): comb = list(itertools.combinations(args, DIM)) combMax = list(map(sum, comb)) for c in combMax.sort().reversed(): if c%10==0: continue else: print(c) exit() ...
s596561621
p03699
u503052349
1497280247
Python
Python (3.4.3)
py
Runtime Error
17
3064
535
import sys i=0 j=0 k=0 t=0 m=0 s=0 lists=[] lists2 =[] #数値の数を受け取る line = int(input()) #数値を受け取ってリストの作成 while i < line: a = int(input()) #print (a) lists.insert(i,a) i +=1 #数値の足し合わせ while j < line: s += lists[j] j +=1 #正しければ出力 if s%10 != 0: print(s) else: #10の倍数以外のリスト作成 while k < line: if...
s371309853
p03699
u503052349
1497280082
Python
Python (3.4.3)
py
Runtime Error
20
3064
535
import sys i=0 j=0 k=0 t=0 m=0 s=0 lists=[] lists2 =[] #数値の数を受け取る line = int(input()) #数値を受け取ってリストの作成 while i < line: a = int(input()) #print (a) lists.insert(i,a) i +=1 #数値の足し合わせ while j < line: s += lists[j] j +=1 #正しければ出力 if s%10 != 0: print(s) else: #10の倍数以外のリスト作成 while k < line: if...
s756924548
p03699
u145789675
1497059120
Python
Python (3.4.3)
py
Runtime Error
17
3064
280
#!/bin/usr/python n = input() s = [0 for i in range(100)] a = 0 for i in range(n): s[i] = input() a += s[i] flag = True if a % 10 == 0: s = sorted(s) for i in range(n): if s[-1*n + i] % 10 != 0: a -= s[-1*n + i] break if a % 10 == 0: a = 0 print(a)
s069390430
p03699
u918509774
1496635231
Python
PyPy2 (5.6.0)
py
Runtime Error
37
27884
169
N = int(input()) a = [int(input()) for i in range(N)] a.sort() ans = sum(a) for i in range (len(a)): if ans % 10 == 0 && a[i] % 10 != 0: ans = ans - a[i] print(ans)
s432087296
p03699
u069170167
1496544282
Python
Python (3.4.3)
py
Runtime Error
17
3064
205
N = int(input()) s = [int(input()) for i in range(N)] sums = sum(s) others = filter(lambda x: x% 10, s) if sums % 10: print(sums) elif list(others) != []: print(sums-min(others)) else: print(0)
s898188337
p03699
u069170167
1496544130
Python
Python (3.4.3)
py
Runtime Error
27
3060
193
N = int(input()) s = [int(input()) for i in range(N)] sums = sum(s) others = filter(lambda x: x% 10, s) if sums % 10: print(sums) elif others: print(sums-min(others)) else: print(0)
s099775161
p03699
u214380782
1496543952
Python
Python (2.7.6)
py
Runtime Error
11
2568
171
testSNs = [raw_input().split()] SCORE=int(0) for x in range(testSNs[0]): if not testSNs[x]%10 is 0: SCORE += testSNs[x] else: continue print(SCORE)
s333089100
p03699
u761320129
1496543924
Python
Python (2.7.6)
py
Runtime Error
11
2568
414
def solve(scores): sm = sum(scores) if(sm % 10 != 0): return sm heapq.heapify(scores) while scores: mn = heapq.heappop(scores) sm -= mn if(sm % 10 != 0) : return sm sm += mn else: return 0 N = input() S = [input() for i in range(N)] heapq.heapify(S) while S: arr = [i for i in S] ...
s847101252
p03699
u761320129
1496543170
Python
Python (2.7.6)
py
Runtime Error
11
2568
304
def solve(scores): sm = sum(scores) if(sm % 10 != 0): return sm heapq.heapify(scores) while scores: mn = heapq.heappop(scores) sm -= mn if(sm % 10 != 0) : return sm sm += mn else: return 0 N = input() S = [input() for i in range(N)] scores = S[:] print solve(scores)
s038006255
p03699
u190525112
1496542241
Python
Python (3.4.3)
py
Runtime Error
2104
3064
502
n = int(input()) score=[] totalscore=0 for i in range(n): score.append(int(input())) flag='' for i in range(n): flag=flag+'1' flagint=int(flag,2) flag=format(flagint,'b').zfill(3) maxtotal=0 while flagint>0: count=0 totalscore=0 for j in flag: if j=='1': totalscore += score[c...
s733003258
p03699
u330205771
1496541027
Python
Python (2.7.6)
py
Runtime Error
10
2692
631
N = int(raw_input()) s = [int(raw_input()) for _ in range(N)] flag = True for i in range(len(s)): if (s[i] % 10) != 0: flag = False break if flag: print(0) else: s.sort() s = s[::-1] Ncombination = 2**len(s) for c in range(Ncombination): SUM = 0 combination = fo...
s513560384
p03699
u330205771
1496540846
Python
Python (2.7.6)
py
Runtime Error
11
2568
649
N = int(raw_input()) s = [int(raw_input()) for _ in range(N)] flag = True for i in range(len(s)): if (s[i] % 10) != 0: flag = False break if flag: print(0) else: s.sort() s = s[::-1] Ncombination = 2**len(s) for c in range(Ncombination): SUM = 0 combination = fo...
s347637782
p03699
u330205771
1496540784
Python
Python (2.7.6)
py
Runtime Error
10
2692
629
N = int(raw_input()) s = [int(raw_input()) for _ in range(N)] flag = True for i in range(len(s)): if (s[i] % 10) != 0: flag = False break if flag: print(0) else: s.sort() s = s[::-1] Ncombination = 2**len(s) for c in range(Ncombination): SUM = 0 combination = fo...
s448429230
p03699
u019578976
1496540727
Python
Python (3.4.3)
py
Runtime Error
19
3060
274
a=sorted([int(input()) for _ in [0]*int(input())]) if sum(a) % 10 != 0: print(sum(a)) else: for i in range(len(a)): #リスト中の10の倍数でなく最小の数を探す if a[i] % 10 !=0: s1=i break a.pop(s1) print(sum(a))
s737435445
p03699
u075012704
1496540087
Python
Python (3.4.3)
py
Runtime Error
17
3060
319
N = int(input()) scores = [] cnt = 0 for i in range(N): scores.append(int(input())) scores.sort() gokei = sum(scores) while True: if gokei % 10 == 0: gokei -= scores[cnt] cnt += 1 if cnt > len(scores): print(0) break else: print(gokei) break
s761042714
p03699
u075012704
1496540011
Python
Python (3.4.3)
py
Runtime Error
17
3060
319
N = int(input()) scores = [] cnt = 0 for i in range(N): scores.append(int(input())) scores.sort() gokei = sum(scores) while True: if gokei % 10 == 0: gokei -= scores[cnt] cnt += 1 if cnt < len(scores): print(0) break else: print(gokei) break
s668175326
p03699
u762603420
1496539696
Python
Python (3.4.3)
py
Runtime Error
57
3064
475
N = int(input()) nums = [] max = 0 for i in range(0, N): nums.append(int(input())) mx = sum(nums) checker = [0 for i in range(0, mx)] now = 0 res = 0 for i in range(0, N): v = nums[i] for j in range(now - 1, -1, -1): if checker[j] == 1: idx = checker[j] + v if idx > res a...
s623009900
p03700
u038021590
1599102796
Python
PyPy3 (7.3.0)
py
Runtime Error
82
68784
460
import numpy as np N, A, B = map(int, input().split()) H = np.zeros(shape=N, dtype='int64') for _ in range(N): h = int(input()) H[_] = h def calc(num, a): a -= num * B a = (a - 1)//(A - B) + 1 if sum(a[a > 0]) <= num: return True else: return False start = 0 end = 10 ** 10 ...
s476698787
p03700
u074220993
1597979439
Python
Python (3.8.2)
py
Runtime Error
28
8912
695
#include<iostream> #include<vector> #include<algorithm> using namespace std; int main(){ long N, A, B; cin >> N >> A >> B; vector<long> h; for (int i=0; i<N; i++){ long input; cin >> input; h.push_back(input); } long ans = 0; vector<long> temp; while (h.siz...
s596035915
p03700
u285891772
1594346415
Python
Python (3.8.2)
py
Runtime Error
96
14888
1281
import sys, re from collections import deque, defaultdict, Counter from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, log from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby from operator import itemgetter...
s507760750
p03700
u285891772
1594344982
Python
Python (3.8.2)
py
Runtime Error
1342
19408
1282
import sys, re from collections import deque, defaultdict, Counter from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, log from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby from operator import itemgetter...
s599117426
p03700
u992910889
1593697790
Python
PyPy3 (7.3.0)
py
Runtime Error
111
78028
1356
import sys sys.setrecursionlimit(10 ** 5 + 10) def input(): return sys.stdin.readline().strip() def resolve(): # https://qiita.com/drken/items/97e37dd6143e33a64c8c#3-%E3%82%81%E3%81%90%E3%82%8B%E5%BC%8F%E4%BA%8C%E5%88%86%E6%8E%A2%E7%B4%A2%E3%81%AE%E3%81%95%E3%82%89%E3%81%AA%E3%82%8B%E5%88%A9%E7%82%B9 n,a...
s268958824
p03700
u644907318
1593433730
Python
PyPy3 (7.3.0)
py
Runtime Error
206
82412
291
N,A,B = map(int,input().split()) H = sorted([int(input()) for _ in range(N)]) d = A-B high = H[-1]//B low = 1 while high-low>1: mid = (high+low)//2 cnt = 0 for i in range(N): cnt += (H[i]-B*mid)//d if cnt<=K: high = mid else: low = mid print(high)
s179822697
p03700
u497952650
1593432935
Python
Python (3.8.2)
py
Runtime Error
363
32952
444
from numpy import ceil,array,sum def is_ok(m): tmp = h - m*B if not any(tmp): return True rem = [ceil(i/(A-B)) for i in tmp[tmp>0]] if rem > m: return False return True N,A,B = map(int,input().split()) h = array(list(int(input()) for _ in range(N))) s = sum(h) ##二分散策 r = ...
s919234499
p03700
u497952650
1593432221
Python
PyPy3 (7.3.0)
py
Runtime Error
95
74812
438
import numpy as np def is_ok(m): tmp = h - B*m if not any(tmp): return False rem = sum([np.ceil(i/(A-B)) for i in tmp]) if rem > m: return False return True N,A,B = map(int,input().split()) h = np.array(list(int(input()) for _ in range(N))) s = np.sum(h) ##二分散策 r = 10**10 ...
s003341577
p03700
u046158516
1591613157
Python
PyPy3 (2.4.0)
py
Runtime Error
169
38708
343
t1,t2=map(int,input().split()) a1,a2=map(int,input().split()) b1,b2=map(int,input().split()) n1=(b1-a1)*t1 n2=(b2-a2)*t2 if n1*n2>0 or abs(n1)>abs(n2): print(0) elif abs(n1)==abs(n2): print('infinity') else: c=abs(n1)//abs(n1+n2) while (c+1)*abs(n1+n2)<=abs(n1): c+=1 ans=2*c if abs(n1)%(abs(n1+n2))!=0: ...
s968986040
p03700
u989345508
1590845020
Python
Python (3.4.3)
py
Runtime Error
17
2940
773
import math n,a,b=map(int,input().split()) h=[int(input()) for i in range(n)] def explode(x): global n c=0 for i in range(n): if h[i]-x*b>0: c+=math.ceil((h[i]-x*b)/(a-b)) return c<=x #二分探索用のコード #(1)l,rは両端点でl<=r l,r=1,10**9 #(2)l=rもしくはl=r-1のときにbreak while l+1<r: #(3)その閉区間の中点(の...
s138357332
p03700
u989345508
1590844978
Python
Python (3.4.3)
py
Runtime Error
172
7068
777
import math n,a,b=map(int,input().split()) h=[int(input()) for i in range(n)] def explode(x): global n c=0 for i in range(n): if h[i]-x*b>0: c+=math.ceil((h[i]-x*b)/(a-b)) return c<=x #二分探索用のコード #(1)l,rは両端点でl<=r l,r=1,10**9 #(2)l=rもしくはl=r-1のときにbreak while l+1<r: #(3)その閉区間の中点(の...
s837007069
p03700
u989345508
1590844663
Python
Python (3.4.3)
py
Runtime Error
17
2940
487
l,r=1,10**9 #(2)l=rもしくはl=r-1のときにbreak while l+1<r: #(3)その閉区間の中点(の小数部分を切り捨てたもの) #オーバーフローを考慮すると以下の書き方になる k=l+(r-l)//2 #ここでは境目以上のxで真になるので、 #x=kで真の場合は大きい方の端点をkにし、x=kで偽の場合は小さい方の端点をkにする if explode(k): r=k else: l=k print(l if explode(l) else r)
s664733457
p03700
u189479417
1590537213
Python
PyPy3 (2.4.0)
py
Runtime Error
161
38256
416
import numpy as np N, A, B = map(int,input().split()) h = [] for _ in range(N): h.append(int(input())) def solve(n): H = np.array(h) H -= B * n cnt = 0 for i in H: cnt += max((i - 1) // (A - B) + 1, 0) return cnt <= n left = 0 right = 10 ** 9 while left + 1 < right: mid = (left ...
s734842512
p03700
u189479417
1590536632
Python
PyPy3 (2.4.0)
py
Runtime Error
183
38256
409
import numpy as np N, A, B = map(int,input().split()) h = [] for _ in range(N): h.append(int(input())) def solve(n): H = np.array(h) H -= B * n cnt = 0 for i in H: cnt += (i - 1) // (A - B) + 1 return cnt <= n left = 0 right = 10 ** 9 while left + 1 < right: mid = (left + right...
s024843120
p03700
u189479417
1590536581
Python
PyPy3 (2.4.0)
py
Runtime Error
186
38512
405
import numpy as np N, A, B = map(int,input().split()) h = [] for _ in range(N): h.append(int(input())) def solve(n): H = np.array(h) H -= B * n cnt = 0 for i in H: cnt += (i - 1) // (A - B) + 1 return cnt <= n left = 0 right = 10 ** 9 while left + 1 < right: mid = (left + right) /...
s503690954
p03700
u181801282
1587223013
Python
Python (3.4.3)
py
Runtime Error
17
2940
245
N,A,B=map(int,input().split()) H=[] for i in range(N): H.append(int(input())) ans=0 n=N while n>0: mi=0 for i in range(n): if H[i]>=0: H[i]-=B=i H[mi]-=(A-B) if H[mi]<H[i]: mi while n>0 and H[n-1]<=0: n-=1 ans+=1 print(ans)
s847370284
p03700
u698919163
1586535307
Python
Python (3.4.3)
py
Runtime Error
186
7028
684
N,A,B = map(int,input().split()) h = [0]*N for i in range(N): h[i] = int(input()) # x回で全モンスター倒せるかどうかをにぶちゃん(にぱー) import math def check(x): count = 0 for i in range(N): count += math.ceil(max(h[i] - B * x, 0) / (A - B)) if count <= x: return True else: return Fal...
s742570362
p03700
u395816772
1585935916
Python
Python (3.4.3)
py
Runtime Error
238
11024
312
n,a,b = map(int,input().split()) c = [] for i in range(n): s = int(input()) c.append(s) d = [0]*n for i in range(n): e = c[i]//b if c[i] % b != 0: e +=1 d[i] = e f = sum(c) ans = 0 num = 0 g = 0 while f > 0: g += e.count(num) f = f - (a-b) - b *(n-g) ans += 1 print(ans)
s089477789
p03700
u476604182
1584382471
Python
Python (3.4.3)
py
Runtime Error
19
3060
226
N, A, B , *h = map(int, open('0').read().split()) C = A-B l = -1 r = 10**12 while l+1<r: s = (l+r)//2 M = [c-s*B for c in h] cnt = sum((c+C-1)//C if c>0 else 0 for c in M) if cnt>s: l = s else: r = s print(r)
s706088736
p03700
u586759271
1583704307
Python
Python (3.4.3)
py
Runtime Error
1462
7024
478
n,a,b = map(int,input().split()) h =[0]*n for i in range(n): h[i]=int(input()) def hantei(now): ab=a-b nokori = sum(kiriage( max(0,hh-now*b) ,ab)//ab for hh in h) return nokori<=now def kiriage(x,c): if x%c==0: return x else: return (x//c+1) *c ma = 10**9//b +1 mi = 1 while mi<...
s940313132
p03700
u586759271
1583703217
Python
PyPy3 (2.4.0)
py
Runtime Error
648
52568
480
n,a,b = map(int,input().split()) h =[0]*n for i in range(n): h[i]=int(input()) def hantei(now): ab=a-b nokori = sum(kiriage( max(0,hh-now*b) ,ab)//(ab) for hh in h) return nokori<=now def kiriage(x,c): if x%c==0: return x else: return (x//c+1) *c ma = 10**9//b +1 mi = 1 while m...
s466237923
p03700
u994988729
1583068049
Python
Python (3.4.3)
py
Runtime Error
491
17128
435
import numpy as np N, A, B = map(int, input().split()) H = np.array([int(input()) for _ in range(N)], dtype=np.int64) def C(X): """ x回爆発して、全部消滅させれるとTrue """ HP = np.copy(H) HP -= B * X cnt = ((HP + A - B - 1) // (A - B)).sum() return cnt <= X l = -1 r = 10 ** 18 while r - l > 1: m =...
s126996711
p03700
u994988729
1583067854
Python
Python (3.4.3)
py
Runtime Error
391
17120
499
import sys import numpy as np input = sys.stdin.readline N, A, B = map(int, input().split()) H = [int(input()) for _ in range(N)] H = np.array(H, dtype=np.int64) def C(X): """ x回爆発して、全部消滅させれるとTrue """ HP = np.copy(H) HP -= B * X HP[HP <= 0] = 0 cnt = ((HP + A - B - 1) // (A - B)).sum() ...
s836192467
p03700
u994988729
1583067572
Python
Python (3.4.3)
py
Runtime Error
390
19040
498
import sys import numpy as np input = sys.stdin.readline N, A, B = map(int, input().split()) H = [int(input()) for _ in range(N)] H = np.array(H, dtype=np.int64) def C(X): """ x回爆発して、全部消滅させれるとTrue """ HP = np.copy(H) HP -= B * X HP[HP <= 0] = 0 cnt = ((HP + A - B - 1) // (A - B)).sum() ...
s613249870
p03700
u547167033
1582066600
Python
Python (3.4.3)
py
Runtime Error
19
2940
350
from math import ceil n,a,b=map(int,input().split()) h=[int(input()) for i in range(n)] def enough(x): cnt=0 for i in range(n): if h[i]-x*b<=0: continue: cnt+=ceil((h[i]-x*b)/(a-b)) if cnt<=x: return True else: return False l=0 r=10**9 while r-l>0: mid=(r+l)//2 if enough(mid): r=mi...
s325124805
p03700
u593590006
1571795169
Python
Python (3.4.3)
py
Runtime Error
1554
11816
1137
from math import ceil n,a,b=map(int,input().split()) l=[int(input()) for i in range(n)] def check(x): c=0 l1=[i-b*x for i in l] # print(l1) bc=x r=x for i in l1: if i<=0: continue else: c+=ceil(i/a) z=i//a z1=a-i%a ...
s417608627
p03700
u928784113
1568391250
Python
PyPy3 (2.4.0)
py
Runtime Error
2107
78328
1984
from collections import deque,defaultdict,Counter from itertools import accumulate import bisect from heapq import heappop,heappush from fractions import gcd from copy import deepcopy import math import queue #import numpy as np #import sympy as syp(素因数分解とか) Mod = 1000000007 def sieve_of_eratosthenes(n): if no...
s484553516
p03700
u155687575
1568329746
Python
Python (3.4.3)
py
Runtime Error
17
2940
602
### reference import numpy as np N, A, B = map(int, input().split()) h = [] for i in range(N): h.append(int(input())) H = np.array(h) ### n回以下の攻撃で、全滅させられるかどうか。 def test(n): x = H - n*B x[x<0] = 0     #np.ceilが結局追加攻撃しなければならないそれぞれのモンスターの攻撃階数 return np.ceil(x/(A-B)).sum() <= n ## left, right←攻撃階数 lef...
s618004278
p03700
u155687575
1568329233
Python
PyPy3 (2.4.0)
py
Runtime Error
175
38256
414
import numpy as np n, a, b = map(int, input().split()) hlist = np.array([int(input()) for _ in range(n)]) def kill(k): tmp = hlist - k*b tmp[tmp<0] = 0 if np.ceil(tmp/(a-b)).sum() <= n: return True else: return False left = 0 right = 10*9 while right - left > 1: mid = (right + left...
s936147261
p03700
u155687575
1568329131
Python
PyPy3 (2.4.0)
py
Runtime Error
182
38640
415
import numpy as np n, a, b = map(int, input().split()) hlist = np.array([int(input()) for _ in range(n)]) def kill(k): tmp = hlist - k*b tmp[tmp<0] = 0 if np.ceil(tmp//(a-b)).sum() <= n: return True else: return False left = 0 right = 10*9 while right - left > 1: mid = (right - lef...
s793910540
p03700
u798818115
1567475653
Python
PyPy3 (2.4.0)
py
Runtime Error
168
38640
261
# coding: utf-8 # Your code here! import numpy as np N,A,B=map(int,input().split()) l=[] for _ in range(N): l.append(int(input())) a=np.array(l) count=0 while np.amax(a)>0: a=a-B a[np.argmax(a)]=a[np.argmax(a)]-A+B count+=1 print(count)
s271258100
p03700
u798818115
1567475323
Python
PyPy3 (2.4.0)
py
Runtime Error
176
38256
261
# coding: utf-8 # Your code here! import numpy as np N,A,B=map(int,input().split()) l=[] for _ in range(N): l.append(int(input())) a=np.array(l) count=0 while np.amax(a)>0: a=a-B a[np.argmax(a)]=a[np.argmax(a)]-A+B count+=1 print(count)
s190805546
p03700
u374103100
1567181784
Python
PyPy3 (2.4.0)
py
Runtime Error
509
49368
827
# https://atcoder.jp/contests/abc063/tasks/arc075_b import sys import itertools from collections import Counter from collections import defaultdict from collections import deque import bisect from heapq import heappush, heappop import math sys.setrecursionlimit(12345678) def can_delete(ml, t, a, b): for i in rang...
s964257616
p03700
u374103100
1567181632
Python
PyPy3 (2.4.0)
py
Runtime Error
537
50392
827
# https://atcoder.jp/contests/abc063/tasks/arc075_b import sys import itertools from collections import Counter from collections import defaultdict from collections import deque import bisect from heapq import heappush, heappop import math sys.setrecursionlimit(12345678) def can_delete(ml, t, a, b): for i in rang...
s599055327
p03700
u091051505
1566748410
Python
Python (3.4.3)
py
Runtime Error
1738
11036
565
def calc(n): damage = (b * n) d = [max(dd - damage, 0) for dd in h] a_num = 0 for i in range(len(d)): a_num += max(0, 1 + (d[i]-1) // (a - b)) if a_num <= n: return True return False n, a, b = map(int, input().split()) h = [] for _ in range(n): h.append(int(input())) ans = 0...
s020319677
p03700
u091051505
1566748299
Python
Python (3.4.3)
py
Runtime Error
1766
11036
516
def calc(n): damage = (b * n) d = [max(dd - damage, 0) for dd in h] a_num = 0 for i in range(len(d)): a_num += max(0, 1 + (d[i]-1) // (a - b)) if a_num <= n: return True return False n, a, b = map(int, input().split()) h = [] for _ in range(n): h.append(int(input())) ans = 0...
s776961216
p03700
u091051505
1566748218
Python
Python (3.4.3)
py
Runtime Error
1739
11036
516
def calc(n): damage = (b * n) d = [max(dd - damage, 0) for dd in h] a_num = 0 for i in range(len(d)): a_num += max(0, 1 + (d[i]-1) // (a - b)) if a_num <= n: return True return False n, a, b = map(int, input().split()) h = [] for _ in range(n): h.append(int(input())) ans = 0...
s149823243
p03700
u091051505
1566747862
Python
Python (3.4.3)
py
Runtime Error
2104
15400
538
import copy def calc(n): d = copy.deepcopy(h) d = [dd - (b * n) for dd in d if (dd - (b*n)) > 0] a_num = sum([dd // (a - b) if (dd % (a - b) == 0) else (dd // (a - b)) + 1 for dd in d]) if a_num <= n: return True return False n, a, b = map(int, input().split()) h = [] for _ in range(n): ...
s543633239
p03700
u191829404
1564885912
Python
PyPy3 (2.4.0)
py
Runtime Error
179
38384
1636
import math import copy from operator import mul from functools import reduce from collections import defaultdict from collections import Counter from collections import deque # 直積 A={a, b, c}, B={d, e}:のとき,A×B={(a,d),(a,e),(b,d),(b,e),(c,d),(c,e)}: product(A, B) from itertools import product # 階乗 P!: permutations(seq)...
s212199220
p03700
u123756661
1561172901
Python
PyPy3 (2.4.0)
py
Runtime Error
2107
59224
330
import heapq #n=int(input()) n,a,b=map(int,input().split()) ans=chk=0 d=[] for i in range(n): x=int(input()) heapq.heappush(d,-x) c=a-b while 1: #for i in range(5): t=heapq.heappop(d) if t+chk>=0: break ans+=1 p=(abs(t-d[0])+c-1)//c p=max(1,p) t+=c*p chk+=b*p heapq.heappush(d,t) ...
s376194615
p03700
u367130284
1559875238
Python
Python (3.4.3)
py
Runtime Error
48
14860
486
from copy import deepcopy def main(): n,a,b,*h=map(int,open(0).read().split()) h=array(h) ok=-1 ng=max(h)//a+10 def judge(t): H=deepcopy(h) H-=b*t H=H[H>0] if sum((H-1)//(a-b)+1)<=t: return 1 else: return 0 while abs(ok-n...
s687081253
p03700
u623819879
1555956314
Python
PyPy3 (2.4.0)
py
Runtime Error
165
38256
376
# coding: utf-8 # Your code here! n,a,b=map(int,input().split()) h=[] for i in range(n): x=int(input()) h.append(x) def check(t): c=0 for i in range(n): c+=1+(max(0,h[i]-b*t)-1)//(a-b) return t>=c l=1 r=1+max(h)//b while r-l>1: mid=(r-l)//2+l if check(mid): r=mid else: ...
s430809703
p03700
u512007680
1555352754
Python
Python (3.4.3)
py
Runtime Error
17
3064
615
def roof(x): if x == int(x): return x else: return int(x)+1 def ans(n,a,b,h): m = max(h) M = roof(m / b) x = M y = 0 if x == 1: return x while x - y > 1: half = int((x+y)/2) s_half = 0 for i in range(0,n): ...
s986999606
p03700
u664762434
1544031479
Python
Python (2.7.6)
py
Runtime Error
2104
8964
248
N,A,B = map(int,raw_input().split()) a = [] x = 0 C = A-B for i in range(N): a.append(int(raw_input())) a.sort() n = 0 while a[0]>0: if a[0]>=a[1]: a[0]-=C map(lambda x: x-B,a) n += 1 else: a[1]-=C map(lambda x: x-B,a) n += 1 print n
s585381339
p03700
u664762434
1544030958
Python
Python (2.7.6)
py
Runtime Error
12
2692
247
N,A,B = map(int,raw_input().split()) a = [] x = 0 C = A-B for i in range(N): a.append(int(raw_input()) a.sort() n = 0 while a[0]>0: if a[0]>=a[1]: a[0]-=C map(lambda x: x-B,a) n += 1 else: a[1]-=C map(lambda x: x-B,a) n += 1 print n
s156253236
p03700
u272557899
1543976278
Python
Python (3.4.3)
py
Runtime Error
2105
14264
825
import math n, a, b = map(int, input().split()) d = [] for i in range(n): d.append(input()) # [d1, d2, d3, ..., dN] h = [int(m) for m in d]#int型に直す #print(x) low = 0 high = math.ceil(max(h)/b) # t は中央番目の数 t = (low + high) // 2 # 探索の下限のlowが上限のhighになるまで探索 # lowがhighに達すると数は見つからなかっTrueたということ X = 0 Y = 0 def cri(p): ...