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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
s182975404 | p03472 | u600195339 | 1573917551 | Python | PyPy3 (2.4.0) | py | Runtime Error | 2135 | 716060 | 643 | import sys
sys.setrecursionlimit(50000)
# sys.setrecursionlimit(10**5)
n, H = map(int, input().split())
a, b = [], []
dp = [[None] * (H+1) for _ in range(n+1)]
for i in range(n):
v1, v2 = map(int, input().split())
a.append(v1)
b.append(v2)
def solve(idx, h):
if dp[idx][h] is not None:
return ... |
s135525614 | p03472 | u514894322 | 1573824071 | Python | Python (3.4.3) | py | Runtime Error | 400 | 11792 | 272 | n,h = map(int,input().split())
al=[]
bl=[]
for _ in [0]*n:
a,b = map(int,input().split())
al.append(a)
bl.append(b)
al.sort()
bl.sort()
ans = 0
while h>0:
if bl[-1]>al[-1]:
h-=bl[-1]
ans+=1
del bl[-1]
else:
ans += -(-h//al[-1])
h=0
print(ans) |
s490724533 | p03472 | u571718615 | 1573696804 | Python | Python (3.4.3) | py | Runtime Error | 209 | 11312 | 544 | # -*- coding: utf-8 -*-
from sys import stdin
N, H = [int(x) for x in stdin.readline().rstrip().split()]
a = [0] * N
b = [0] * N
for i in range(N):
a[i], b[i] = [int(x) for x in stdin.readline().rstrip().split()]
a_max = max(a)
b.sort(reverse=True)
count = 0
j = 0
while(True):
if a_max < b[j] :
H = ... |
s734882438 | p03472 | u571718615 | 1573696462 | Python | Python (3.4.3) | py | Runtime Error | 293 | 11688 | 578 | # -*- coding: utf-8 -*-
from sys import stdin
N, H = [int(x) for x in stdin.readline().rstrip().split()]
a = [0] * N
b = [0] * N
for i in range(N):
a[i], b[i] = [int(x) for x in stdin.readline().rstrip().split()]
a_max = max(a)
b.sort(reverse=True)
print(a_max)
count = 0
j = 0
while(True):
if a_max < b[j] ... |
s908140285 | p03472 | u135847648 | 1573681553 | Python | Python (3.4.3) | py | Runtime Error | 395 | 29336 | 671 | import math
n,h = map(int,input().split())
ab =[list(map(int,input().split())) for _ in range(n)]
lisA = []
lisB = []
#使いまわせるaを記録し、その最大値を見つける
for a,_ in ab:
lisA.append(a)
m = max(lisA)
#mより大きければ収納
for _,b in ab:
if b > m:
lisB.append(b)
s = sum(lisB)
lisB.sort(reverse=True)
#print(lisA,lisB,m,s)
cnt = 0
#もし、... |
s041099754 | p03472 | u665038048 | 1571195165 | Python | Python (3.4.3) | py | Runtime Error | 72 | 25124 | 231 | n, h, *ab = map(int, open(0).read().split())
a = ab[::2]
x = max(a)
b = sorted([i for i in ab[1**2] if i > x], reverse=1)
ans = 0
for i in b:
ans += 1
h -= i
if h <= 0:
break
ans += (h + x - 1) // x
print(ans)
|
s190786985 | p03472 | u665038048 | 1571195066 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 231 | n, h, *ab = map(int, open(0).read().split())
a = ab[::2]
x = max(a)
b = sorted([i for i in ab[1**2] if i > x], reverse=1)
ans = 0
for i in b:
ans += 1
h -= i
if h <= 0:
break
ans += (h + x = 1) // x
print(ans)
|
s503453418 | p03472 | u586759271 | 1570852772 | Python | PyPy3 (2.4.0) | py | Runtime Error | 168 | 38384 | 410 | #D
import numpy as np
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())
amax=max(a)
bp = [i for i in b if i>amax]
bp.sort(reverse=True)
sumbp=sum(bp)
if sumbp<h:#投げれるだけ投げてのこりを切る
print( (h-sumbp)//amax + len(bp) )
else:#投げまくる
rest=h
i=0
while res... |
s183083807 | p03472 | u797016134 | 1570556729 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 650 | n,h = map(int, input().split())
li = []
cut = 0
for i in range(n):
a, b = map(int, input().split())
cut = max(a, cut)
li.append(b)
li = sorted(li, reverse = True)
ans = 0
for b in li:
if b > cut:
h -= b
ans += 1
if h < 0:
print(ans)
exit()
else:
break
ans += (-(-h//cut))
print(ans) n,h = map(int, i... |
s868698428 | p03472 | u530335051 | 1570144061 | Python | Python (3.4.3) | py | Runtime Error | 1898 | 12116 | 380 | 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)
a = sorted(a, reverse=True)
b = sorted(b, reverse=True)
count = 0
while True:
if h <= 0:
break
elif b[0] <= a[0]:
count += -(- h // a[0])
break
... |
s503659529 | p03472 | u215315599 | 1569715036 | Python | Python (3.4.3) | py | Runtime Error | 340 | 19552 | 462 | import sys
import os
import math
N, H = map(int,input().split())
katana = [0 for _ in range(N)]
for i in range(N):
a,b = map(int,input().split())
katana[i] = [a,b]
katana = sorted(katana,key=itemgetter(1),reverse=True)
maxA = 0
for i in range(N):
maxA = max(maxA,katana[i][0])
cnt = 0
for k in katana:
... |
s030150698 | p03472 | u433532588 | 1569607552 | Python | Python (3.4.3) | py | Runtime Error | 328 | 11036 | 1102 |
N, H = map(int, input().split())
A = []
B = []
max_a = 0
max_a_b = 0
max_a_i = 0
max_b = 0
max_b_a = 0
max_b_i = 0
for i in range(N):
a, b = map(int, input().split())
A.append(a)
B.append(b)
if max_a < a:
max_a = a
max_a_b = b
max_a_i = i
if max_b < b:
max_b = b... |
s198188039 | p03472 | u239342230 | 1569560197 | Python | PyPy3 (2.4.0) | py | Runtime Error | 692 | 53720 | 417 | from collections import deque
N,H=map(int,input().split())
a=deque([]);b=deque([])
for _ in range(N):
ai,bi=map(int,input().split())
a.append(ai)
b.append(bi)
ma=max(a)
bs=sorted(b,reverse=True)
bc=0
for i in range(len(bs)):
bi=b[i]
if bi>ma:
bc+=b[i]
if H<=bc:
print(i+1)... |
s044867843 | p03472 | u239342230 | 1569559349 | Python | PyPy3 (2.4.0) | py | Runtime Error | 587 | 52440 | 423 | from collections import deque
N,H=map(int,input().split())
a=deque([]);b=deque([])
for _ in range(N):
ai,bi=map(int,input().split())
a.append(ai)
b.append(bi)
bb=deque([])
ma=max(a)
for _ in range(N):
bi=b.pop[b.index(max(b))]
if bi>ma:
bb.append(bi)
if sum(bb)>=H:
print(len(bb))... |
s664640659 | p03472 | u172111219 | 1569433030 | Python | PyPy3 (2.4.0) | py | Runtime Error | 288 | 51440 | 593 | from collections import defaultdict
import sys
from math import ceil
input = sys.stdin.readline
def main():
# init
n,h = map(int,input().split())
a,b = [0 for _ in range(n)],[0 for _ in range(n)]
for i in range(n):
a[i],b[i] = map(int,input().split())
b.sort(reversed=True)
max_a = max(a... |
s037512372 | p03472 | u581187895 | 1569283310 | Python | Python (3.4.3) | py | Runtime Error | 389 | 29860 | 410 | # 振るのは最強のやつだけ
# 投げるのは強い順
N,H = map(int,input().split())
AB = [[int(x) for x in 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)
attack_cnt = 0
for b in B:
if H <= 0:
break
attack_cnt += 1
H -= b
if hp > 0:
attack_cnt +=... |
s445004544 | p03472 | u688789047 | 1569153116 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 1152 | using System;
using System.Linq;
using System.Collections.Generic;
namespace Algorithm
{
class Program
{
static void Main(string[] args)
{
var l = Console.ReadLine().Split().Select(int.Parse).ToArray();
int n = l[0], h = l[1];
var ab = new int[n][];
... |
s242723859 | p03472 | u703890795 | 1567494103 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 545 | import math
N, H = map(int, input().split())
Swords_a = []
Swords_b = []
amax = 0
for i in range(N):
a, b = map(int, input().split())
Swords_a.append(a)
Swords_b.append(b)
ma = max(Swords_a)
sb = 0 # bのうち「maより大きい成分」の和
Swords_a = sorted(Swords_a)
Swords_b = sorted(Swords_b)
c = 0
k = 0
for i in range(N):... |
s218437364 | p03472 | u703890795 | 1567493393 | Python | Python (3.4.3) | py | Runtime Error | 398 | 12160 | 510 | import math
N, H = map(int, input().split())
Swords_a = []
Swords_b = []
amax = 0
for i in range(N):
a, b = map(int, input().split())
Swords_a.append(a)
Swords_b.append(b)
ma = max(Swords_a)
sb = 0 # bのうち「maより大きい成分」の和
Swords_a = sorted(Swords_a)
Swords_b = sorted(Swords_b)
c = 0
k = 0
for i in range(N):... |
s777607596 | p03472 | u444082822 | 1567136607 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 24332 | 422 | NH = input().split()
N = int(NH[0])
H = int(NH[1])
a = []
b = []
for v in range(N):
L = input().split()
a.append(L[0])
b.append(L[1])
a = list(map(int, a))
b = list(map(int, b))
a.sort(reverse = True)
b.sort(reverse = True)
c = 0
count = 0
while c < H:
if a[0] >= b[0] or len(b) == 0:
c = c + a[0... |
s530236201 | p03472 | u614734359 | 1567040719 | Python | Python (3.4.3) | py | Runtime Error | 337 | 11300 | 411 | n,h = (int(i) for i in input().split())
A,B = [],[]
for _ in range(n):
a,b = [int(i) for i in input().split()]
A.append(a)
B.append(b)
a_max = max(A)
B.sort()[::-1]
power,ans = 0,0
for b in B:
if a_max <= b:
power += b
ans += 1
if power>=h: break
if power>=h:
print(ans)
else:... |
s827525374 | p03472 | u437638594 | 1566866299 | Python | Python (3.4.3) | py | Runtime Error | 357 | 12152 | 415 | N, H = map(int, input().split())
a_list = []
b_list = []
for _ in range(N):
a, b = map(int, input().split())
a_list.append(a)
b_list.append(b)
b_list = sorted(b_list)
count = 0
a_max = max(a_list)
while H > 0:
b = b_list.pop()
if b > a_max:
H -= b
count += 1
else:
break
if H > 0:
if ... |
s974454661 | p03472 | u097317219 | 1566736646 | Python | PyPy3 (2.4.0) | py | Runtime Error | 173 | 38384 | 483 | from operator import itemgetter
n,h = map(int,input().split())
ab = []
ans = 0
a = 0
for i in range(n):
ab.append(list(map(int,input.split())))
ab.sort()
swing = ab.pop(-1)
ab = sorted(a,key = itemgetter(1))
ab.reverse
for i in range(len(ab)):
h -= ab[i][1]
ans += 1
if h <= 0:
print(ans)
a += 1
brea... |
s863399859 | p03472 | u472065247 | 1565745909 | Python | Python (3.4.3) | py | Runtime Error | 463 | 34528 | 665 | n, h = map(int, input().split())
l = [list(map(int, input().split())) for _ in range(n)]
max_a = max(l, key=lambda x: x[0])[0]
l = [[a, b] for a, b in l if b > max_a]
l.sort(key=lambda x: x[1], reverse=True)
n = len(l)
c = 0
for i in range(n - 1):
a, b = l[i]
if a == max_a and l[i + 1][0] < max_a:
l = l[i:]
... |
s731340717 | p03472 | u413165887 | 1565472468 | Python | Python (3.4.3) | py | Runtime Error | 335 | 27380 | 355 | n, h = list(map(int, input().split(' ')))
a, b = [list(map(int, input().split(' '))) for _ in range(n)]
a.sort(reverse = True)
b.sort(reverse = True)
a.append(0)
b.append(0)
count = 0
x = 0
y = 0
while h < 0:
if a[x] <= b[y]:
h -= b[y]
y += 1
count += 1
elif a[x] > b[y]:
h -= a... |
s120171190 | p03472 | u600402037 | 1564227033 | Python | Python (3.4.3) | py | Runtime Error | 397 | 29708 | 775 | N, H = map(int, input().split())
sword_list = [list(map(int, input().split())) for i in range(N)]
a_list = [i[0] for i in sword_list]
b_list = [i[1] for i in sword_list]
b_list.sort()
a_max = max(a_list)
index1 = 0
# Aの攻撃がBのいくつかの攻撃より強い場合、どの場所のBかを知っておく
for i in range(0, len(b_list)):
if b_list[i] <= a_max and b_list... |
s788327194 | p03472 | u227082700 | 1562487351 | Python | Python (3.4.3) | py | Runtime Error | 21 | 3060 | 234 | n,h=map(int,input().split())
a=[]
for i in range(n):
b,c=map(int,input().split())
a.append([b,0]);a.append([c,1])
a.sort(reverse=1)
i=0
ans=0
while h>0:
if a[i][1]==1:h-=a[i][0];ans+=1
else h=0:ans+=(h-1)//a[i][0]+1
print(ans) |
s289943677 | p03472 | u227082700 | 1562487326 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 234 | n,h=map(int,input().split())
a=[]
for i in range(n):
b,c=map(int,input().split())
a.append([b,0]);a.append([c,1])
a.sort(reverse=1)
i=0
ans=0
while h>0:
if a[i][1]==1:h-=a[i][0];ans+=1
else:h=0:ans+=(h-1)//a[i][0]+1
print(ans) |
s150313605 | p03472 | u365858785 | 1561794836 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 11004 | 313 | honsu,hp=map(int , input().split())
huru=[]
nageru=[]
for i in range(honsu):
a,b=input().split()
huru.append(int(a))
nageru.append(int(b))
cc=filter(lambda v:v>=max(huru) , nageru)
cou=0
for i in reversed(sorted(cc)):
hp-=i
cou+=1
if hp<=0:
break
if hp>0:
cou+=math.ceil(hp/max(huru))
print(cou) |
s685101384 | p03472 | u365858785 | 1561757643 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 320 | import math
honsu,hp=map(int , input().split())
huru=[]
nageru=[]
for i in range(honsu):
a,b=input().split()
hur+=[int(a)]
nageru+=[int(b)]
cc=list(filter(lambda v:v>=max(huru) , nageru))
cou=0
for i in reversed(sorted(cc)):
hp-=i
cou+=1
if hp<=0:
break
if hp>0:
cou+=math.ceil(hp/max(huru))
print(cou) |
s846838680 | p03472 | u405832869 | 1561002519 | Python | Python (3.4.3) | py | Runtime Error | 354 | 12068 | 408 | N,H = map(int,input().split())
a_list=[]
b_list=[]
cnt = 0
for i in range(N):
a,b = map(int,input().split())
a_list.append(a)
b_list.append(b)
sum_b = sum(b_list)
if sum_b < H:
A = max(a_list)
for i in range(N):
if b_list[i] - A < 0:
cnt += A - b_list[i]
print(N-(-(H - sum_b - cnt)//A))
else:
c ... |
s353568769 | p03472 | u762557532 | 1559750486 | Python | Python (3.4.3) | py | Runtime Error | 763 | 40100 | 625 | import numpy as np
N, H = map(int, input().split())
AB = [list(map(int,input().split())) for i in range(N)]
swing = sorted([AB[i][0] for i in range(N)], reverse=True)
throw = sorted([AB[i][1] for i in range(N)], reverse=True)
## 投げて強いものは(最後に)投げる
big_throw = [throw[i] for i in range(N) if throw[i] > swing[0]]
throw_c... |
s625804686 | p03472 | u570461262 | 1559527217 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 25124 | 291 | n, h, *t=map(int,open(0).read().split())
b_high = [i for i in sorted(t[1::2]) if all(i >= j for j in sorted(t[::2]))]
if (h - sum(b_high)) % a[-1] == 0:
print(len(b_high) + (h - sum(b_high)) // sorted(t[::2])[-1])
else:
print(len(b_high) + ((h - sum(b_high)) // sorted(t[::2])[-1]) + 1)
|
s288476436 | p03472 | u543954314 | 1559316295 | Python | Python (3.4.3) | py | Runtime Error | 372 | 7384 | 275 | throw = []
blow = 0
cnt = 0
n,h = map(int, input().split())
for _ in range(n):
a,b = map(int, input().split())
blow = max(blow,a)
throw.append(b)
throw.sort()
while h and throw[-1]>blow:
h -= throw.pop()
cnt += 1
if h > 0:
cnt += h//blow + (h%blow>0)
print(cnt) |
s711171077 | p03472 | u470542271 | 1558501950 | Python | PyPy3 (2.4.0) | py | Runtime Error | 612 | 69208 | 589 | n, h = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(n)]
a_all = [_ab[0] for _ab in ab]
b_all = [_ab[1] for _ab in ab]
a_max = max(a_all)
b_all_useful = []
for b in b_all:
if b > a_max:
b_all_useful.append(b)
b_all_useful.sort()
useful_sum = sum(b_all_useful)
if useful_... |
s062584488 | p03472 | u046187684 | 1553788657 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 446 | from math import ceil
def solve(string):
n, h, * ab = map(int, string.split())
max_a = max(ab[::2])
cnt = 0
b = sorted([b for b in ab[1::2] if b > max_a], reverse=True)
if sum(b) < h:
cnt = len(b) + ceil((h-sum(b)) / max_a)
else:
for _b in b:
cnt += 1
h ... |
s671911901 | p03472 | u650622056 | 1553354632 | Python | Python (3.4.3) | py | Runtime Error | 435 | 22752 | 602 | N, H = [int(_) for _ in input().split()]
katana = [[int(_) for _ in input().split()] for _ in range(N)]
katana.sort(key=lambda x:x[1], reverse=True)
a_max_katana = max(katana)
a_max = a_max_katana[0]
a_max_b = a_max_katana[1]
a_max_index = katana.index(a_max_katana)
katana.pop(a_max_index)
count = 0
j = 0
while H >... |
s817223797 | p03472 | u017810624 | 1553285132 | Python | Python (3.4.3) | py | Runtime Error | 379 | 28172 | 438 | n,h=map(int,input().split())
l=[list(map(int,input().split())) for i in range(n)]
a=set()
for i in range(n):
a.add(l[i][0])
maxA=max(a)
b=set()
for i in range(n):
b.add(l[i][1])
b=sorted(b)
b.reverse()
damage=0
count=0
f=0
for i in range(n):
if damage>=h:
f=1
break
else:
if b[i]>maxA:
damage+=... |
s348413123 | p03472 | u017810624 | 1553285005 | Python | Python (3.4.3) | py | Runtime Error | 540 | 28144 | 440 | n,h=map(int,input().split())
l=[list(map(int,input().split())) for i in range(n)]
a=set()
for i in range(n):
a.add(l[i][0])
maxA=max(a)
b=set()
for i in range(n):
b.add(l[i][1])
b=sorted(b)
b.reverse()
damage=0
count=0
f=0
for i in range(n):
if damage>=h:
f=1
break
else:
if b[i]>max(a):
damage... |
s499561240 | p03472 | u652057333 | 1552376029 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 546 | %%test_input https://atcoder.jp/contests/abc085/tasks/abc085_d
# D
import math
n, h = map(int, input().split())
max_a = 0
a = [0] * n
b = [0] * n
for i in range(n):
a[i], b[i] = map(int, input().split())
if max_a < a[i]:
max_a = a[i]
throw = []
for i in range(n):
if b[i] > max_a:
throw.appen... |
s282274828 | p03472 | u095426154 | 1551849239 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 16280 | 519 | import copy
j=0
n,hp=map(int,input().split(" "))
la=[0 for i in range(n)]
lb=[0 for i in range(n)]
for i in range(n):
la[i],lb[i]=map(int,input().split(" "))
cnt=0
ma=max(la)
lma=[i for i ,x in enumerate(la) if x==ma]
mib=10**9
for i in lma:
if lb[i]<mib:
mib=lb[i]
k=i
tmp=copy.deepcopy(lb)
whi... |
s951194779 | p03472 | u095426154 | 1551849058 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 16280 | 505 | import copy
n,hp=map(int,input().split(" "))
la=[0 for i in range(n)]
lb=[0 for i in range(n)]
for i in range(n):
la[i],lb[i]=map(int,input().split(" "))
cnt=0
ma=max(la)
lma=[i for i ,x in enumerate(la) if x==ma]
mib=10**9
for i in lma:
if lb[i]<mib:
mib=lb[i]
k=i
tmp=copy.deepcopy(lb)
while m... |
s093326337 | p03472 | u955251526 | 1551840403 | Python | Python (3.4.3) | py | Runtime Error | 341 | 16592 | 419 | n, h = map(int, input().split())
katana = [tuple(map(int, input().split())) for _ in range(n)]
maxa = 0
for a, _ in katana:
maxa = max(maxa, a)
bgreedy = 0
count = 0
katana.sort(lambda x: x[1], reverse = True)
for a, b in katana:
if b < maxa:
break
bgreedy += b
count += 1
if h <= bgreedy:
... |
s729279416 | p03472 | u095426154 | 1551832883 | Python | Python (3.4.3) | py | Runtime Error | 2105 | 16280 | 570 | import copy
n,hp=map(int,input().split(" "))
la=[0 for i in range(n)]
lb=[0 for i in range(n)]
for i in range(n):
la[i],lb[i]=map(int,input().split(" "))
cnt=0
ma=max(la)
lma=[i for i ,x in enumerate(la) if x==ma]
mib=10**9
for i in lma:
if lb[i]<mib:
mib=lb[i]
k=i
tmp=copy.deepcopy(lb)
while m... |
s558403777 | p03472 | u095426154 | 1551832666 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 16280 | 570 | import copy
n,hp=map(int,input().split(" "))
la=[0 for i in range(n)]
lb=[0 for i in range(n)]
for i in range(n):
la[i],lb[i]=map(int,input().split(" "))
cnt=0
ma=max(la)
lma=[i for i ,x in enumerate(la) if x==ma]
mib=10**9
for i in lma:
if lb[i]<mib:
mib=lb[i]
k=i
tmp=copy.deepcopy(lb)
while m... |
s179340407 | p03472 | u095426154 | 1551830951 | Python | Python (3.4.3) | py | Runtime Error | 357 | 15016 | 593 | n,hp=map(int,input().split(" "))
la=[0 for i in range(n)]
lb=[0 for i in range(n)]
for i in range(n):
la[i],lb[i]=map(int,input().split(" "))
cnt=0
ma=max(la)
lma=[i for i ,x in enumerate(la) if x==ma]
mib=10**9
for i in lma:
if lb[i]<mib:
mib=lb[i]
k=i
for i in range(n):
if lb[i]>ma and i!... |
s651739211 | p03472 | u095426154 | 1551830316 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 15016 | 581 | n,hp=map(int,input().split(" "))
la=[0 for i in range(n)]
lb=[0 for i in range(n)]
for i in range(n):
la[i],lb[i]=map(int,input().split(" "))
cnt=0
ma=max(la)
lma=[i for i ,x in enumerate(la) if x==ma]
mib=10**9
for i in lma:
if lb[i]<mib:
mib=lb[i]
k=i
for i in range(n):
if lb[i]>ma and i!... |
s737197951 | p03472 | u174394352 | 1548483947 | Python | PyPy3 (2.4.0) | py | Runtime Error | 824 | 73688 | 590 | N,H=map(int,input().split())
d=[]
for _ in range(N):
d.append(list(map(int,input().split())))
d.sort(key=lambda x:x[0],reverse=True)
a = d[0][0]
d.sort(key=lambda x:x[1],reverse=True)
i=0
dam=0
b_damage=[]
while d[i][1]>a:
dam+=d[i][1]
b_damage.append(dam)
i+=1
if i==N:
break
r = H//a ... |
s706930787 | p03472 | u102960641 | 1547940944 | Python | Python (3.4.3) | py | Runtime Error | 360 | 11772 | 328 | import bisect
n,h = map(int, input().split())
a = []
b = []
for i in range(n):
a1,b1 = map(int, input().split())
a.append(a1)
b.append(b1)
b.sort()
max_a = max(a)
ans = 0
for i in b[::-1]:
if i > max_a:
h -= i
ans += 1
else:
break
if h <= 0:
print(ans)
exit()
ans += math.ceil(h/max_a)
pr... |
s854842254 | p03472 | u903596281 | 1547172150 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 11020 | 297 | N,H=map(int,input().split())
sl=[]
th=[]
for i in range(N):
s,t=map(int,input().split())
sl.append(s)
th.append(t)
gsl=max(sl)
ans=0
while H>0:
if gsl<max(th):
at=max(th)
H-=at
ans+=1
th.remove(at)
else:
ans+=H//gsl
if H%gsl!=0:
ans+=1
break
print(ans) |
s718914244 | p03472 | u853900545 | 1546377365 | Python | Python (3.4.3) | py | Runtime Error | 311 | 10868 | 419 | 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 = max(a)
s = set()
for i in range(n):
if b[i] > A:
s.add(b[i])
s = (list(s).sort()).reverse()
c = sum(s)
if c < h:
print((h-c)//A + [1,0][(h-c)%A==0])
else:
cnt = 0
l = 0
for i in ra... |
s053344721 | p03472 | u853900545 | 1546375296 | Python | Python (3.4.3) | py | Runtime Error | 363 | 12456 | 417 | 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 = max(a)
c = h//A + [1,0][h%A==0]
if sum(b) >= h:
c0 = 1
d = 0
e = list(reversed(sorted(b)))
i = 0
while d < h:
d += e[i]
c0 += 1
i += 1
if e[i] < A:
... |
s922839310 | p03472 | u853900545 | 1546375206 | Python | Python (3.4.3) | py | Runtime Error | 355 | 12456 | 407 | 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 = max(a)
c = h//A + [1,0][h%A==0]
if sum(b) >= h:
c0 = 1
d = 0
e = list(reversed(sorted(b)))
i = 0
while d < h:
d += e[i]
c0 += 1
i += 1
if e[i] < A:
... |
s838994758 | p03472 | u853900545 | 1546374637 | Python | Python (3.4.3) | py | Runtime Error | 325 | 12456 | 307 | 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())
c = h//max(a) + [1,0][h%max(a)==0]
if sum(b) >= h:
c0 = 1
d = 0
e = list(reversed(sorted(b)))
while d < h:
d += e[i]
c0 += 1
i += 1
c = min(c,c0)
print(c) |
s335160547 | p03472 | u853900545 | 1546374454 | Python | Python (3.4.3) | py | Runtime Error | 327 | 12080 | 301 | 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())
c = h//max(a) + [1,0][h%max(a)==0]
if sum(b) >= h:
c0 = 1
d = 0
e = reversed(sorted(b))
while d < h:
d += e[i]
c0 += 1
i += 1
c = min(c,c0)
print(c) |
s475706134 | p03472 | u853900545 | 1546374339 | Python | Python (3.4.3) | py | Runtime Error | 327 | 12080 | 301 | 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())
c = h//max(a) + [1,0][h%max(a)==1]
if sum(b) >= h:
c0 = 0
d = 0
e = reversed(sorted(b))
while d < h:
d += e[i]
c0 += 1
i += 1
c = min(c,c0)
print(c) |
s928663753 | p03472 | u853900545 | 1546374216 | Python | Python (3.4.3) | py | Runtime Error | 307 | 11636 | 298 | 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())
c = h//max(a) + [0,1][h%max(a)]
if sum(b) >= h:
c0 = 0
d = 0
e = reversed(sorted(b))
while d < h:
d += e[i]
c0 += 1
i += 1
c = min(c,c0)
print(c) |
s859504037 | p03472 | u853900545 | 1546374137 | Python | Python (3.4.3) | py | Runtime Error | 319 | 12080 | 284 | 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())
c = h//max(a) + 1
if sum(b) >= h:
c0 = 0
d = 0
e = reversed(sorted(b))
while d < h:
d += e[i]
c0 += 1
i += 1
c = min(c,c0)
print(c) |
s203061544 | p03472 | u853900545 | 1546373989 | Python | Python (3.4.3) | py | Runtime Error | 22 | 4596 | 224 | n,h =map(int,input().split())
a,b = [0]*n,[0]*n
c = h//max(a) + 1
if sum(b) >= h:
c0 = 0
d = 0
e = reversed(sorted(b))
while d < h:
d += e[i]
c0 += 1
i += 1
c = min(c,c0)
print(c) |
s822037178 | p03472 | u853900545 | 1546373953 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 179 | a,b = [0]*n,[0]*n
c = h//max(a) + 1
if sum(b) >= h:
c0 = 0
d = 0
e = reversed(sorted(b))
while d < h:
d += e[i]
c0 += 1
c = min(c,c0)
print(c) |
s666198760 | p03472 | u426108351 | 1544563026 | Python | Python (3.4.3) | py | Runtime Error | 460 | 31540 | 942 | from operator import itemgetter
N, H = map(int, input().split())
ab = []
for i in range(N):
n, m = map(int, input().split())
ab.append([n, m])
max_count = 0
ab = sorted(ab, key = lambda x:(-x[1], x[0]))
a_max = max(a)
for i in range(N):
if a[i] == a_max:
max_count += 1
print(ab)
ans = 0
for i in ra... |
s356744070 | p03472 | u054106284 | 1544484760 | Python | Python (3.4.3) | py | Runtime Error | 383 | 11344 | 332 | N, H = ( int(i) for i in input().split() )
ka = []
kb = []
for i in range(N):
a, b = ( int(i) for i in input().split() )
ka.append(a)
kb.append(b)
kb.sort()
kb.reverse()
hp = H
res = 0
for b in kb:
if b < max(a):
continue
hp = hp - b
res += 1
if hp <= 0:
break
else:
res += (hp + max(ka) - 1)//max(ka)
p... |
s374211700 | p03472 | u731028462 | 1544030013 | Python | Python (3.4.3) | py | Runtime Error | 439 | 18084 | 351 | N,H=list(map(int, input().split()))
ab=[]
amax=0
for i in range(N):
a,b=list(map(int, input().split()))
if a>amax:
amax=a
ind=i
ab.append((a,b))
# Sort: O(nlogn)
ab.sort(key=lambda x:x[1], reverse=True)
# Simulation: O(n)
h=0
i=0
cnt=0
while ab[i][1]>amax:
h+=ab[i][1]
i+=1
cnt... |
s031979851 | p03472 | u731028462 | 1544025504 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 18100 | 393 | N,H=list(map(int, input().split()))
ab=[]
amax=0
for i in range(N):
a,b=list(map(int, input().split()))
if a > amax:
amax = a
ind = i
ab.append((a,b))
ab.sort(key=lambda x: x[1], reverse=True)
h = 0
i = 0
cnt = 0
while H>h:
if ab[i][1] > amax:
h += ab[i][1]
i += 1
... |
s047085104 | p03472 | u900809342 | 1543718432 | Python | Python (3.4.3) | py | Runtime Error | 358 | 11664 | 331 | n,h = map(int,input().split())
A = []
B = []
for i in range(1,n+1):
a,b = map(int,input().split())
A.append(a)
B.append(b)
amax = max(A)
B = list(filter(lambda x: x > amax, B))
B.sort()
ans = 0
while h >0:
if B:
h -= B.pop()
else:
ans += math.ceil(h/amax)
break
ans += 1... |
s325817283 | p03472 | u900809342 | 1543718163 | Python | Python (3.4.3) | py | Runtime Error | 359 | 11684 | 331 | n,h = map(int,input().split())
A = []
B = []
for i in range(1,n+1):
a,b = map(int,input().split())
A.append(a)
B.append(b)
amax = max(A)
B = list(filter(lambda x: x > amax, B))
B.sort()
ans = 0
while h >0:
if B:
h -= B.pop()
else:
ans += math.ceil(h/amax)
break
ans += 1... |
s272614997 | p03472 | u788023488 | 1540272355 | Python | Python (3.4.3) | py | Runtime Error | 628 | 37860 | 651 | import numpy as np
N,H = map(int,input().split())
ab = np.asarray([list(map(int,input().split())) for _ in range(N)])
#bのうち大きなものから引いていく
#b[i]のうち、max(a)が大きければ、以降max(a)で攻撃し続ける
max_a = np.max(ab[:,0])
b_sort = np.sort(ab[:,1])[::-1] #降順
ans = 0
b_sort = b_sort[np.where(b_sort > max_a)]
#b_sortの中で大きいのから順に引いてい... |
s186357602 | p03472 | u788023488 | 1540272095 | Python | Python (3.4.3) | py | Runtime Error | 596 | 37856 | 636 | import numpy as np
N,H = map(int,input().split())
ab = np.asarray([list(map(int,input().split())) for _ in range(N)])
#bのうち大きなものから引いていく
#b[i]のうち、max(a)が大きければ、以降max(a)で攻撃し続ける
max_a = np.max(ab[:,0])
b_sort = np.sort(ab[:,1])[::-1] #降順
ans = 0
b_sort = b_sort[np.where(b_sort > max_a)]
#b_sortの中で大きいのから順に引いていく
for... |
s589416675 | p03472 | u788023488 | 1540270709 | Python | PyPy3 (2.4.0) | py | Runtime Error | 164 | 38384 | 745 | import numpy as np
N,H = map(int,input().split())
ab = np.asarray([list(map(int,input().split())) for _ in range(N)])
#ソート
a_sort = sorted(ab[:,0], reverse=True)
b_sort = sorted(ab[:,1], reverse=True)
ab_sort = sorted(ab.reshape(2*N), reverse=True)
ans = 0
i = 0 #ab_sortの中で大きいのから順に引いていく
while H > 0:
ab_max = ab... |
s208948232 | p03472 | u788023488 | 1540269612 | Python | Python (3.4.3) | py | Runtime Error | 2110 | 37832 | 480 | import numpy as np
N,H = map(int,input().split())
ab = np.asarray([list(map(int,input().split())) for _ in range(N)])
#ソート
a_sort = sorted(ab[:,0], reverse=True)
b_sort = sorted(ab[:,1], reverse=True)
ab_sort = sorted(ab.reshape(2*N), reverse=True)
ans = 0
i = 0 #ab_sortの中で大きいのから順に引いていく
while H > 0:
H -= ab_sort[i... |
s965680942 | p03472 | u790877102 | 1539465799 | Python | Python (3.4.3) | py | Runtime Error | 362 | 27380 | 401 | n,h = map(int,input().split())
x = []
for i in range(n):
x.append(list(map(int,input().split())))
t = 0
c = []#強い投げ刀たち
M = max(x[i][0] for i in range(n))
for i in range(n):
if x[i][1]>max(M)-1:
c.append(x[i][1])
c.sort()
c.reverse()
if sum(c)>h-1:
for i in range(len(c)):
t += 1
h -= c[i]
if h<1:
print(... |
s163763404 | p03472 | u790877102 | 1539465737 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 396 | n,h = map(int,input().split())
x = []
for i in range(n):
x.append(list(map(int,input().split())))
t = 0
c = []#強い投げ刀たち
M = x[i][0] for i in range(n)
for i in range(n):
if x[i][1]>max(M)-1:
c.append(x[i][1])
c.sort()
c.reverse()
if sum(c)>h-1:
for i in range(len(c)):
t += 1
h -= c[i]
if h<1:
print(t)
... |
s768951825 | p03472 | u790877102 | 1539424544 | Python | Python (3.4.3) | py | Runtime Error | 2105 | 29428 | 389 | n,h = map(int,input().split())
x = []
for i in range(n):
x.append(list(map(int,input().split())))
t = 0
c = []#強い投げ刀たち
for i in range(n):
if x[i][1]>max(x[i][0] for i in range(n))-1:
c.append(x[i][1])
c.sort()
c.reverse()
if sum(c)>h-1:
for i in range(len(c)):
t += 1
h -= c[i]
if h<1:
print(t)
break
... |
s132383925 | p03472 | u790877102 | 1539414547 | Python | Python (3.4.3) | py | Runtime Error | 2106 | 30484 | 431 | n,h = map(int,input().split())
x = []
for i in range(n):
x.append(list(map(int,input().split())))
a = []
for i in range(n):
a.append(x[i][0])
b = []
for i in range(n):
b.append(x[i][1])
x.sort(key = lambda x:x[1])
t = 0
c = []
if sum(b)>h-1:
for i in range(n):
t += 1
h -= x[i+1][1]
if h<1:
print(t)
bre... |
s797739226 | p03472 | u558782626 | 1536934097 | Python | Python (3.4.3) | py | Runtime Error | 733 | 31700 | 544 | import numpy as np
import math
N, H = map(int, input().split())
sord = np.array([[int(i) for i in input().split()] for _ in range(N)])
ans = 0
a_max = max(sord[:,0])
sord = sord[sord[:,1] > a_max]
b_max = min(sord[sord[:,0]==a_max][:,1])
sord = list(sord[:,1])
sord.pop(sord.index(b_max))
sord.sort(reverse=True)
for ... |
s172625026 | p03472 | u648901783 | 1536346578 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 57332 | 715 |
# import time
# t0 = time.time()
# print(0)
n,h= map(int,input().split())
a = [input().rstrip().split() for i in range(0,n)]
# n = 2
# h = 10
a2 = [[0 for i in range(2)] for j in range(2*n)]
a=[['3', '5'], ['2', '6']]
for i in range(0,n):
a2[2*i][0]=int(a[i][0])
a2[2*i+1][0]=int(a[i][1])
a2[2*i+1][1]+=1
... |
s221835992 | p03472 | u648901783 | 1536346198 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 665 |
# import time
t0 = time.time()
# print(0)
n,h= map(int,input().split())
a = [input().rstrip().split() for i in range(0,n)]
a2 = [[0 for i in range(2)] for j in range(2*n)]
for i in range(0,n):
a2[2*i][0]=int(a[i][0])
a2[2*i+1][0]=int(a[i][1])
a2[2*i+1][1]+=1
# a2
t1 = time.time()
# print('生成完了',t1-t0)
... |
s041291971 | p03472 | u648901783 | 1536346133 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 707 |
# import time
t0 = time.time()
# print(0)
# n,h= map(int,input().split())
# a = [input().rstrip().split() for i in range(0,n)]
n = 2
h = 10
a2 = [[0 for i in range(2)] for j in range(2*n)]
a=[['3', '5'], ['2', '6']]
for i in range(0,n):
a2[2*i][0]=int(a[i][0])
a2[2*i+1][0]=int(a[i][1])
a2[2*i+1][1]+=1
# ... |
s656039987 | p03472 | u415905784 | 1536032548 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 340 | N, H = map(input().split())
D = [[0, 0] for i in range(2 * N)]
for i in range(N):
a, b = map(int, input().split())
D[2 * i] = [a, 2]
D[2 * i + 1] = [b, 1]
D.sort(reverse=True)
cnt = 0
while H > 0:
d = D[0]
D = D[1:]
if d[1] == 1:
H -= d[0]
cnt += 1
else:
k = -(-H // d[0])
H -= d[0] * k
... |
s515628229 | p03472 | u102126195 | 1534606778 | Python | Python (3.4.3) | py | Runtime Error | 343 | 11316 | 476 | 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.sort()
A = max(a)
i = int(N / 2 + 0.5) - 1
while True:
#print(i)
if A <= min(b):
break
if b[i] >= A:
break
if b[i] < A:
i = i + int(i / 2) + 1... |
s277532481 | p03472 | u102126195 | 1534606695 | Python | Python (3.4.3) | py | Runtime Error | 337 | 11296 | 475 | 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.sort()
A = max(a)
i = int(N / 2 + 0.5) - 1
while True:
print(i)
if A <= min(b):
break
if b[i] >= A:
break
if b[i] < A:
i = i + int(i / 2) + 1
... |
s691666031 | p03472 | u427344224 | 1534446101 | Python | Python (3.4.3) | py | Runtime Error | 387 | 11296 | 440 | N, H = map(int, input().split())
a_list = []
b_list = []
for i in range(N):
a, b = map(int, input().split())
a_list.append(a)
b_list.append(b)
count = 0
a = max(a_list)
b_list.sort()
while len(b_list) >= 1 or H >= 1:
if b_list[-1] >= a:
b = b_list.pop(-1)
H -= b
count += 1
el... |
s146627062 | p03472 | u631277801 | 1534248616 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 745 | from itertools import accumulate
from bisect import bisect_left
from math import ceil
file = open("ABC085D.txt","r")
N,H = map(int, file.readline().split())
A = []
B = []
for _ in range(N):
a, b = map(int, file.readline().split())
A.append(a)
B.append(b)
# 最も強いaを探す
a_max = max(A)
# それ以上のbを探す
b_stron... |
s209831410 | p03472 | u062147869 | 1528667460 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 573 | from bisect import bisect_right,bisect_left
import sys
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.sort()
ama=max(A)
x = bisect_right(B,ama)
ans = 0
if x ==N:
if H%ama ==0:
ans += H//ama
else:
ans += H//ama... |
s723089128 | p03472 | u634493411 | 1527045677 | Python | PyPy3 (2.4.0) | py | Runtime Error | 857 | 79396 | 670 | # https://abc085.contest.atcoder.jp/tasks/abc085_d
from math import ceil
from operator import itemgetter
from itertools import chain, takewhile
def trans(lst):
return ((int(lst[0]), False), (int(lst[1]), True))
def main():
a,b = map(int, input().split())
data = list(chain.from_iterable([trans(input().spl... |
s960631818 | p03472 | u634493411 | 1527045126 | Python | PyPy3 (2.4.0) | py | Runtime Error | 897 | 79396 | 674 | # https://abc085.contest.atcoder.jp/tasks/abc085_d
from math import ceil
from operator import itemgetter
from itertools import chain, takewhile
def trans(lst):
return ((int(lst[0]), False), (int(lst[1]), True))
def main():
a,b = map(int, input().split())
data = list(chain.from_iterable([trans(input().spl... |
s793701055 | p03472 | u634493411 | 1527045052 | Python | PyPy3 (2.4.0) | py | Runtime Error | 792 | 79396 | 670 | # https://abc085.contest.atcoder.jp/tasks/abc085_d
from math import ceil
from operator import itemgetter
from itertools import chain, takewhile
def trans(lst):
return ((int(lst[0]), False), (int(lst[1]), True))
def main():
a,b = map(int, input().split())
data = list(chain.from_iterable([trans(input().spl... |
s828420233 | p03472 | u109617871 | 1527035565 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 319 | N, H = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(N)]
A = [i[0] for i in AB].sort()
B = [i[1] for i in AB].sort()
count= 0
while len(B) > 0:
damage = B.pop()
H -= damage
count += 1
if H <= 0:
print(count)
return
count += round(H/A[-1])
print(count)
|
s766553034 | p03472 | u635272634 | 1522010151 | Python | Python (3.4.3) | py | Runtime Error | 400 | 7868 | 311 | import math
N, H = list(map(int, input().split()))
maxA = 0
n = 0
b = []
for _ in range(N):
ta, tb = list(map(int, input().split()))
maxA = max(maxA, ta)
b.append(tb)
b = list(filter(lambda x: x > maxA, b))
b.sort()
while H > 0 and b:
H -= b.pop()
n += 1
print(n + max(H-1, -1) // a + 1 ) |
s512260506 | p03472 | u635272634 | 1522003514 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 11020 | 385 | import math
N, H = list(map(int, input().split()))
a = []
b = []
for _ in range(N):
ta, tb = list(map(int, input().split()))
a.append(ta)
b.append(tb)
b = list(filter(lambda x: x > max(a), b))
b.sort()
slashNum = math.ceil( (H - sum(b)) / max(a) )
dmg = slashNum * max(a)
for i in range(N):
dmg += b[-i... |
s123582012 | p03472 | u635272634 | 1522003372 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 11036 | 396 | import math
N, H = list(map(int, input().split()))
a = []
b = []
for _ in range(N):
ta, tb = list(map(int, input().split()))
a.append(ta)
b.append(tb)
b = list(filter(lambda x: x > max(a), b))
b.sort()
b.reverse()
slashNum = math.ceil( (H - sum(b)) / max(a) )
dmg = slashNum * max(a)
for i in range(N):
... |
s207151578 | p03472 | u635272634 | 1522003092 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 11084 | 395 | import math
N, H = list(map(int, input().split()))
a = []
b = []
for _ in range(N):
ta, tb = list(map(int, input().split()))
a.append(ta)
b.append(tb)
b = list(filter(lambda x: x > max(a), b))
b.sort()
b.reverse()
slashNum = math.ceil( (H - sum(b)) / max(a) )
dmg = slashNum * max(a)
for i in range(N):
... |
s631983270 | p03472 | u729707098 | 1521254138 | Python | Python (3.4.3) | py | Runtime Error | 355 | 22680 | 336 | n,h = (int(i) for i in input().split())
x = [[int(i) for i in input().split()] for i in range(n)]
a,b = 0,[]
for j in x:
if a < j[0]: a = j[0]
b.append(j[1])
b = [i for i in b if i>a]
b.sort().reverse()
if h <= sum(b):
num,i = 0,0
while h > 0:
h -= b[i]
num += 1
i += 1
else:
h -= sum(b)
num = (h+a-1)//a + l... |
s758818304 | p03472 | u729707098 | 1521253712 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3188 | 353 | n,h = (int(i) for i in input().split())
x = [[int(i) for i in input().split()] for i in range(n)]
a,b = 0,[]
for j in x:
if a < j[0]: a = j[0]
b.append(j[1])
num = 0
b.sort().reverse()
for j2 in b:
if j2 >=a and h>0:
h -= j2
num +=1
else: break
if h<=0: print(num)
else:
if h%a==0: print((h-h%a)//a + num)
... |
s251768139 | p03472 | u729707098 | 1521253460 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 340 | n,h = (int(i) for i in input().split())
x = [[int(i) for i in input().split()] for i in range(n)]
a,b = 0,[]
for j in x:
if a < j[0]: a = j[0]
b.append(j[1])
num = 0
for j2 in b:
if j2 >= a and h>0:
h -= j2
num +=1
if h<=0: print(num)
else:
if h%a==0: answer = (h-h%a)//a + num
else: answer = (h-h%a)//a + num +... |
s419182298 | p03472 | u729707098 | 1521252646 | Python | Python (3.4.3) | py | Runtime Error | 2106 | 22808 | 298 | n,h = (int(i) for i in input().split())
x = [[int(i) for i in input().split()] for i in range(n)]
a,b = 0,[]
for j in x:
if j[0] > a: a = j[0]
b.append(j[1])
b.sort()
while b[0]<=a: b = b[1:]
h -= sum(b)
if h%a==0: answer = (h-h%a)//a + len(b)
else: answer = (h-h%a)//a + len(b) + 1
print(answer) |
s007123533 | p03472 | u873538240 | 1520018495 | Python | Python (3.4.3) | py | Runtime Error | 388 | 29336 | 542 | N, H = tuple(map(int, input().split(' ')))
katanas = [list(map(int, input().split(' '))) for _ in range(0, N)]
normaldmbs = list(map(lambda x: x[0], katanas))
max_normal_dmg = max(normaldmbs)
throwables = list(map(lambda x: x[1], filter(lambda x: x[1] > max_normal_dmg, katanas)))
throwables.sort().reverse()
cnt = 0
... |
s435658181 | p03472 | u435281580 | 1519349119 | Python | Python (3.4.3) | py | Runtime Error | 687 | 59380 | 539 | import numpy as np
def katana(hp, katanas):
katanas = np.array(katanas, 'i')
max_slash = np.max(katanas[:, 0])
throws = -np.sort(-katanas[:, 1])
throws_index = np.where(throws > max_slash)[0]
eff_throws = throws[throws_index]
for i, v in enumerate(eff_throws):
hp -= v
if hp <= ... |
s002012720 | p03472 | u636267225 | 1517526810 | Python | Python (3.4.3) | py | Runtime Error | 2105 | 29320 | 674 | N,H = map(int,input().split())
D_total = 0
counter = 0
th_total = 0
Damage = [list(map(int,input().split())) for i in range(N)]
Damage_sh = [Damage[i][0] for i in range(N)]
Damage_th = [Damage[i][1] for i in range(N)]
Damage_sh.sort()
Damage_th.sort()
sh_max = Damage_sh[N-1]
while Damage_th[0] <= sh_max:
del Dam... |
s059833425 | p03472 | u140251125 | 1516423547 | Python | Python (3.4.3) | py | Runtime Error | 2110 | 38464 | 1023 | import math
import numpy as np
from operator import mul
# 整数Nを桁ごとのリストにする
# l = [int(x) for x in list(str(N))]
# リストliから重複を削除したリストli_uniqを作成
#li_uniq = []
#for i in li:
# if x not in li_uniq:
# li_uniq.append(x)
# 複数行のinput - list版
#list = [list(map(int, input().split())) for i in range(N)]
# 複数行のinput - di... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.