Submission #3236195


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 = min(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 542 Byte
Status WA
Exec Time 1203 ms
Memory 21360 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 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 1061 ms 21336 KB
b07 AC 17 ms 3064 KB
b08 AC 989 ms 21360 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 955 ms 14204 KB
b14 WA 923 ms 14204 KB
b15 AC 978 ms 14284 KB
b16 AC 914 ms 14224 KB
b17 WA 1203 ms 20408 KB
b18 AC 1053 ms 18124 KB
b19 AC 1031 ms 14464 KB
b20 WA 1113 ms 14476 KB
b21 WA 1107 ms 17436 KB
b22 AC 1103 ms 20700 KB
b23 AC 17 ms 3064 KB
b24 AC 36 ms 3436 KB