#include "teams.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef pair<ll, ll> pll;
typedef vector<ll> vl;
const ll LLINF = 1e18;
vector<pii> a;
int n;
void init(int N, int A[], int B[]) {
n = N;
a.resize(n);
for (int i = 0; i < n; i++) a[i].first = A[i], a[i].second = B[i];
sort(a.begin(), a.end());
}
int can(int m, int t[]) {
priority_queue<int, vi, greater<int>> pq;
sort(t, t+m);
bool ok = 1;
for (int i = 0, j = 0; i < m && ok; i++) {
int need = t[i];
while (j < n && a[j].first <= need) pq.push(a[j++].second);
while ((int)pq.size() && pq.top() < need) pq.pop();
while (need && (int)pq.size()) {
pq.pop();
need--;
}
if (need) ok = 0;
}
//cout << 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... |