Submission #640177

#TimeUsernameProblemLanguageResultExecution timeMemory
640177BenmathTeams (IOI15_teams)C++14
0 / 100
79 ms9932 KiB
#include <bits/stdc++.h> #include<teams.h> using namespace std; int n; int a[100001],b[100001]; void init(int N, int A[], int B[]) { n=N; for(int i=0;i<N;i++){ a[i]=A[i]; b[i]=B[i]; } } int can(int M, int K[]) { priority_queue<int,vector<int>,greater<int> >pq; sort(K,K+M); //cout<<pq.top()<<endl; int j=0; for(int i=0;i<M;i++){ while(!pq.empty() and pq.top()<K[i]){ pq.pop(); } while(j<n){ if(K[i]>=a[j] and K[i]<=b[j]){ pq.push(b[j]); }else if(K[i]<a[j]){ break; } j++; } int t1=0; if(pq.size()<K[i]){ //cout<<i<<endl; return 0; }else{ for(int k1=0;k1<K[i];k1++){ pq.pop(); } } } return 1; } /* int main() { int n1; cin>>n1; int a1[n1],b1[n1]; for(int i=0;i<n1;i++){ cin>>a1[i]>>b1[i]; } init(n1,a1,b1); int q; cin>>q; for(int i=0;i<q;i++){ int m; cin>>m; int k[m]; for(int j=0;j<m;j++){ cin>>k[j]; } cout<<can(m,k)<<endl; } } */

Compilation message (stderr)

teams.cpp: In function 'int can(int, int*)':
teams.cpp:34:21: warning: comparison of integer expressions of different signedness: 'std::priority_queue<int, std::vector<int>, std::greater<int> >::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   34 |         if(pq.size()<K[i]){
      |            ~~~~~~~~~^~~~~
teams.cpp:33:13: warning: unused variable 't1' [-Wunused-variable]
   33 |         int t1=0;
      |             ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...