Submission #769018

#TimeUsernameProblemLanguageResultExecution timeMemory
769018boyliguanhanTeams (IOI15_teams)C++17
34 / 100
4100 ms23016 KiB
#include "teams.h" #include <bits/stdc++.h> using namespace std; pair<int, int> people[600000]; int n; void init(int N, int A[], int B[]) { n=N; for(int i = 0; i < n; i++) people[i]={A[i], B[i]}; sort(people,people+N); } int can(int M, int K[]) { sort(K,K+M); priority_queue<pair<int, int>,vector<pair<int, int>>,greater<pair<int, int>>>q; int cur=0; for(int i = 0; i < M; i++){ int x=K[i]; while(cur<n&&people[cur].first<=x) q.push({people[cur].second,people[cur].first}),cur++; while(!q.empty()&&q.top().first<x)q.pop(); if(q.size()<x)return 0; while(x--) q.pop(); } return 1; }

Compilation message (stderr)

teams.cpp: In function 'int can(int, int*)':
teams.cpp:21:14: warning: comparison of integer expressions of different signedness: 'std::priority_queue<std::pair<int, int>, std::vector<std::pair<int, int> >, std::greater<std::pair<int, int> > >::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   21 |   if(q.size()<x)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...