Submission #1947571


Source Code Expand

#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"

using namespace std;

const long long int MOD = 1000000007;

long long int N, M, K, H, W, L, R;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);

	cin >> N >> K;
	vector<long long int>a(N);
	vector<long long int>b(N);
	long long int max_a = 0;
	for (int i = 0; i < N; i++) {
		cin >> a[i] >> b[i];
		max_a = max(max_a, a[i]);
	}
	priority_queue<long long int>PQ;
	for (int i = 0; i < N; i++) {
		if (b[i] > max_a) {
			PQ.push(b[i]);
		}
	}
	while (K > 0 && !PQ.empty()) {
		K -= PQ.top();
		PQ.pop();
		M++;
	}
	if (K > 0) {
		M += K / max_a + !!(K%max_a);
	}
	cout << M << endl;
	return 0;
}

Submission Info

Submission Time
Task D - Katana Thrower
User olphe
Language C++14 (GCC 5.4.1)
Score 400
Code Size 936 Byte
Status AC
Exec Time 28 ms
Memory 2936 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 24 ms 1792 KB
b07 AC 1 ms 256 KB
b08 AC 22 ms 1792 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 16 ms 2936 KB
b14 AC 15 ms 2936 KB
b15 AC 12 ms 1792 KB
b16 AC 13 ms 1792 KB
b17 AC 16 ms 1792 KB
b18 AC 15 ms 1792 KB
b19 AC 22 ms 2936 KB
b20 AC 20 ms 2936 KB
b21 AC 26 ms 2936 KB
b22 AC 28 ms 2936 KB
b23 AC 1 ms 256 KB
b24 AC 2 ms 256 KB