Submission #1949353


Source Code Expand

#include <bits/stdc++.h>
#define ll long long
#define MAX 1000005
using namespace std;
ll n, m, i ,j ,k ,l, ans, tmp, res, tmp2;
ll arr[MAX], brr[MAX];
vector<ll> v;
string s;
map<ll,ll> mp;
int main()
{
	
		cin>>n>>m;
		for(i=0;i<n;i++)
			cin>>arr[i]>>brr[i];
		sort(arr,arr+n);
		sort(brr,brr+n);
		for(i=n-1;i>=0;i--)
		{
			if(brr[i]<=arr[n-1])break;
			ans+=brr[i];
			if(ans>=m)
			{
				cout<<n-i;
				return 0;
			}
		}
		i++;
		cout<<(n-i) + (m-ans+arr[n-1]-1)/arr[n-1];


return 0;
}
 

Submission Info

Submission Time
Task D - Katana Thrower
User decrypto
Language C++14 (GCC 5.4.1)
Score 400
Code Size 529 Byte
Status AC
Exec Time 88 ms
Memory 5120 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 2 ms 2304 KB
a02 AC 2 ms 2304 KB
a03 AC 2 ms 2304 KB
a04 AC 2 ms 2304 KB
b05 AC 2 ms 2304 KB
b06 AC 88 ms 5120 KB
b07 AC 2 ms 2304 KB
b08 AC 88 ms 5120 KB
b09 AC 2 ms 2304 KB
b10 AC 2 ms 2304 KB
b11 AC 2 ms 2304 KB
b12 AC 2 ms 2304 KB
b13 AC 35 ms 5120 KB
b14 AC 35 ms 5120 KB
b15 AC 38 ms 5120 KB
b16 AC 34 ms 5120 KB
b17 AC 60 ms 5120 KB
b18 AC 52 ms 5120 KB
b19 AC 44 ms 5120 KB
b20 AC 48 ms 5120 KB
b21 AC 54 ms 5120 KB
b22 AC 59 ms 5120 KB
b23 AC 2 ms 2304 KB
b24 AC 3 ms 2304 KB