Submission #1949999


Source Code Expand

n, h = map(int, input().split())

a = []
b = []

for i in range(n):
  x, y = map(int, input().split())
  a.append(x)
  b.append(y)

max_a = max(a)

ans = 0
for x in reversed(sorted(filter(lambda x: x >= max_a, b))):
  h -= x
  ans += 1
  if h <= 0: break

ans += max(0, (h + max_a - 1) // max_a)
print(ans)

Submission Info

Submission Time
Task D - Katana Thrower
User pekempey
Language Python (3.4.3)
Score 400
Code Size 329 Byte
Status AC
Exec Time 342 ms
Memory 12112 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 3060 KB
a02 AC 17 ms 3060 KB
a03 AC 17 ms 3060 KB
a04 AC 17 ms 3060 KB
b05 AC 17 ms 3060 KB
b06 AC 309 ms 11792 KB
b07 AC 17 ms 3060 KB
b08 AC 314 ms 11788 KB
b09 AC 18 ms 3060 KB
b10 AC 18 ms 3060 KB
b11 AC 18 ms 2940 KB
b12 AC 17 ms 3060 KB
b13 AC 319 ms 5516 KB
b14 AC 300 ms 5412 KB
b15 AC 299 ms 5540 KB
b16 AC 309 ms 5540 KB
b17 AC 307 ms 10644 KB
b18 AC 311 ms 8376 KB
b19 AC 331 ms 5848 KB
b20 AC 327 ms 5528 KB
b21 AC 342 ms 8772 KB
b22 AC 340 ms 12112 KB
b23 AC 18 ms 3060 KB
b24 AC 24 ms 3188 KB