Submission #3236178


Source Code Expand

import math

n, h = map(int, input().split())
ba = [tuple(map(int, reversed(input().split()))) for i in range(n)]
ba.sort(reverse = True)

ans = 2000000000

bs = [0]
for i in range(n):
    bs.append(bs[i] + ba[i][0])
    if bs[i + 1] >= h:
        ans = i + 1


for i in range(n):
    b, a = ba[i]

    L = i
    R = n
    while (R - L > 1):
        M = (L + R) // 2
        if ba[M][0] < a:
            R = M
        else:
            L = M
    ans = min(ans, R + math.ceil((h - bs[R]) / a))

print(ans)

Submission Info

Submission Time
Task D - Katana Thrower
User shirodoni
Language Python (3.4.3)
Score 0
Code Size 532 Byte
Status WA
Exec Time 1136 ms
Memory 21364 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 400
Status
AC × 4
AC × 20
WA × 4
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 18 ms 3064 KB
a02 AC 18 ms 3064 KB
a03 AC 17 ms 3064 KB
a04 AC 17 ms 3064 KB
b05 AC 17 ms 3064 KB
b06 AC 1047 ms 21364 KB
b07 AC 17 ms 3064 KB
b08 AC 940 ms 21364 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 913 ms 14200 KB
b14 WA 997 ms 14204 KB
b15 AC 1034 ms 14204 KB
b16 AC 983 ms 14204 KB
b17 WA 1136 ms 20440 KB
b18 AC 1110 ms 18136 KB
b19 AC 1017 ms 14384 KB
b20 WA 1049 ms 14504 KB
b21 WA 1113 ms 17392 KB
b22 AC 1108 ms 20732 KB
b23 AC 17 ms 3064 KB
b24 AC 35 ms 3316 KB