Submission #7027979


Source Code Expand

#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
using namespace std;
using ll = long long;

int main(){
    int n, h;
    cin >> n >> h;
    vector<int> a(n), b(n);
    rep(i, n) cin >> a[i] >> b[i];

    sort(rall(a));
    sort(rall(b));

    int maxv = a[0];

    int ans = 0;
    rep(i, n){
        if(h < 0 || maxv > b[i]) break;
        h -= b[i];
        ans++;
    }

    if(h > 0) ans += h/maxv + (h%maxv != 0);

    cout << ans << endl;
}

Submission Info

Submission Time
Task D - Katana Thrower
User Noiri
Language C++14 (GCC 5.4.1)
Score 0
Code Size 648 Byte
Status WA
Exec Time 89 ms
Memory 1024 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 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 WA 89 ms 1024 KB
b07 AC 1 ms 256 KB
b08 AC 89 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 35 ms 1024 KB
b14 WA 34 ms 1024 KB
b15 WA 34 ms 1024 KB
b16 AC 37 ms 1024 KB
b17 AC 60 ms 1024 KB
b18 AC 53 ms 1024 KB
b19 AC 43 ms 1024 KB
b20 WA 48 ms 1024 KB
b21 AC 54 ms 1024 KB
b22 AC 60 ms 1024 KB
b23 AC 1 ms 256 KB
b24 AC 3 ms 256 KB