Submission #2760227


Source Code Expand

#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>

int main() {
  int N, H;
  std::cin >> N >> H;

  std::vector<int> A(N), B(N);

  for (int i = 0; i < N; i++) {
    std::cin >> A[i] >> B[i];
  }

  std::sort(A.begin(), A.end(), std::greater<int>());
  std::sort(B.begin(), B.end(), std::greater<int>());

  int h = 0, times = 0;



  for (auto b : B) {
    if (b > A[0]) {
      h += b;
      times++;

      if (h >= H) {
        break;
      }
    }
  }

  if (h < H) {
    times += (H - h + A[0] - 1) / A[0];
  }

  std::cout << times << std::endl;
}

Submission Info

Submission Time
Task D - Katana Thrower
User karszawa
Language C++14 (Clang 3.8.0)
Score 400
Code Size 621 Byte
Status AC
Exec Time 219 ms
Memory 1024 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 1 ms 256 KB
a02 AC 1 ms 256 KB
a03 AC 1 ms 256 KB
a04 AC 1 ms 256 KB
b05 AC 1 ms 256 KB
b06 AC 219 ms 1024 KB
b07 AC 1 ms 256 KB
b08 AC 219 ms 1024 KB
b09 AC 1 ms 256 KB
b10 AC 1 ms 256 KB
b11 AC 1 ms 256 KB
b12 AC 1 ms 256 KB
b13 AC 92 ms 1024 KB
b14 AC 92 ms 1024 KB
b15 AC 91 ms 1024 KB
b16 AC 93 ms 1024 KB
b17 AC 152 ms 1024 KB
b18 AC 130 ms 1024 KB
b19 AC 112 ms 1024 KB
b20 AC 123 ms 1024 KB
b21 AC 135 ms 1024 KB
b22 AC 149 ms 1024 KB
b23 AC 1 ms 256 KB
b24 AC 5 ms 256 KB