Submission #744333

#TimeUsernameProblemLanguageResultExecution timeMemory
744333baneTeams (IOI15_teams)C++17
34 / 100
4030 ms19040 KiB
#include "teams.h" #include "bits/stdc++.h" using namespace std; vector<pair<int,int>> intervals; void init(int N, int A[], int B[]) { intervals.resize(N); for (int i = 0; i < N; ++i) intervals[i] = {A[i], B[i]}; sort(intervals.begin(), intervals.end()); } int can(int M, int K[]) { sort(K, K + M); priority_queue<int, vector<int>, greater<int>> pq; // b : end of interval int idx = 0; for (int i = 0; i < M; ++i) { int todo = K[i]; while (idx < (int)intervals.size() && intervals[idx].first <= K[i]) pq.push(intervals[idx++].second); while (todo) { if (pq.empty()) return 0; if (pq.top() >= K[i]) --todo; pq.pop(); } } return 1; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...