#include "teams.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector <ll>;
using ii = pair <ll, ll>;
using vii = vector <ii>;
ll n;
vll vl, vr;
// vll ve;
void init (int n, int aa[], int bb[]) {
::n = n;
vl = vll(aa, aa+n);
vr = vll(bb, bb+n);
}
int can (int m, int k[]) {
vll th(k, k+m);
// sort(th.begin(), th.end());
vector <vll> ls(n+1);
for (ll i = 0; i < n; i++) {
ls[vl[i]].push_back(vr[i]);
}
multiset <ll> mst;
vll freq(n+1, 0);
for (ll i : th) freq[i]++;
for (ll i = 1; i <= n; i++) {
for (ll rs : ls[i]) mst.insert(rs);
if (mst.size() < freq[i]*i) return 0;
while (freq[i]--) {
for (ll j = 0; j < i; j++) {
assert(mst.size());
mst.erase(mst.begin());
}
}
while (mst.size() && *mst.rbegin() == i) mst.erase(mst.find(*mst.rbegin()));
}
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... |