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
s800672817
p03471
u089869622
1515382895
Python
Python (3.4.3)
py
Runtime Error
18
3060
376
def solve(n, y): for man in range(0, n + 1): for gosen in range(0, n - man + 1): sen = n - man - gosen if 10000*man + gosen*5000 + sen*1000 == y and man + gosen + sen == n: print(man, gosen, sen) return 0 print("-1 -1 -1") return 0 ...
s362724820
p03471
u541091793
1515382790
Python
Python (3.4.3)
py
Runtime Error
17
3060
465
n,yen = map(int,input().split()) man = n gosen = 0 sen = 0 def calc(man, gosen, sen): return 10000 * man + 5000 * gosen + 1000 * sen for x in range(7): if calc(man, gosen, sen) > yen: man -= 1 gosen += 1 else: for x in range(7): if calc(man, gosen, sen) == yen...
s885026727
p03471
u089869622
1515382773
Python
Python (3.4.3)
py
Runtime Error
18
3060
372
def solve(n, y): for man in range(0, n + 1): for gosen in range(0, n - man + 1): sen = n - man - gosen if 10000*man + gosen*5000 + sen*1000 == y and man + gosen + sen == n: print(man, gosen, sen) return 0 print("-1 -1 -1") return 0 ...
s796250965
p03471
u188106427
1515382322
Python
Python (3.4.3)
py
Runtime Error
2103
3964
605
def search(value, ten, five, one, num): global ans if ans or value < 0: return if value == 0 and (ten+five+one) == num: ans = (ten, five, one) elif value >= 10: search(value-10, ten+1,five,one, num) elif value >= 5: search(value-5, ten, five+1, one, num) sear...
s892565980
p03471
u188106427
1515382274
Python
Python (3.4.3)
py
Runtime Error
2104
3968
601
def search(value, ten, five, one, num): global ans if ans or value < 0: return if value == 0 and (ten+five+one) == num: ans = (ten, five, one) elif value >= 10: search(value-10, ten+1,five,one, num) elif value >= 5: search(value-5, ten, five+1, one, num) sear...
s879224844
p03471
u207363774
1515382245
Python
Python (3.4.3)
py
Runtime Error
18
2940
514
N,Q = (map(int,input().split())) for a in range(N,-1,-1): A = a*10000 if A > Q: continue if (a==N)and(A == Q): print("{0} 0 0".format(a)) exit() for b in range(N-a,-1,-1): B = A+b*5000 if B > Q: continue if (a+b=N)and(B == Q): print...
s701093257
p03471
u688375653
1515381378
Python
Python (3.4.3)
py
Runtime Error
17
3064
451
s=raw_input() s=s.split(' ') maisuu = int(s[0]) maney = int(s[1]) minn_man = int(maney/10000)+1 minn_sen = int(maney / 1000 )+1 minn_go = int(maney / 5000) +1 flg=True for man in range(0,minn_man): for go in range(0,minn_go): for sen in range(0,minn_sen): if man+go+sen == maisuu: if man*10000+ go*5000 + s...
s797838942
p03471
u688375653
1515380945
Python
Python (3.4.3)
py
Runtime Error
2103
3064
413
s=input() s=s.split(' ') maisuu = int(s[0]) maney = int(s[1]) minn_man = int(maney/10000)+1 minn_sen = int(maney / 1000 )+1 minn_go = int(maney / 5000) +1 for man in range(0,minn_man): for go in range(0,minn_go): for sen in range(0,minn_sen): if man+go+sen == maisuu: if man*10000+ go*5000 + sen*1000 == ma...
s856662555
p03471
u807561481
1515380888
Python
PyPy3 (2.4.0)
py
Runtime Error
308
50288
445
N, Y = [int(k) for k in input().split(' ') if k] Y //= 1000 x = Y // 10 Y -= x * 10 y = Y // 5 Y -= y * 5 z = Y if N < x + y + z: print(-1, -1, -1) exit() checked = [] def find(nx, ny, nz): if nx + ny + nz > N: return if find(nx, ny, nz): return if nx + ny + nz == N: print(nx, ny, nz) exit() if nx > 0: ...
s270160631
p03471
u756988562
1515380879
Python
Python (3.4.3)
py
Runtime Error
18
3064
773
import sys N,Y = map(int,input().split(" ")) man_max = Y//10000 go_max = Y // 5000 sen_max = Y // 1000 if man_max > N: man_max = N if go_max > N: go_max = N if sen_max > N: sen_max = N if Y%10000 == 0 and Y//10000 ==N: print(str(N) + " " +"0 0") sys.exit() if Y%5000 == 0 and Y//5000 ==N: ...
s452723032
p03471
u807561481
1515380862
Python
PyPy3 (2.4.0)
py
Runtime Error
183
38384
541
N, Y = [int(k) for k in input().split(' ') if k] Y //= 1000 x = Y // 10 Y -= x * 10 y = Y // 5 Y -= y * 5 z = Y if N < x + y + z: print(-1, -1, -1) exit() checked = [] def find(a, b, c): left = 0 right = len(checked) - 1 while left != right: if checked[left] def find(nx, ny, nz): if nx + ny + nz > N: return ...
s307851453
p03471
u688375653
1515380578
Python
Python (3.4.3)
py
Runtime Error
17
3064
465
s=input() s=s.split(' ') maisuu = int(s[0]) maney = int(s[1]) minn_man = int(maney/10000) if min_maisuu <= maisuu <= maney/1000: minn_go = maney / 5000 +1 minn_sen = maney / 1000 +1 minn_man += 1 for man in range(0,minn_man): for go in range(0,minn_go): for sen in range(0,minn_sen): if man+go+sen == m...
s466687125
p03471
u688375653
1515380416
Python
Python (3.4.3)
py
Runtime Error
18
3064
583
s=input() s=s.split(' ') maisuu = int(s[0]) maney = int(s[1]) minn_man = int(maney/10000) minn_go = int((maney%10000)/5000) minn_sen = int((maney%5000)/1000) flg = True min_maisuu = minn_man+minn_go+minn_sen if min_maisuu <= maisuu <= maney/1000: minn_go = maney / 5000 +1 minn_sen = maney / 1000 +1 minn_man += 1...
s222720284
p03471
u704521025
1515380252
Python
Python (2.7.6)
py
Runtime Error
10
2568
338
N = input('>> ') Y = input('>> ') x = y = z = 0 z = N while(1): if 10000*x+5000*y+1000*z == Y: print x,y,z break else: if z > 0: y += 1 z -= 1 elif y > 0: x += 1 y = 0 z = N - x else: print -1, -1, -1...
s426241598
p03471
u789417951
1515380120
Python
Python (3.4.3)
py
Runtime Error
18
2940
272
N, Y=map(int,input().split()) flag=False for i in range(0,N+1): for j in range(0, N+1): if Y==10000*(N-i-j)+5000*i+1000*j and i+j=<N: flag=True print(N-i-j, i, j) break if flag: break else: print('-1 -1 -1')
s348179343
p03471
u089869622
1515379767
Python
Python (3.4.3)
py
Runtime Error
17
2940
295
n = int(input()) y = int(input()) for man in range(0, 2000): for gosen in range(0, 4000): for sen in range(0, 20000): if 10000*man + gosen*5000 + sen*1000 == y and man + gosen + sen == n: print(man, gosen, sen) exit() print("-1 -1 -1")
s656624573
p03471
u939702463
1515379750
Python
Python (3.4.3)
py
Runtime Error
17
3064
420
n, y = map(int, input().split()) a = y // 10000 b = (y - a * 10000) // 5000 c = (y - a * 10000 - b * 5000) // 1000 n = a + b + c while ans != y: if y - ans >= 9000: tmp = (y - ans) // 9000 a += tmp c -= tmp elif y - ans >= 4000: tmp = (y - ans) // 4000 b += tmp ...
s806894205
p03471
u451017206
1515378931
Python
Python (3.4.3)
py
Runtime Error
806
3060
247
n,y = map(int, input().split()) for i in range(min(n+1,y//10000+1)): for j in range(min(n-i+1,y/1000+1)): c = n-i-j if c >= 0 and 10000 * i + 5000 * j + 1000 * c == y: print(i,j,c) exit() print(-1,-1,-1)
s532064143
p03471
u198274496
1515378918
Python
Python (3.4.3)
py
Runtime Error
18
3064
575
# -*- coding: utf-8 -*- from sympy import * x, y, z = symbols('x y z') N, price = list(map(int, input().split())) if N * 10000 < price or N * 1000 > price: li = map(str, [-1] * 3) else: temp = 10000 * N x, y = 0, 0 for i in range(N): if x < 0: break; if temp == price: ...
s633995938
p03471
u314057689
1515378796
Python
PyPy3 (2.4.0)
py
Runtime Error
168
38640
879
# input N, Y = map(int, input().split()) def solve(): y = Y//1000 if Y%1000 != 0: print('-1 -1 -1') return dp = DP(N, y+1, False) dp[0][1] = [1,0,0] dp[0][5] = [0,1,0] dp[0][10] = [0,0,1] for n in range(N-1): for m in range(y): if m+1 <= y and dp[n][m]:...
s424740502
p03471
u794543767
1515378304
Python
Python (3.4.3)
py
Runtime Error
19
3064
345
INPUT= input() n, y = INPUT.strip().split(" ") n = int(n) y = int(y) for i in range(n+2): for j in range(i+1,n+2): if flag == 1: break if y ==10000 *i + 5000* (j-i-1) + 1000 * (n-j+1): print("{} {} {}".format(i, j-i-1, n-j+1)) flag = 1 break if flag ==...
s488885143
p03471
u948374595
1515377462
Python
Python (3.4.3)
py
Runtime Error
1306
3316
234
import sys n, y = map(int, input().split()) for i in reversed(range(y//10000+1)): for j in reversed(range((y-i*10000)//5000+1)): if i*10000+j*5000+(n-i-j)*1000 == y: print(i, j, n-i-j) sys.exit(1) print('-1 -1 -1')
s799240706
p03472
u694665829
1600491050
Python
Python (3.8.2)
py
Runtime Error
216
12848
337
N,H=map(int,input().split()) B=[] A=0 for _ in range(N): a,b = map(int,input().split()) A = max(A,a) B.append(b) B = sorted(reverse=True) + [0] i = 0 while B[i] >= A: i += 1 B = B[:i] ans = 0 for i in range(len(B)): H -= B[i] ans += 1 if H <= 0: print(ans) exit() print(ans ...
s374356064
p03472
u074220993
1600489903
Python
Python (3.8.2)
py
Runtime Error
2206
32056
519
from bisect import bisect_left as bsl def main(): with open(0) as f: N, H = map(int, f.readline().split()) ab = list(map(int, f.read().split())) max_slash = max(ab[0::2]) throw = [x for x in ab[1::2] if x > max_slash] throw.sort(reverse=True) throw = [sum(throw[0:i]) for i in range(...
s824846871
p03472
u465101448
1599780275
Python
PyPy3 (7.3.0)
py
Runtime Error
90
74568
543
import math N,H = list(map(int,input().split())) A=[] B=[] for n in range(N): a,b = list(map(int,input_[1+n].split())) A.append(a) B.append(b) A.sort(reverse=True) B.sort(reverse=True) A,B a_max=A[0] B_=[] for b in B: if b < a_max: break B_.append(b) B=B_ B_sum = [0] for b in B: ...
s855772517
p03472
u752774573
1599405990
Python
PyPy3 (7.3.0)
py
Runtime Error
222
79172
307
N, H = list(map(int, input().split())) A = [0]*N B = [0]*N for i in range(N): a, b = list(map(int, input().split())) A[i], B[i] = a, b a = max(A) T = 0 ct = 0 B.sort(reversed=True) for b in B: if b > a: ct += 1 T += b if T >= H: break print(ct + max((H-T+a-1)//a, 0))
s179082311
p03472
u917872021
1599178833
Python
Python (3.8.2)
py
Runtime Error
282
17192
678
n, h = list(map(int, input().split())) cut = 0 throw = [] for i in range(n): a, b = list(map(int, input().split())) cut = max(cut, a) throw.append(b) throw.sort(reverse=True) throw_cam = [] for i in range(n): if cut >= throw[i]: break if i == 0: throw_cam.append(throw[0]) else:...
s158505812
p03472
u074220993
1598850600
Python
Python (3.8.2)
py
Runtime Error
214
14476
540
N, H = map(int, input().split()) slash = 0 Throw = [] for _ in range(N): a, b = map(int, input().split()) slash = max(slash, a) if b > a: Throw.append(b) #slash=斬撃最大ダメージ、投げてslash超のダメージが出るならばその刀をダメージが大きい順に投げる Throw = sorted([th for th in Throw if th > slash], reversed=True) dmg, cnt = 0, 0 for throw in T...
s723566247
p03472
u350093546
1598545751
Python
PyPy3 (7.3.0)
py
Runtime Error
222
87944
266
from math import ceil n,h=map(int,input().split()) a=[] b=[] ans=0 for i in range(n): aa,bb=map(int,input().split()) a.append(aa) b.append(bb) b.sort() pin=max(a) while True: p=b.pop() if p<pin: break ans+=1 h-=p ans+=ceil(h/pin) print(ans)
s538171422
p03472
u350093546
1598543907
Python
PyPy3 (7.3.0)
py
Runtime Error
316
104456
608
from math import ceil n,h=map(int,input().split()) a=[] b=[] lst=[] ans=0 for i in range(n): aa,bb=map(int,input().split()) a.append(aa) b.append(bb) lst.append([aa,bb]) lst.sort(key=lambda x:max(x[0],x[1])) guilty=sum(b) app=max(a) ans+=ceil((h-guilty)/app) h-=ans*app cnt=0 for i in b: if i<app: ...
s352399540
p03472
u156815136
1598362516
Python
Python (3.8.2)
py
Runtime Error
160
19000
1489
#from statistics import median #import collections #aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0] from fractions import gcd from itertools import combinations,permutations,accumulate, product # (string,3) 3回 #from collections import deque from collections import deque,defaultdict,Cou...
s359965169
p03472
u222668979
1597893296
Python
PyPy3 (7.3.0)
py
Runtime Error
221
87192
336
n, h = map(int, input().split()) a, b = [], [] for _ in range(n): ai, bi = map(int, input().split()) a.append(ai), b.append(bi) a.sort(), b.sort() ans, amax = 0, a[-1] for bi in b[::-1]: if bi <= amax or h <= 0: mod = (h + amax - 1) // amax break h -= bi ans += 1 print(ans + mod if ...
s357349571
p03472
u597455618
1597455462
Python
Python (3.8.2)
py
Runtime Error
362
35836
327
import sys n, h = map(int, input().split()) a = [list(map(int, x.split())) for x in sys.stdin.readlines()] a.sort(reverse=True) b = sorted(a, key=lambda x:x[1], reverse=True) cnt = 0 for i in b: if i[1] < a[0][0]: break cnt += 1 h -= i[1] if h <= 0: print(cnt) print(min(cnt + -(-h//a[0]...
s948971007
p03472
u309141201
1597283346
Python
Python (3.8.2)
py
Runtime Error
239
16916
392
n, H = map(int, input().split()) a = [] b = [] for i in range(n): ai, bi = map(int, input().split()) a.append(ai) b.append(bi) ans = 0 amax = max(a) b.sort(reverse=True) # print(amax, b) i = 0 while H > 0: if amax < b[i]: H -= b[i] ans += 1 i += 1 else: ans += H//ama...
s134464936
p03472
u786020649
1597027103
Python
Python (3.8.2)
py
Runtime Error
93
32288
305
import sys read=sys.stdin.read def main(): n,h,*ab=map(int,read().split()) tops=max(ab[0::2]) tlst=[b for b in ab[1::2] if b>tops] tlst.sort(reverse=True) for i,t in enumerate(tlst): h-=t if h<=0: h=0 break print(h//tops+(h%tops>0)+i+1) if __name__=='__main__': main()
s713979738
p03472
u786020649
1597026873
Python
Python (3.8.2)
py
Runtime Error
109
32044
305
import sys read=sys.stdin.read def main(): n,h,*ab=map(int,read().split()) tops=max(ab[0::2]) tlst=[b for b in ab[1::2] if b>tops] tlst.sort(reverse=True) for i,t in enumerate(tlst): h-=t if h<=0: h=0 return print(h//tops+(h%tops>0)+i+1) if __name__=='__main__': main()
s981405497
p03472
u786020649
1597026621
Python
Python (3.8.2)
py
Runtime Error
95
32196
292
import sys read=sys.stdin.read def main(): n,h,*ab=map(int,read().split()) sord=max(ab[0::2]) tlst=[b for b in ab[1::2] if b>sord] tlst.sort() for i,t in enumerate(tlst): h-=t if h<=0: h=0 break print(h//sord+(h%sord>0)+i+1) if __name__=='__main__': main()
s215708363
p03472
u893836806
1596584110
Python
Python (3.8.2)
py
Runtime Error
2206
32576
510
N,HP,*list1=open(0).read().split() N=int(N) HP=int(HP) list1=[int(i) for i in list1] #print(list1) aaa=[] bbb=[] for i,n in enumerate(list1,1): if i%2 == 1: aaa.append(n) else: bbb.append(n) #print(aaa) #print(bbb) int1=0 while (HP>0): if max(bbb) > max(aaa): HP = HP - ma...
s007130059
p03472
u869790980
1596513726
Python
PyPy2 (7.3.0)
py
Runtime Error
348
96256
360
n,h = map(int ,raw_input().split()) ais = [map(int, raw_input().split()) for _ in range(n)] mem = {} def dfs(i, ais, h): if i == len(ais) or h <= 0: return 0 if h <= 0 else +float('inf') if (i,h) not in mem: mem[(i,h)] = min(dfs(i+1, ais, h - ais[i][1]) + 1, dfs(i, ais, h - ais[i][0]) + 1, dfs(i+1, ais, h),) ...
s112431758
p03472
u102445737
1596340403
Python
PyPy3 (7.3.0)
py
Runtime Error
218
84064
664
#from collections import deque,defaultdict printn = lambda x: print(x,end='') inn = lambda : int(input()) inl = lambda: list(map(int, input().split())) inm = lambda: map(int, input().split()) ins = lambda : input().strip() DBG = True # and False BIG = 10**18 R = 10**9 + 7 #R = 998244353 def ddprint(x): if D...
s277086872
p03472
u591503175
1596214784
Python
Python (3.8.2)
py
Runtime Error
215
25536
802
def resolve(): ''' code here ''' N, H = [int(item) for item in input().split()] ab = [[int(item) for item in input().split()] for _ in range(N)] a_max = max(ab, key=lambda x:x[0]) res = H // a_max if H % a_max != 0: res += 1 temp_attack = res * a_max b_delta = [b - ...
s998263738
p03472
u612975321
1595422284
Python
PyPy3 (7.3.0)
py
Runtime Error
2208
83144
392
n, h = map(int,input().split()) a = [] b = [] for i in range(n): ca, cb = map(int,input().split()) a.append(ca) b.append(cb) a.sort(reverse=True) b.sort(reverse=True) cnt = 0 while h > 0: if b[0] > a[0]: h -= b.pop(0) cnt += 1 else: cnt += h//a[0] h -= a[0] * h//a[0]...
s118337185
p03472
u502731482
1594953131
Python
Python (3.8.2)
py
Runtime Error
1179
34892
435
from math import ceil n, h = map(int, input().split()) data1, data2 = [], [] for i in range(n): a, b = map(int, input().split()) data1.append([a, b]) data2.append([a, b]) data1 = sorted(data1, key = lambda x: x[0], reverse = True) data2 = sorted(data2, key = lambda x: x[1], reverse = True) ans = 0 while da...
s251863602
p03472
u871841829
1594772858
Python
Python (3.8.2)
py
Runtime Error
229
17908
667
N, H = map(int, input().split()) # B = [] A = [] B = [] amax = -1 bmax = -1 for _ in range(N): a, b = map(int, input().split()) # B.append((a,b)) A.append(a) B.append(b) if amax < a: amax = a if bmax < b: bmax = b if amax >= bmax: m = H % amax if m != 0: a...
s588883231
p03472
u285891772
1593652370
Python
Python (3.8.2)
py
Runtime Error
193
36284
1139
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, gcd from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby from operator import itemgetter...
s428519842
p03472
u285891772
1593652010
Python
Python (3.8.2)
py
Runtime Error
198
36384
1152
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, gcd from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby from operator import itemgetter...
s856986435
p03472
u626881915
1593394761
Python
PyPy3 (7.3.0)
py
Runtime Error
109
68748
311
n, h = map(int, input().split()) l = [] for i in range(n): l.append(list(map(int,input().spplit()))) l = sorted(l, reverse=True) c = 0 for i in range(1, n): if l[i][1] > l[0][0]: h -= l[i][1] c += 1 if h <= 0: print(c) exit() while h > l[0][1]: h -= l[0][0] c += 1 print(c+1)
s853186842
p03472
u652656291
1593048018
Python
Python (3.8.2)
py
Runtime Error
24
9108
336
N,H = map(int,input().split()) AB = [list(map(int,input().split())) for _ in range(n)] A,B = zip(*AB) a = max(A) B = [b for b in B if b > a] #投げる B.sort(reverse = True) answer = 0 hp = H attack_cnt = 0 for b in B: if hp <= 0: break attack_cnt += 1 hp -= b if hp > 0: attack_cnt += (hp-1)//a + 1 print(at...
s700503563
p03472
u652656291
1593047909
Python
Python (3.8.2)
py
Runtime Error
27
9048
328
N,H = map(int,input().split()) AB = [[int(input().split())] for _ in range(N)] A,B = zip(*AB) a = max(A) B = [b for b in B if b > a] #投げる B.sort(reverse = True) answer = 0 hp = H attack_cnt = 0 for b in B: if hp <= 0: break attack_cnt += 1 hp -= b if hp > 0: attack_cnt += (hp-1)//a + 1 print(attack_cnt...
s692849633
p03472
u652656291
1593047837
Python
Python (3.8.2)
py
Runtime Error
447
67516
332
N,H = map(int,input().split()) AB = [[map(int,input().split())] for _ in range(N)] A,B = zip(*AB) a = max(A) B = [b for b in B if b > a] #投げる B.sort(reverse = True) answer = 0 hp = H attack_cnt = 0 for b in B: if hp <= 0: break attack_cnt += 1 hp -= b if hp > 0: attack_cnt += (hp-1)//a + 1 print(attack...
s848390827
p03472
u687574784
1592728836
Python
Python (3.8.2)
py
Runtime Error
252
17464
493
N,H = list(map(int, input().split())) A=0 B=[] for _ in range(N): a,b = list(map(int, input().split())) A = max(A, a) B.append(b) B = sorted([b for b in B if b>A], reverse=True) from itertools import accumulate B = list(accumulate(B)) HP_after_throw = H - B[-1] if HP_after_throw <= 0: for i,b in enumer...
s350647280
p03472
u687574784
1592728112
Python
Python (3.8.2)
py
Runtime Error
257
18352
460
N,H = list(map(int, input().split())) A=0 B=[] for _ in range(N): a,b = list(map(int, input().split())) A = max(A, a) B.append(b) B.sort(reverse=True) from itertools import accumulate B = list(accumulate(B)) HP_after_throw = H - B[-1] if HP_after_throw <= 0: for i,b in enumerate(B,1): if H<b: ...
s913127318
p03472
u687574784
1592728035
Python
Python (3.8.2)
py
Runtime Error
257
18364
482
N,H = list(map(int, input().split())) A=0 B=[] for _ in range(N): a,b = list(map(int, input().split())) A = max(A, a) B.append(b) B.sort(reverse=True) from itertools import accumulate B = list(accumulate(B)) HP_after_throw = H - B[-1] print(HP_after_throw) if HP_after_throw <= 0: for i,b in enumerate(B...
s577584652
p03472
u086503932
1592439398
Python
Python (3.4.3)
py
Runtime Error
348
15896
630
#!/usr/bin/env python3 from collections import deque, Counter from heapq import heappop, heappush from bisect import bisect_right,bisect_left from itertools import accumulate def main(): N, H = map(int, input().split()) a = [None] * N b = [None] * N for i in range(N): a[i], b[i] = map(int, inpu...
s488198888
p03472
u243572357
1591760412
Python
Python (3.4.3)
py
Runtime Error
330
27380
387
n, h = map(int, input().split()) lst = [list(map(int, input().split())) for i in range(n)] a = [] b = [] for i in range(len(lst)): a.append(lst[i, 0]) b.append(lst[i, 0]) attack = max(a) thorow_nife = sorted([i for i in b if i > attack], reverse=True) counter = 0 for i in thorow_nife: h -= i counter += 1 if ...
s982903485
p03472
u755180064
1591420583
Python
Python (3.4.3)
py
Runtime Error
401
7424
657
def main(): n,h = list(map(int, input().split())) bi = [] max_attack = [0,0] for i in range(n): a, b = list(map(int, input().split())) bi.append(b) max_attack[0] = max(a, max_attack[0]) max_attack[1] = max(b, max_attack[1]) bi.sort(reverse=True) idx = 0 count ...
s649463708
p03472
u923270446
1591056190
Python
Python (3.4.3)
py
Runtime Error
17
3064
368
import math as m1 n, h = map(int, input().split()) a, b = [], [] for i in range(n): a_, b_ = map(int, input().split()) a.append(a_) b.append(b_) b = list(reversed(sorted(b))) m = max(a) ans = 0 for i in b: if i > m: if h - i <= 0: print(ans + 1) exit() h -= i ...
s188861959
p03472
u373047809
1590769253
Python
Python (3.4.3)
py
Runtime Error
139
25124
142
n,h,*d=map(int,open(0).read().split());a=max(d[::2]);b=sorted(d[1::2]);c=0 while(h>0)*(b[-1]>a)and b:h-=b.pop();c+=1 c-=(-h//a)*(h>0) print(c)
s756010586
p03472
u103520789
1590382303
Python
PyPy3 (2.4.0)
py
Runtime Error
2107
61400
383
import math N,H = map(int, input().split()) A = [] B = [] for _ in range(N): a,b = map(int, input().split()) A.append(a) B.append(b) nage_count = 0 for i in range(N): if B[i] > max(A): nage_count += 1 H -= B[i] if H <= 0: break # 今度は一番強いやつを振り続ける. if H>0: huri_count = math.ceil(H/max(A...
s533930795
p03472
u571867512
1590343002
Python
Python (3.4.3)
py
Runtime Error
461
28896
795
from math import ceil def attack(AB,H,N): AB.sort(key = lambda x:x[1]) count = 0 while H > 0: if AB[N-1][1] >= H: count += 1 H = 0 N -= 1 elif len(AB) >= 2: if AB[N-1][0] >= AB[N-2][1]: num = ceil((H-AB[N-1][1])/AB[N-1][0]) ...
s421521181
p03472
u571867512
1590342528
Python
Python (3.4.3)
py
Runtime Error
441
28904
954
def attack(AB,H,N): AB.sort(key = lambda x:x[1]) count = 0 while H > 0: if AB[N-1][1] >= H: count += 1 H = 0 N -= 1 elif len(AB) >= 2: if AB[N-1][0] >= AB[N-2][1]: num = (H-AB[N-1][1])//AB[N-1][0] H -= num*AB[N-1...
s479667091
p03472
u619144316
1589829504
Python
Python (3.4.3)
py
Runtime Error
18
2940
392
port numpy as np N, H = map(int,input().split()) maxA = 0 B = [] for _ in range(N): a, b = map(int,input().split()) B.append(b) if maxA < a: maxA = a B = np.array(B) throw_all = np.sort((B[B>maxA])) SUM = 0 cnt = 0 print(throw_all) for a in throw_all: SUM += a cnt += 1 if SUM >= H: ...
s393643668
p03472
u020604402
1589648818
Python
Python (3.4.3)
py
Runtime Error
349
12488
482
N, H = map(int,input().split()) L = [] maxi = 0 for _ in range(N): a,b = map(int,input().split()) maxi = max(maxi, a) L.append(b) from itertools import accumulate accumulated = list(accumulate(\ sorted([x for x in L if x > maxi],reverse=True) )) from bisect import bisect_left from math import ceil if H...
s901483040
p03472
u020604402
1589648684
Python
Python (3.4.3)
py
Runtime Error
362
11720
480
N, H = map(int,input().split()) L = [] maxi = 0 for _ in range(N): a,b = map(int,input().split()) maxi = max(maxi, a) L.append(b) from itertools import accumulate accumulated = list(accumulate(\ sorted([x for x in L if x > maxi],reverse=True) )) from bisect import bisect_right from math import ceil if ...
s785771659
p03472
u185948224
1589120992
Python
Python (3.4.3)
py
Runtime Error
475
28916
403
from operator import itemgetter import math N, H = map(int, input().split()) ab = [list(map(int, input().split())) for _ in range(N)] ab.sort(key=itemgetter(0)) amax = max([i[0] for i in ab]) num = 0 dmg = 0 for a, b in ab: if b > amax: num += 1 dmg += b if dmg >= H: jdg = T...
s537767066
p03472
u737718679
1588870300
Python
Python (3.4.3)
py
Runtime Error
17
3064
362
N,H=map(int,input().split()) a=[0]*N b=[0]*N for i in range(N): a[i],b[i]=map(int,input().split()) amax=max(a) n=0 total=0 b.sort(reverse=True) for i in range(N): if b[i] > amax: n+=1 total+=b[i] else: break if H <= total: for i in range(n): H-=b[i] if H <=0: print(i+1) break ...
s337366936
p03472
u075304271
1588798983
Python
Python (3.4.3)
py
Runtime Error
475
21552
1086
import numpy as np import functools import math import scipy import fractions import itertools def solve(): n, h = map(int, input().split()) a, b = [0]*n, [0]*n for i in range(n): a[i],b[i] = map(int, input().split()) a.sort(reverse = True) ans = 0 m = max(a) for i in range(n): ...
s117534063
p03472
u029000441
1588771447
Python
Python (3.4.3)
py
Runtime Error
273
12508
1185
import sys input = sys.stdin.readline sys.setrecursionlimit(10**7) from collections import Counter, deque from collections import defaultdict from itertools import combinations, permutations, accumulate, groupby, product from bisect import bisect_left,bisect_right from heapq import heapify, heappop, heappush from math ...
s925823863
p03472
u260216890
1588019754
Python
PyPy3 (2.4.0)
py
Runtime Error
592
69592
465
n,h=map(int, input().split()) a=[] b=[] for i in range(n): ai,bi=map(int, input().split()) a.append(ai) b.append(bi) b=sorted(b,reverse=True) amax=max(a) newb=[b[i] for i in range(n) if b[i]>amax] from itertools import accumulate newb=list(accumulate(newb)) ans=0 for i in range(len(newb)): if newb[i]>=h...
s580807002
p03472
u852790844
1587876007
Python
Python (3.4.3)
py
Runtime Error
212
37292
366
import sys import numpy as np read = sys.stdin.read sys.setrecursionlimit(10**9) n, h = map(int, input().split()) d = np.array(read().split(), dtype=np.int64).reshape([-1,2]) a = np.max(d[:,0]) b = d[:,1][np.argsort(d[:,1])][::-1] b = b[b > a] B = np.cumsum(b) if B[-1] < h: ans = -(-(h-B[-1])//a) + len(B) else: ...
s939298501
p03472
u852790844
1587875896
Python
Python (3.4.3)
py
Runtime Error
209
37300
337
import sys import numpy as np read = sys.stdin.read n, h = map(int, input().split()) d = np.array(read().split(), dtype=np.int64).reshape([-1,2]) a = np.max(d[:,0]) b = d[:,1][np.argsort(d[:,1])][::-1] b = b[b > a] B = np.cumsum(b) if B[-1] < h: ans = -(-(h-B[-1])//a) + len(B) else: ans = np.searchsorted(B, ...
s841357314
p03472
u440129511
1587592792
Python
Python (3.4.3)
py
Runtime Error
312
5244
656
import copy n,h=map(int,input().split()) ab=[list(map(int,input().split())).append(_) for _ in range(n)] ab1=copy.copy(ab) if n==1:print((h-ab[0][1])//ab[0][0]+2) else: ab1.sort() ma=ab1[-1][0] l=[] for i in range(n): if ab1[i][0]==ma:l.append(ab1[i]) l.sort() ak=ab.pop(l[0][2]) ab.s...
s692528817
p03472
u440129511
1587592363
Python
Python (3.4.3)
py
Runtime Error
25
3572
648
import copy n,h=map(int,input().split()) ab=[list(map(int,input().split()),_) for _ in range(n)] ab1=copy.copy(ab) if n==1:print((h-ab[0][1])//ab[0][0]+2) else: ab1.sort() ma=ab1[-1][0] l=[] for i in range(n): if ab1[i][0]==ma:l.append(ab1[i]) l.sort() ak=ab.pop(l[0][2]) ab.sort(key=...
s792520962
p03472
u440129511
1587592315
Python
Python (3.4.3)
py
Runtime Error
18
3064
618
n,h=map(int,input().split()) ab=[list(map(int,input().split()),_) for _ in range(n)] if n==1:print((h-ab[0][1])//ab[0][0]+2) else: ab1.sort() ma=ab1[-1][0] l=[] for i in range(n): if ab1[i][0]==ma:l.append(ab1[i]) l.sort() ak=ab.pop(l[0][2]) ab.sort(key=lambda x:x[1]) ac=0 fo...
s501486440
p03472
u531374611
1587436360
Python
Python (3.4.3)
py
Runtime Error
17
3064
365
import math N,M=(int(x) for x in input().split()) a=[0]*(N+1) b=[0]*(N+1) c=0 v=0 i=0 for i in range(N): A,B=(int(x) for x in input().split()) a[i]=A b[i]=B v = max(a) #ソート開始 b.sort(reverse=True) #ソート終了 #print(i,b[i],v,M,N) i=0 for i in B: if i>=v: c+=1 M-=i else:break if M>0 c+...
s210353587
p03472
u423585790
1587158803
Python
PyPy3 (2.4.0)
py
Runtime Error
165
38256
275
n,h=map(int,input().split()) ab=[[int(i) for i in input().split()] for _ in range(n)] maxa=max(map(lambda x:x[0], ab)) ab.sort(key:lambda x:x[1],reverse=True) ans=0 for a,b in ab: if b>maxa: h-=b ans+=1 if h<=0: print(ans) exit(0) print(ans+(h-1)//maxa+1)
s756936722
p03472
u442877951
1586801336
Python
PyPy3 (2.4.0)
py
Runtime Error
2107
70616
404
from collections import deque N,H = map(int,input().split()) AB = [list(map(int,input().split())) for _ in range(N)] AB_a = sorted(AB, reverse = True, key=lambda x: x[0]) AB_b = deque(sorted(AB, reverse = True, key=lambda x: x[1])) damage = 0 count = 0 while damage < H: if AB_b[0][1] > AB_a[0][0]: damage += AB_b...
s307611779
p03472
u655110382
1586305256
Python
Python (3.4.3)
py
Runtime Error
494
15700
675
from bisect import bisect_right from math import ceil n, h = map(int, input().split()) A = [] B = [] for _ in range(n): a, b = map(int, input().split()) A.append(a) B.append(b) B_sorted = sorted(B) B_cumulative_sum = list(B_sorted) for i in range(n - 2, -1, -1): B_cumulative_sum[i] += B_cumulative_sum[...
s011572959
p03472
u111555888
1584993973
Python
Python (3.4.3)
py
Runtime Error
17
3064
552
import sys N,H=map(int,input().split()) B=[] index=-1 tmp=-1 for i in range(N): a,b=map(int,input().split()) B.append(b) if a>tmp: index=i tmp=a a_,b_=tmp,B[index] cnt=0 if sum(B)>=H: B=sorted(B,reverse=True) while H>0: cnt+=1 b=B.pop(0) H-=b print(cnt) else: B.remove(b_) B=sorted(B,...
s923457862
p03472
u762540523
1582741707
Python
Python (3.4.3)
py
Runtime Error
18
3188
322
from bisect import bisect_right def main(): n,h=int(input()) a=[None]*n b=a[:] ans=0 for i in range(n): a[i],b[i]=map(int,input().split()) m=max(a) b.sort() x=bisect_right(b,m) for i in b[::-1][n-m]: h-=i ans+=1 if h<=0: print(ans) return ans+=(h+m-1)//m print(ans) main...
s047390733
p03472
u531436689
1582593365
Python
Python (3.4.3)
py
Runtime Error
17
3064
1070
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools from collections import deque sys.setrecursionlimit(10**7) inf = 10**20 mod = 10**9 + 7 DR = [1, -1, 0, 0] DC = [0, 0, 1, -1] def LI(): return [int(x) for x in sys.stdin.readline().split()] def LI_(): return [int(...
s720265345
p03472
u531436689
1582593318
Python
PyPy3 (2.4.0)
py
Runtime Error
183
38256
1209
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools from collections import deque sys.setrecursionlimit(10**7) inf = 10**20 mod = 10**9 + 7 DR = [1, -1, 0, 0] DC = [0, 0, 1, -1] def LI(): return [int(x) for x in sys.stdin.readline().split()] def LI_(): return [int(...
s353875198
p03472
u531436689
1582593201
Python
PyPy3 (2.4.0)
py
Runtime Error
177
38384
1209
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools from collections import deque sys.setrecursionlimit(10**7) inf = 10**20 mod = 10**9 + 7 DR = [1, -1, 0, 0] DC = [0, 0, 1, -1] def LI(): return [int(x) for x in sys.stdin.readline().split()] def LI_(): return [int(...
s787576317
p03472
u743229067
1581654788
Python
PyPy3 (2.4.0)
py
Runtime Error
573
55256
478
import math n, h = map(int, input().split()) max_swing = 0 throw = [] for _ in range(n): a, b = map(int, input().split()) max_swing = max(max_swing, a) throw.append(b) throw.sort(reverse=true) min_cnt = int(math.ceil(h / max_swing)) throw_cnt = 0 for t in throw: h -= t throw_cnt += 1 if h <= 0...
s102900765
p03472
u476604182
1581197755
Python
PyPy3 (2.4.0)
py
Runtime Error
772
65112
372
N, H = map(int, input().split()) ls = [] for i in range(N): a, b = map(int, input().split()) ls += [(a,-b)] ls.sort(key=lambda x:x[0]) a = ls[-1][0] ls.sort(key=lambda x:x[1]) ans = 0 for i in range(N-1): if ls[i][1]>=-a: break H += ls[i][1] ans += 1 if H<=0: print(ans) break else: n = H//a[0]...
s766470525
p03472
u094191970
1579918653
Python
Python (3.4.3)
py
Runtime Error
442
12084
540
from bisect import bisect n,h=map(int,input().split()) a=[] b=[] a_max=0 b_max=0 for i in range(n): x,y=map(int,input().split()) a.append(x) b.append(y) a_max=max(a_max,x) b_max=max(b_max,y) if a.index(a_max)==b.index(b_max): a=sorted(a) a_max=a[-2] b=sorted(b) lim_inx=bisect(b,a_max) cnt=0 total=0 in...
s778168596
p03472
u377989038
1579498920
Python
Python (3.4.3)
py
Runtime Error
453
19872
397
import numpy as np n, h = map(int, input().split()) a = 0 b = [] for i in range(n): A, B = map(int, input().split()) a = max(a, A) b.append(B) b = np.array(b, dtype=np.int64) b = np.sort(b[b > a])[::-1] if b.sum() >= h: cnt = 0 for i in b: h -= b cnt += 1 if h < 0: ...
s926170275
p03472
u732412551
1579296205
Python
Python (3.4.3)
py
Runtime Error
376
24380
274
N, H = map(int, input().split()) A, B = zip(*[tuple(map(int, input().split())) for _ in range(N)]) a = max(A) B = sorted((b for b in B if b > a), reverse=True) for i in range(len(B)): H -= B[i] if H <= 0: break else: i += (H + a - 1) // a i += 1 print(i)
s456197447
p03472
u747220349
1578700500
Python
PyPy3 (2.4.0)
py
Runtime Error
170
39728
302
n,h=map(int,input().split()) a=[0]*n b=[0]*n for i in range(n) a[i],b[i]=map(int,input().split()) x=max((a)) y=[i for i in b if i>A] y.sort(reverse=True) count=0 for i in range(len(y)): if h>0: count+=1 h-=y[i] else: break if h>0: count +=int(h//x)+1 print(count)
s072257952
p03472
u747220349
1578699445
Python
PyPy3 (2.4.0)
py
Runtime Error
183
38384
307
n,h=map(int,input().split()) l=[[map(int,input().split())] for _ in range(n)] la=sorted(l,key=lambda x:x[0],reverse=True) a=l[0][0] lb=sorted(l,key=lambda x:x[1],reverse=True) count=0 total=0 for i in lb: if i[1]>a: count+=1 total+=i[1] else: break print((h-total)//a+1+count
s257365016
p03472
u852690916
1578007264
Python
Python (3.4.3)
py
Runtime Error
455
21968
1715
N,H=map(int,input().split()) iAB=[] a_max=(0,0,0) for i in range(N): a,b=map(int,input().split()) iAB.append((i,a,b)) if a_max[1]<a or (a_max[1]==a and a_max[2]>b): a_max=(i,a,b) #最大ダメージの刀以外を振る意味はない #振った場合の最大ダメージを超えるダメージを投げて出せる刀はどんどん投げる #最大ダメージの刀を投げて1撃で倒せる状態なら投げる #投げダメージの降順でソート iAB.sort(key=lambda...
s427070864
p03472
u254871849
1577359084
Python
Python (3.4.3)
py
Runtime Error
109
25508
526
import sys from bisect import bisect_left as bi_l, bisect_right as bi_r from itertools import accumulate n, H, *ab = map(int, sys.stdin.read().split()) a = ab[::2] b = ab[1::2] def main(): a_max = max(a) b.sort() cands = b[bi_r(b, a_max):] total = list(accumulate(cands[::-1])) needed = bi_l(total...
s522279506
p03472
u905582793
1577240277
Python
Python (3.4.3)
py
Runtime Error
271
36084
356
import sys from operator import itemgetter input=sys.stdin.readline n,x=map(int,input().split()) a=[list(map(int,input().split())) for i in range(n)] b=list(zip(*a)) t=max(b[0]) a.sort(key=itemgetter(1),reverse=True) ans=0 for i in range(n): if x<=0: print(ans) break if a[1][i]>=t: x-=a[1][i] ans+=1...
s268739013
p03472
u905582793
1577240091
Python
Python (3.4.3)
py
Runtime Error
211
36084
356
import sys from operator import itemgetter input=sys.stdin.readline n,x=map(int,input().split()) a=[list(map(int,input().split())) for i in range(n)] a=list(zip(*a)) t=max(a[0]) a.sort(key=itemgetter(1),reverse=True) ans=0 for i in range(n): if x<=0: print(ans) break if a[1][i]>=t: x-=a[1][i] ans+=1...
s907406525
p03472
u261891508
1576959453
Python
Python (3.4.3)
py
Runtime Error
694
37788
630
n,h=map(int,input().split()) li=[tuple(map(int,input().split())) for i in range(n)] zenbu=[] for i in range(n): a=[li[i][0],"a"] b=[li[i][1],"b"] zenbu.append(a) zenbu.append(b) zenbu.sort(reverse=True) life=h ans=0 import math for i in range(n): if zenbu[i][1]=="b": life-=zenbu[i][0] ans+=1 ...
s150759848
p03472
u638282348
1576703418
Python
Python (3.4.3)
py
Runtime Error
488
27336
218
import numpy as np N, H = map(int, input().split()) A, B = np.array(tuple(tuple(map(int, input().split())) for _ in range(N))).T m = A.max() C = B > m Q, R = np.divmod(H - B[C].sum(), m) print(C.sum() + Q + bool(R))
s108518899
p03472
u226912938
1576092869
Python
Python (3.4.3)
py
Runtime Error
2104
12116
329
n, h = map(int, input().split()) A, B = [], [] for _ in range(n): a, b = map(int, input().split()) A.append(a) B.append(b) throw_a = max(A) B = sorted(B, reverse=True) count = 0 while h > 0: count += 1 if throw_a > max(B): h -= a else: h -= max(B) B.remove(max(B)) pri...
s049076949
p03472
u279493135
1575902729
Python
Python (3.4.3)
py
Runtime Error
396
11312
363
import bisect from math import ceil N, H = map(int, input().strip().split()) a = [0]*N b = [0]*N for i in range(N): a[i], b[i] = map(int, input().strip().split()) a_max = max(a) ans = 0 b.sort() a.sort() damage = 0 while damage < H: if b[-1] > a_max: damage += b.pop() ans += 1 else: ans += ceil((...
s469518792
p03472
u408620326
1575438671
Python
Python (3.4.3)
py
Runtime Error
205
11248
1082
import sys import math from collections import defaultdict input = sys.stdin.readline N, H = [int(x) for x in input().strip().split()] A = [0] * N B = [0] * N a_max = 0 for n in range(N): a, b = [int(x) for x in input().strip().split()] a_max = max(a_max, a) A[n] = a B[n] = b if sum(B) >= H: ans =...
s492951326
p03472
u600195339
1573922330
Python
PyPy3 (2.4.0)
py
Runtime Error
2107
67520
543
n, H = map(int, input().split()) amax = 0 ab = [] for i in range(n): v1, v2 = map(int, input().split()) amax = max(amax, v1) ab.append([v1, v2]) ab.sort(key=lambda x: x[1], reverse=True) cnt = 0 while H > 0: if ab[0][1] > amax: H -= ab[0][1] del ab[0] cnt += 1 elif len(ab)...