Submission #2136299


Source Code Expand

#include <iostream>
#include <string>
#include <vector>
#include <climits>
#include <iomanip>
#include <algorithm>
#include <tuple>
#include <queue>
#include <set>
#include <math.h>
#include <array>
#include <list>
#include <set>
#define MOD 1000000007
#define INF 1000000000
using namespace std;
typedef long long ll;
typedef pair <ll,ll> pa;
typedef tuple<ll,int,int> tup;
typedef vector<pa> vp;
typedef vector<int> vi;
typedef vector<ll> vl;
set <int> st;
vector<int> videos(105);
double now=0;
queue<int> num;
ll n,p;
ll white=0,blue=0,white2=0,blue2=0;
vp member(100005);
vp member2(100005);
int main(int argc,char const* argv[])
{
  cin >> n >> p;
  int ans=n,ans2=1;
  member.resize(n);
  member2.resize(n);
  for(int i=0;i<n;i++)
    {
      cin >> member[i].first >> member[i].second;
      member2[i].first=member[i].second;
      member2[i].second=member[i].first;
      white+=member[i].first;
      blue2+=member[i].second;
    }
  sort(member.begin(),member.end());
  sort(member2.begin(),member2.end());
  for(int i=0;i<n;i++)
    {
      white-=member[i].first;
      blue+=member[i].second;
      //cout << white << ' ' << blue << endl;
      if((100-p)*white-p*blue>=0)
	{
	  ans--;
	}
    }
  for(int i=n-1;i>=0;i--)
    {
      blue2-=member2[i].first;
      white2+=member2[i].second;
      if((100-p)*white2-p*blue2<0)
	{
	  ans2++;
	}
    }
  cout << min(ans,ans2) << endl;
  return 0;
}

Submission Info

Submission Time
Task E - White and Blue
User Tendaysago
Language C++14 (GCC 5.4.1)
Score 0
Code Size 1479 Byte
Status WA
Exec Time 98 ms
Memory 3328 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 100
Status
AC × 3
AC × 18
WA × 5
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 3 ms 3328 KB
a02 AC 3 ms 3328 KB
a03 AC 3 ms 3328 KB
b04 AC 3 ms 3328 KB
b05 AC 91 ms 3328 KB
b06 AC 91 ms 3328 KB
b07 AC 83 ms 3328 KB
b08 AC 84 ms 3328 KB
b09 AC 84 ms 3328 KB
b10 AC 84 ms 3328 KB
b11 AC 84 ms 3328 KB
b12 AC 37 ms 3328 KB
b13 AC 65 ms 3328 KB
b14 AC 64 ms 3328 KB
b15 AC 80 ms 3328 KB
b16 AC 73 ms 3328 KB
b17 WA 89 ms 3328 KB
b18 AC 74 ms 3328 KB
b19 AC 87 ms 3328 KB
b20 WA 93 ms 3328 KB
b21 WA 94 ms 3328 KB
b22 WA 98 ms 3328 KB
b23 WA 92 ms 3328 KB