제출 #828455

#제출 시각아이디문제언어결과실행 시간메모리
828455Josia팀들 (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...