Submission #1949469


Source Code Expand

N, H = map(int, input().split())
A = []
for _ in range(N):
    a, b = map(int, input().split())
    A.append((a, b))

A = sorted(A, key=lambda x: -x[0])
a = A[0][0]
ans = 0

A = sorted(A, key=lambda x: -x[1])
for i in range(N):
    if H <= 0:
        break
    if A[i][1] > a:
        ans += 1
        H -= A[i][1]

if H > 0:
    ans += (H + a - 1) // a

print(ans)

Submission Info

Submission Time
Task D - Katana Thrower
User odan
Language Python (3.4.3)
Score 400
Code Size 388 Byte
Status AC
Exec Time 447 ms
Memory 22052 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 3064 KB
a04 AC 17 ms 3064 KB
b05 AC 17 ms 3064 KB
b06 AC 349 ms 21276 KB
b07 AC 17 ms 3064 KB
b08 AC 343 ms 21276 KB
b09 AC 17 ms 3064 KB
b10 AC 17 ms 3064 KB
b11 AC 17 ms 3064 KB
b12 AC 17 ms 3060 KB
b13 AC 367 ms 11816 KB
b14 AC 325 ms 11816 KB
b15 AC 302 ms 11792 KB
b16 AC 318 ms 11792 KB
b17 AC 426 ms 21768 KB
b18 AC 413 ms 19444 KB
b19 AC 400 ms 15564 KB
b20 AC 384 ms 15552 KB
b21 AC 427 ms 18636 KB
b22 AC 447 ms 22052 KB
b23 AC 17 ms 3064 KB
b24 AC 25 ms 3436 KB