#include "teams.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define fi first
#define se second
#define pb push_back
#define vi vector<int>
#define vl vector<ll>
#define pi pair<int, int>
#define pl pair<ll,ll>
#define all(x) (x).begin(),(x).end()
vector<pi> p;
void init(int n, int a[], int b[]) {
for (int i=0; i<n; i++) {
p.pb({a[i],b[i]});
}
sort(all(p));
}
int can(int m, int k[]) {
sort(k,k+m);
multiset<int> q;
int pt=0;
for (int i=0; i<m; i++) {
while (pt<p.size() && p[pt].fi<=k[i]) {
q.insert(p[pt++].se);
}
while (q.size() && (*q.begin())<k[i]) {
q.erase(*q.begin());
}
if (q.size()<k[i]) {
return 0;
}
for (int j=0; j<k[i]; j++) {
q.extract(q.begin());
}
}
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... |