Submission #828455

#TimeUsernameProblemLanguageResultExecution timeMemory
828455JosiaTeams (IOI15_teams)C++17
34 / 100
4086 ms35376 KiB
#include "teams.h" #include <bits/stdc++.h> using namespace std; #define int int64_t int n; vector<pair<int, int>> ranges; void init(signed _N, signed A[], signed B[]) { n = _N; ranges.resize(n); for (int i = 0; i<n; i++) { ranges[i].first = A[i]; ranges[i].second = B[i]; } sort(ranges.begin(), ranges.end()); } signed can(signed m, signed K[]) { vector<int> k(m); for (int i = 0; i < m; i++) k[i] = K[i]; sort(k.begin(), k.end()); multiset<int> active; int point = 0; for (int i = 0; i<m; i++) { while (point < (int)ranges.size() && ranges[point].first <= k[i]) { active.insert(ranges[point].second); point++; } while(active.size() && *active.begin() < k[i]) { active.erase(active.begin()); } for (int j = 0; j<k[i]; j++) { if (active.empty()) return 0; active.erase(active.begin()); } } 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...