Submission #743709

#TimeUsernameProblemLanguageResultExecution timeMemory
743709vjudge1Teams (IOI15_teams)C++17
0 / 100
690 ms524288 KiB
#include <bits/stdc++.h> using namespace std; #define endl '\n' #define ll long long #define all(x) x.begin(), x.end() int n; vector<pair<int, int>> g; void init(int N, int A[], int B[]) { n = N; for (int i = 0; i < n; i++) { g.push_back({A[i], B[i]}); } sort(all(g)); } bool can(int M, int K[]) { sort(K, K + M); priority_queue<int> pq; for (int i = 0, j = 0; i < M; i++) { while (j < n && g[j].first <= K[i]) { pq.push(-g[j].second); } while (!pq.size() > 0 && -pq.top() < K[i]) { pq.pop(); } while (K[i]--) { if (pq.size() == 0) return 0; pq.pop(); } } return 1; }

Compilation message (stderr)

teams.cpp: In function 'bool can(int, int*)':
teams.cpp:27:27: warning: logical not is only applied to the left hand side of comparison [-Wlogical-not-parentheses]
   27 |         while (!pq.size() > 0 && -pq.top() < K[i]) {
      |                           ^
teams.cpp:27:16: note: add parentheses around left hand side expression to silence this warning
   27 |         while (!pq.size() > 0 && -pq.top() < 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...