Submission #73031

#TimeUsernameProblemLanguageResultExecution timeMemory
73031MKopchevTeams (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 call(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 i=1;i<=p;i++) 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 call(int, int*)':
teams.cpp:27:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         if(q.size()<p)return 0;
            ~~~~~~~~^~
teams.cpp:28:17: warning: declaration of 'i' shadows a previous local [-Wshadow]
         for(int i=1;i<=p;i++)
                 ^
teams.cpp:19:13: note: shadowed declaration is here
     for(int i=0;i<m;i++)
             ^
/tmp/ccKHxYBb.o: In function `main':
grader.c:(.text.startup+0x5f6): undefined reference to `can(int, int*)'
collect2: error: ld returned 1 exit status