Submission #3010252


Source Code Expand

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key
typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef long double ld; 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;

ll X[100011];

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	int n,p;
	cin>>n>>p;
	ll sum=0;
	for(int i=0;i<n;i++)
	{
		ll w,b; cin>>w>>b;
		sum+=-ll(p)*b;
		X[i]=ll(p)*b+ll(100-p)*w;
	}
	sort(X,X+n);
	reverse(X,X+n);
	for(int i=0;i<n;i++)
	{
		sum+=X[i];
		if(sum>=0)
		{
			cout<<i+1<<'\n';
			return 0;
		}
	}
}	

Submission Info

Submission Time
Task E - White and Blue
User fxt
Language C++ (GCC 5.4.1)
Score 100
Code Size 950 Byte
Status AC
Exec Time 22 ms
Memory 1024 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 100 / 100
Status
AC × 3
AC × 23
Set Name Test Cases
Sample a01, a02, a03
All a01, a02, a03, b04, b05, b06, b07, b08, b09, b10, b11, b12, b13, b14, b15, b16, b17, b18, b19, b20, b21, b22, b23
Case Name Status Exec Time Memory
a01 AC 1 ms 256 KB
a02 AC 1 ms 256 KB
a03 AC 1 ms 256 KB
b04 AC 1 ms 256 KB
b05 AC 22 ms 1024 KB
b06 AC 22 ms 1024 KB
b07 AC 21 ms 1024 KB
b08 AC 21 ms 1024 KB
b09 AC 21 ms 1024 KB
b10 AC 21 ms 1024 KB
b11 AC 21 ms 1024 KB
b12 AC 13 ms 1024 KB
b13 AC 18 ms 1024 KB
b14 AC 18 ms 1024 KB
b15 AC 21 ms 1024 KB
b16 AC 18 ms 1024 KB
b17 AC 20 ms 1024 KB
b18 AC 18 ms 1024 KB
b19 AC 20 ms 1024 KB
b20 AC 21 ms 1024 KB
b21 AC 21 ms 1024 KB
b22 AC 21 ms 1024 KB
b23 AC 21 ms 1024 KB