Submission #1949793


Source Code Expand

N,H = map(int, raw_input().split())
x = [None]*(N*2)
for i in range(N):
  a,b = map(int, raw_input().split())
  x[2*i] = (a, 0)
  x[2*i+1] = (b, 1)
x = sorted(x)[::-1]
ans = 0
for t in x:
  if t[1]==0:
    print ans+(H+t[0]-1)/t[0]
    break
  H -= t[0]
  ans += 1
  if H<=0:
    print ans
    break

Submission Info

Submission Time
Task D - Katana Thrower
User kusano
Language Python (2.7.6)
Score 400
Code Size 317 Byte
Status AC
Exec Time 478 ms
Memory 29428 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 10 ms 2568 KB
a02 AC 10 ms 2568 KB
a03 AC 10 ms 2568 KB
a04 AC 10 ms 2568 KB
b05 AC 10 ms 2568 KB
b06 AC 330 ms 29044 KB
b07 AC 10 ms 2568 KB
b08 AC 322 ms 29044 KB
b09 AC 10 ms 2568 KB
b10 AC 10 ms 2568 KB
b11 AC 10 ms 2568 KB
b12 AC 10 ms 2568 KB
b13 AC 355 ms 24308 KB
b14 AC 320 ms 24308 KB
b15 AC 312 ms 24308 KB
b16 AC 323 ms 24308 KB
b17 AC 478 ms 29172 KB
b18 AC 444 ms 27508 KB
b19 AC 402 ms 24692 KB
b20 AC 387 ms 24692 KB
b21 AC 465 ms 26868 KB
b22 AC 472 ms 29428 KB
b23 AC 11 ms 2568 KB
b24 AC 19 ms 3076 KB