This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "teams.h"
#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int>> students;
void init(int n, int a[], int b[]) {
for(int i = 0; i < n; i++) {
students.emplace_back(a[i], b[i]);
}
sort(students.begin(), students.end(), [](pair<int, int> p1, pair<int, int> p2) {
return p1.second < p2.second;
});
}
int can(int m, int k[]) {
multiset<pair<int, int>> projects;
for(int i = 0; i < m; i++) {
projects.insert(make_pair(k[i], k[i]));
}
for(auto [l, r]: students) {
auto it = projects.lower_bound(make_pair(l, 0));
if(it != projects.end() && it->first <= r) {
auto p = *it;
projects.erase(it);
p.second--;
if(p.second > 0) {
projects.insert(p);
}
}
}
return projects.empty();
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |