Submission #1077304

#TimeUsernameProblemLanguageResultExecution timeMemory
1077304TrumlingTeams (IOI15_teams)C++14
21 / 100
4066 ms27184 KiB
#include "teams.h" #include<bits/stdc++.h> using namespace std; #define F first #define S second #define pb push_back #define INF 99999999999999 #define all(x) x.begin(),x.end() typedef long long ll; ll n; vector<ll>a; vector<ll>b; void init(int N, int A[], int B[]) { n=N; for(int i=0;i<n;i++) { a.pb(A[i]); b.pb(B[i]); } } int can(int M, int K[]) { vector<bool>vis(n,0); sort(K,K+M); bool tf=1; for(int j=0;j<M;j++) { priority_queue<pair<ll,ll> >pq; for(int i=0;i<n;i++) if(!vis[i]) if(K[j]>=a[i] && K[j]<=b[i]) pq.push({-b[i],i}); if(pq.size()<K[j]) { tf=0; break; } for(int i=0;i<K[j];i++) { vis[pq.top().S]=1; pq.pop(); } } return tf; }

Compilation message (stderr)

teams.cpp: In function 'int can(int, int*)':
teams.cpp:42:16: warning: comparison of integer expressions of different signedness: 'std::priority_queue<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   42 |    if(pq.size()<K[j])
      |       ~~~~~~~~~^~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...