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());
set<int> rights;
auto it = students.begin();
for (int g : groups) {
while (it != students.end() and IN_RANGE(g, *it)) {
rights.insert(it->second);
it++;
}
if (rights.empty() or *rights.begin() < g)
return false;
rights.erase(rights.begin());
}
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... |