Submission #608617

#TimeUsernameProblemLanguageResultExecution timeMemory
608617loctildoreTeams (IOI15_teams)C++14
34 / 100
4089 ms12220 KiB
#include "teams.h" #include <bits/stdc++.h> using namespace std; // trans rights #define ll long long #define f first #define s second #define endl '\n' #define all(x) begin(x), end(x) int n; vector<pair<int,int>> vctr; void init(int N, int A[], int B[]) { n=N; for (int i = 0; i < n; i++) { vctr.push_back({A[i],B[i]}); } sort(all(vctr)); } priority_queue<int,vector<int>,greater<int>> pq; int can(int M, int K[]) { int cur=0; sort(K,K+M); while (pq.size()) { pq.pop(); } for (int i = 0; i < M; i++) { while (cur<n&&vctr[cur].f<=K[i]) { pq.push(vctr[cur++].s); } while (pq.size()&&pq.top()<K[i]) { pq.pop(); } if (pq.size()<K[i]) { return 0; } for (int j = 0; j < K[i]; j++) { pq.pop(); } } return 1; }

Compilation message (stderr)

teams.cpp: In function 'int can(int, int*)':
teams.cpp:34: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 'int' [-Wsign-compare]
   34 |   if (pq.size()<K[i]) {
      |       ~~~~~~~~~^~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...