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 N = 1e5 + 5;
int n;
int a[N], b[N];
vector<int> qa[N], qr[N];
void init(int n_, int a_[], int b_[]) {
n = n_;
for (int i = 0; i < n; ++i) {
a[i] = a_[i];
}
for (int i = 0; i < n; ++i) {
b[i] = b_[i];
}
for (int i = 0; i < n; ++i) {
qa[a[i]].push_back(i);
qr[b[i]].push_back(i);
}
}
int can(int m, int k[]) {
sort(k, k + m);
set<pair<int, int>> se;
for (int i = 1, p = 0; i <= n; ++i) {
for (int j : qa[i]) {
se.insert({b[j], j});
}
while (p < m && k[p] == i) {
if ((int) se.size() < i) {
return 0;
}
for (int j = 0; j < k[p]; ++j) {
se.erase(se.begin());
}
p++;
}
for (int j : qr[i]) {
if (se.count({b[j], j})) {
se.erase({b[j], j});
}
}
}
return 1;
}
# | 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... |