Submission #3045702


Source Code Expand

#include <bits/stdc++.h>

#define rep(i,n) for(long long int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(long long int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(long long int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define pb(q) push_back(q)
#define Abs(a,b) max(a,b)-min(a,b)
#define YES(condition) if(condition){cout << "YES" << endl;}else{cout << "NO" << endl;}
#define Yes(condition) if(condition){cout << "Yes" << endl;}else{cout << "No" << endl;}
#define Cout(x) cout<<(x)<<endl
#define POSSIBLE(condition) if(condition){cout << "POSSIBLE" << endl;}else{cout << "IMPOSSIBLE" << endl;}
#define Possible(condition) if(condition){cout << "Possible" << endl;}else{cout << "Impossible" << endl;}
#define possible(condition) if(condition){cout << "possible" << endl;}else{cout << "impossible" << endl;}
#define Size(n) (n).size()

typedef long long ll;


using namespace std;

const int INF = 1e9,MOD = 1e9 + 7,ohara = 1e6;
const ll LINF = 1e18;


long long int n,cnt=0,ans=0,a[ohara],b[ohara],c,d,cmp,cmpp,m,h,w,x,y,sum[ohara],pos,pp,btotal;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl=true;
struct edge{int to,cost;};

//-------------------------↓↓↓↓↓↓------------------------

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

      
      cin>>n>>pp;
      pair<ll,ll> p[ohara];
      rep(i,n){
        cin>>a[i]>>b[i];
        btotal-=b[i]*pp;
        p[i]=make_pair((100-pp)*a[i]+pp*b[i],i);
      }
      sort(p,p+n);
      reverse(p,p+n);
      ll san=0,han=btotal,total;
      rep(i,n){
       btotal+=p[i].first;
        ans++;
        if(btotal>=0)break;
      }
      Cout(ans);
     

       
return 0;
}

Submission Info

Submission Time
Task E - White and Blue
User asdf1
Language C++14 (GCC 5.4.1)
Score 100
Code Size 1782 Byte
Status AC
Exec Time 32 ms
Memory 24064 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 6 ms 19968 KB
a02 AC 6 ms 19968 KB
a03 AC 6 ms 19968 KB
b04 AC 6 ms 19968 KB
b05 AC 29 ms 24064 KB
b06 AC 29 ms 24064 KB
b07 AC 28 ms 24064 KB
b08 AC 27 ms 24064 KB
b09 AC 27 ms 24064 KB
b10 AC 27 ms 24064 KB
b11 AC 27 ms 24064 KB
b12 AC 19 ms 24064 KB
b13 AC 25 ms 24064 KB
b14 AC 25 ms 24064 KB
b15 AC 32 ms 24064 KB
b16 AC 24 ms 24064 KB
b17 AC 26 ms 24064 KB
b18 AC 24 ms 24064 KB
b19 AC 27 ms 24064 KB
b20 AC 27 ms 24064 KB
b21 AC 28 ms 24064 KB
b22 AC 27 ms 24064 KB
b23 AC 28 ms 24064 KB