Submission #1950567


Source Code Expand

// D.

#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>

using namespace std;

int main(int argc, char *argv[]) {
	int n, h;
	cin >> n >> h;
	vector<int> a(n), b(n);
	for (int i = 0; i < n; ++i) {
		cin >> a[i] >> b[i];
	}
	sort(a.rbegin(), a.rend());
	sort(b.rbegin(), b.rend());
	int d = a[0];
	int ans = 0, tot = 0;
	for (int i = 0; i < n; ++i) {
		if (b[i] > d) {
			++ans;
			tot += b[i];
			if (tot >= h) {
				break;
			}
		}
	}
	ans += (max(0, h - tot) + d - 1) / d;
	cout << ans << endl;
	return 0;
}

Submission Info

Submission Time
Task D - Katana Thrower
User hotpepsi
Language C++14 (GCC 5.4.1)
Score 400
Code Size 571 Byte
Status AC
Exec Time 90 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 90 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 AC 36 ms 1024 KB
b15 AC 35 ms 1024 KB
b16 AC 35 ms 1024 KB
b17 AC 61 ms 1024 KB
b18 AC 52 ms 1024 KB
b19 AC 44 ms 1024 KB
b20 AC 49 ms 1024 KB
b21 AC 55 ms 1024 KB
b22 AC 60 ms 1024 KB
b23 AC 1 ms 256 KB
b24 AC 3 ms 256 KB