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 = 5e5+5;
int n;
vector<int> lp[N];
void init(int nn, int a[], int b[]) {
n = nn;
for (int i = 0; i < n; i++) {
lp[a[i]].push_back(b[i]);
}
}
int can(int m, int k[]) {
sort(k, k+m);
int L = 0;
int ok = 1;
priority_queue<int> pq;
for (int i = 1; i <= n; i++) {
for (int& j : lp[i]) {
pq.push(-j);
}
while (L < m && k[L] == i) {
int c = k[L];
while (!pq.empty() && c) {
pq.pop();
c--;
}
if (c) {
ok = 0;
break;
}
L++;
}
if (L == m) break;
while (!pq.empty() && -pq.top() <= i) pq.pop();
}
//cerr << ok << endl;
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... |