Submission #1947979


Source Code Expand

#include <bits/stdc++.h>

using namespace std;

using int64 = long long;
const int64 LINF = 1LL << 61;
const int INF = 1 << 30;

int main()
{
  int N, H;
  cin >> N >> H;
  // 多分 a_i が最大の刀だけ振りそう
  vector< int > mp(N);
  int mx = 0;
  for(auto &p : mp) {
    int a;
    cin >> a >> p;
    mx = max(mx, a);
  }
  sort(begin(mp), end(mp));

  int64 sum = 0;
  int64 ret = LINF;
  for(int i = N; i >= 0; i--) {
    if(i != N) sum += mp[i];
    ret = min(ret, (N - i) + (max(0LL, H - sum) + mx - 1) / mx);
  }

  cout << ret << endl;
}

Submission Info

Submission Time
Task D - Katana Thrower
User ei13333
Language C++14 (GCC 5.4.1)
Score 400
Code Size 586 Byte
Status AC
Exec Time 89 ms
Memory 640 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 89 ms 640 KB
b07 AC 1 ms 256 KB
b08 AC 89 ms 640 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 34 ms 640 KB
b14 AC 35 ms 640 KB
b15 AC 35 ms 640 KB
b16 AC 35 ms 640 KB
b17 AC 56 ms 640 KB
b18 AC 49 ms 640 KB
b19 AC 41 ms 640 KB
b20 AC 46 ms 640 KB
b21 AC 53 ms 640 KB
b22 AC 55 ms 640 KB
b23 AC 1 ms 256 KB
b24 AC 3 ms 256 KB