Submission #73032

#TimeUsernameProblemLanguageResultExecution timeMemory
73032MKopchevTeams (IOI15_teams)C++14
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> #include "teams.h" using namespace std; int n; vector< pair<int,int> > inp; void init(int N,int A[],int B[]) { n=N; for(int i=0;i<N;i++) inp.push_back({A[i],B[i]}); sort(inp.begin(),inp.end()); } priority_queue<int> q,idle; bool can(int m,int k[]) { q=idle; sort(k,k+m); int pos=0; for(int i=0;i<m;i++) { int p=k[i]; while(pos<n&& inp[pos].first<=p) {q.push(-inp[pos].second);pos++;} while(q.size()&&-q.top()<p)q.pop(); //cout<<p<<" -> "<<q.size()<<endl; if(q.size()<p)return 0; for(int j=1;j<=p;j++) q.pop(); } return 1; } /* int main() { init(4,[1,2,2,2],[2,3,3,4]); cout<<call(2,[1,3])<<endl; cout<<call(2,[1,1])<<endl; } */

Compilation message (stderr)

teams.cpp: In function 'bool can(int, int*)':
teams.cpp:14:6: error: ambiguating new declaration of 'bool can(int, int*)'
 bool can(int m,int k[])
      ^~~
In file included from teams.cpp:2:0:
teams.h:5:5: note: old declaration 'int can(int, int*)'
 int can(int M, int K[]);
     ^~~
teams.cpp:27:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         if(q.size()<p)return 0;
            ~~~~~~~~^~