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;
#define pii pair<int, int>
#define ff first
#define ss second
#define pb push_back
int n;
vector<pii> v;
bool cmp(pii &lhs, pii &rhs) {
if (lhs.ss != rhs.ss) return lhs.ss < rhs.ss;
return lhs.ff < rhs.ff;
}
void init(int N, int A[], int B[]) {
n = N;
v.resize(n);
for (int i = 0; i < n; i++) {
v[i] = {A[i], B[i]};
}
sort(v.begin(), v.end(), cmp);
}
vector<bool> used;
int can(int M, int K[]) {
used.resize(n, false);
int m = M;
vector<int> tar(m);
for (int i = 0; i < m; i++) tar[i] = K[i];
sort(tar.begin(), tar.end());
for (int &cur : tar) {
int need = 0;
for (int i = 0; i < n; i++) {
if (used[i]) continue;
if (v[i].ff <= cur && cur <= v[i].ss) {
used[i] = true;
need++;
if (need == cur) break;
}
}
if (need < cur) return false;
}
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... |