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;
const int maxN = 5e5 + 20;
vector<pair<int, int>> qadd[maxN];
vector<pair<int, int>> qrem[maxN];
int cnt[maxN];
int N;
void init(int _N, int A[], int B[]) {
N = _N;
for (int i = 0; i < N; i++) {
qadd[A[i]].emplace_back(B[i], i);
qadd[B[i]].emplace_back(B[i], i);
}
}
int can(int M, int K[]) {
for (int i = 0; i < M; i++) {
cnt[K[i]]++;
}
set<pair<int, int>> S;
bool ok = true;
for (int i = 1; i <= N ; i++) {
for (auto p: qadd[i]) {
S.insert(p);
}
if ((int)S.size() < cnt[i]) {
ok = false;
break;
}
for (int j = 0; j < cnt[i]; j++) {
S.erase(S.begin());
}
for (auto p: qrem[i]) {
S.erase(p);
}
}
for (int i = 0; i < M; i++) {
cnt[K[i]]--;
}
return ok;
}
# | 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... |