Submission #1949954


Source Code Expand

n, h = [int(t) for t in input().split()]
aa = []
bb = []
for _ in range(n):
    a, b = [int(t) for t in input().split()]
    aa.append(a)
    if b > a:
        bb.append(b)
aa.sort()
bb.sort()

cnt = 0
while h > 0:
    if not bb or aa[-1] >= bb[-1]:
        cnt += (h - 1) // aa[-1] + 1
        break
    else:
        h -= bb.pop()
    cnt += 1
print(cnt)

Submission Info

Submission Time
Task D - Katana Thrower
User dempacat
Language Python (3.4.3)
Score 400
Code Size 377 Byte
Status AC
Exec Time 423 ms
Memory 11352 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 400 / 400
Status
AC × 4
AC × 24
Set Name Test Cases
Sample a01, a02, a03, a04
All a01, a02, a03, a04, b05, b06, b07, b08, b09, b10, b11, b12, b13, b14, b15, b16, b17, b18, b19, b20, b21, b22, b23, b24
Case Name Status Exec Time Memory
a01 AC 17 ms 3064 KB
a02 AC 17 ms 3064 KB
a03 AC 17 ms 3060 KB
a04 AC 17 ms 3060 KB
b05 AC 17 ms 3064 KB
b06 AC 306 ms 7072 KB
b07 AC 17 ms 3064 KB
b08 AC 316 ms 7064 KB
b09 AC 17 ms 3064 KB
b10 AC 17 ms 3064 KB
b11 AC 17 ms 3064 KB
b12 AC 17 ms 3064 KB
b13 AC 346 ms 4648 KB
b14 AC 315 ms 4644 KB
b15 AC 293 ms 3880 KB
b16 AC 281 ms 3856 KB
b17 AC 397 ms 10980 KB
b18 AC 369 ms 8732 KB
b19 AC 377 ms 5092 KB
b20 AC 361 ms 5108 KB
b21 AC 398 ms 7988 KB
b22 AC 423 ms 11352 KB
b23 AC 17 ms 3060 KB
b24 AC 24 ms 3188 KB