Submission #912411

#TimeUsernameProblemLanguageResultExecution timeMemory
912411JakobZorzTeams (IOI15_teams)C++17
34 / 100
4094 ms38608 KiB
#include"teams.h" #include<iostream> #include<vector> #include<algorithm> #include<set> using namespace std; typedef long long ll; int n; int a[500000]; int b[500000]; void init(int N,int A[],int B[]){ n=N; vector<pair<int,int>>vec(n); for(int i=0;i<n;i++) vec[i]={A[i],B[i]}; sort(vec.begin(),vec.end()); for(int i=0;i<n;i++){ a[i]=vec[i].first; b[i]=vec[i].second; } } int can(int m,int k[]){ multiset<int>s; sort(k,k+m); int ci=0; for(int i=0;i<m;i++){ while(ci<n&&a[ci]<=k[i]) s.insert(b[ci++]); while(s.size()&&*s.begin()<k[i]) s.erase(s.begin()); for(int j=0;j<k[i];j++){ if(s.empty()) return 0; s.erase(s.begin()); } } return 1; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...