Submission #619335

#TimeUsernameProblemLanguageResultExecution timeMemory
619335aminTeams (IOI15_teams)C++14
0 / 100
4070 ms12992 KiB
#include "teams.h" #include<bits/stdc++.h> using namespace std; vector<pair<long,long> >v; vector<pair<long,long> >vv; long p[200000]; long o[200002]; void init(int N, int A[], int B[]) { for(long i=0;i<N;i++) { vv.push_back({A[i],B[i]}); o[B[i]]--; vv.push_back({B[i],1000000000}); } } int can(int M, int K[]) { v=vv; for(long i=0;i<200000;i++) { p[i]=o[i]; } for(long i=0;i<M;i++) { v.push_back({K[i],999999999}); } sort(v.begin(),v.end()); long c=0; priority_queue<long>pq; for(long i=0;i<v.size();i++) { if(v[i].second==999999999) { // cout<<c<<' '; c-=v[i].first; // cout<<c<<endl; if(c<0) { return 0; } for(long y=0;y<v[i].first;y++) { p[-pq.top()]++; pq.pop(); } }else if(v[i].second==1000000000) { c-=p[v[i].first]; }else { pq.push(-v[i].second); c++; } } return 1; }

Compilation message (stderr)

teams.cpp: In function 'int can(int, int*)':
teams.cpp:33:16: warning: comparison of integer expressions of different signedness: 'long int' and 'std::vector<std::pair<long int, long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   33 |  for(long i=0;i<v.size();i++)
      |               ~^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...