Submission #134750

#TimeUsernameProblemLanguageResultExecution timeMemory
134750BoxworldTeams (IOI15_teams)C++14
Compilation error
0 ms0 KiB
#include "teams.h" #include <bits/stdc++.h> using namespace std; typedef pair<int,int> P; struct S{int l,r;}a[500100]; priority_queue<P,vector<P>,greater<P> >Q; int n; void init(int N, int A[], int B[]){ n=N; for (int i=0;i<N;i++)a[i].l=A[i],a[i].r=B[i]; } int can(int M, int K[]){ while(!Q.empty())Q.pop(); sort(K,K+M); for (int i=0;i<n;i++){ if (a[i].l<K[0]){ if(K[0]<=a[i].r)Q.push(K[0],a[i].r); }else Q.push(make_pair(a[i].l,a[i].r)); } for (int i=0;i<M;i++){ if (Q.empty())return 0; if (Q.size()<K[i])return 0; for (int j=0;j<K[i];j++){ P x=Q.top(); Q.pop(); if (x.first<=K[i]&&K[i]<=x.second)continue; else return 0; } if (i==M-1)return 1; if (Q.empty())return 0; while(Q.top().first<K[i+1]){ P x=Q.top(); Q.pop(); if (K[i+1]<=x.second)Q.push(make_pair(K[i+1],x.second)); if (Q.empty())return 0; } } return 1; }

Compilation message (stderr)

teams.cpp: In function 'int can(int, int*)':
teams.cpp:17:38: error: no matching function for call to 'std::priority_queue<std::pair<int, int>, std::vector<std::pair<int, int> >, std::greater<std::pair<int, int> > >::push(int&, int&)'
    if(K[0]<=a[i].r)Q.push(K[0],a[i].r);
                                      ^
In file included from /usr/include/c++/7/queue:64:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:86,
                 from teams.cpp:2:
/usr/include/c++/7/bits/stl_queue.h:595:7: note: candidate: void std::priority_queue<_Tp, _Sequence, _Compare>::push(const value_type&) [with _Tp = std::pair<int, int>; _Sequence = std::vector<std::pair<int, int> >; _Compare = std::greater<std::pair<int, int> >; std::priority_queue<_Tp, _Sequence, _Compare>::value_type = std::pair<int, int>]
       push(const value_type& __x)
       ^~~~
/usr/include/c++/7/bits/stl_queue.h:595:7: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/7/bits/stl_queue.h:603:7: note: candidate: void std::priority_queue<_Tp, _Sequence, _Compare>::push(std::priority_queue<_Tp, _Sequence, _Compare>::value_type&&) [with _Tp = std::pair<int, int>; _Sequence = std::vector<std::pair<int, int> >; _Compare = std::greater<std::pair<int, int> >; std::priority_queue<_Tp, _Sequence, _Compare>::value_type = std::pair<int, int>]
       push(value_type&& __x)
       ^~~~
/usr/include/c++/7/bits/stl_queue.h:603:7: note:   candidate expects 1 argument, 2 provided
teams.cpp:22:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         if (Q.size()<K[i])return 0;
             ~~~~~~~~^~~~~