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;
inline int IN_RANGE(int x, pair<int, int> p) { return p.first <= x and x <= p.second; }
vector<pair<int, int>> students;
void init(int N, int L[], int R[]) {
students.resize(N);
for (int i = 0; i < N; i++)
students[i] = make_pair(L[i], R[i]);
sort(students.begin(), students.end());
}
int can(int M, int K[]) {
vector<int> groups(K, K + M);
sort(groups.begin(), groups.end());
priority_queue<int, vector<int>, greater<int>> rights;
auto it = students.begin();
for (int g : groups) {
while (it != students.end() and it->first <= g) {
rights.push(it->second);
it++;
}
for (int t = g; t--; ) {
if (rights.empty())
return false;
if (rights.empty() or rights.top() < g)
return false;
rights.pop();
}
}
return true;
}
# | 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... |