Submission #1028467

#TimeUsernameProblemLanguageResultExecution timeMemory
1028467pccTeams (IOI15_teams)C++17
34 / 100
4054 ms16808 KiB
#include "teams.h" #include <bits/stdc++.h> using namespace std; #define fs first #define sc second #define pii pair<int,int> const int mxn = 1e5+10; pii arr[mxn]; int N; void init(int NN, int A[], int B[]) { N = NN; for(int i = 0;i<N;i++)arr[i] = pii(A[i],B[i]); return; } int can(int M, int K[]) { vector<pii> op; for(int i = 0;i<N;i++){ op.push_back(pii(arr[i].fs,arr[i].sc)); } priority_queue<int,vector<int>,greater<int>> pq; for(int i = 0;i<M;i++)op.push_back(pii(K[i],N+1)); sort(op.begin(),op.end()); for(auto [l,r]:op){ while(!pq.empty()&&pq.top()<l)pq.pop(); if(r<=N)pq.push(r); else{ if(pq.size()<l)return 0; while(l--)pq.pop(); } } return 1; }

Compilation message (stderr)

teams.cpp: In function 'int can(int, int*)':
teams.cpp:32:16: 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 'std::tuple_element<0, std::pair<int, int> >::type' {aka 'int'} [-Wsign-compare]
   32 |    if(pq.size()<l)return 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...