#include <bits/stdc++.h>
#include "teams.h"
using namespace std;
const int MAXN = 5e5 + 10;
pair<int, int> student[MAXN];
int n;
void init(int n_, int a[], int b[]){
n = n_;
for(int i=0; i<n; i++) student[i] = {a[i], b[i]};
sort(student, student + n);
}
int can(int m, int k[]){
sort(k, k + m);
multiset<int> ms;
int l = 0;
for(int i=0; i<m; i++){
while(l < n && student[l].first <= k[i]){
ms.insert(student[l].second);
l ++;
}
if((int) ms.size() < k[i]) return 0;
for(int j=0; j<k[i]; j++){
auto pos = ms.lower_bound(k[i]);
if(pos == ms.end()) return 0;
ms.erase(pos);
}
}
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... |