Submission #832386

#TimeUsernameProblemLanguageResultExecution timeMemory
832386Valaki2Teams (IOI15_teams)C++14
0 / 100
4069 ms18948 KiB
#include "teams.h" #include <bits/stdc++.h> using namespace std; #define ll long long #define pb push_back #define mp make_pair #define pii pair<int, int> #define fi first #define se second int n; vector<pii> v; void init(int N, int A[], int B[]) { n = N; v.resize(n); for(int i = 0; i < n; i++) { v[i] = mp(A[i], B[i]); } sort(v.begin(), v.end()); } int can(int M, int K[]) { vector<int> s; for(int i = 0; i < M; i++) { s.pb(K[i]); } sort(s.begin(), s.end()); int ptr = 0; priority_queue<int> q; for(int cur : s) { while(!q.empty() && -q.top() < cur) { q.pop(); } while(ptr < n && v[ptr].fi <= cur) { q.push(-v[ptr].se); ptr++; } if(q.size() < cur) { return 0; } for(int i = 0; i < cur; i++) { q.pop(); } } return 1; }

Compilation message (stderr)

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