#include "teams.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef tuple <ll,ll,ll> plll;
typedef vector <plll> vplll;
typedef pair <ll,ll> pll;
typedef vector <ll> vll;
typedef vector <pll> vpll;
typedef vector <vector <pll>> vvpll;
typedef vector <vector <ll>> vvll;
typedef vector <bool> vb;
typedef vector <vector <bool>> vvb;
#define loop(i, s, e) for (ll i = (s); i < (e); ++i)
#define loopr(i, e, s) for (ll i = (e)-1; i >= (s); --i)
#define all(a) a.begin(), a.end()
const ll inf = 1e9 + 7;
ll n;
multiset<pll> p;
void init(int N, int A[], int B[]) {
n = N;
loop(i,0,n) {
ll a = A[i], b = B[i];
p.insert({a,b});
}
}
int can(int m, int K[]) {
vll k(m);
loop(i,0,m) k[i] = K[i];
sort(all(k));
vpll kids(p.begin(), p.end());
multiset<ll> bs;
int idx = 0;
int szp = kids.size();
loop(i,0,m) {
ll size = k[i];
while (idx < n && kids[idx].first <= size) {
bs.insert(kids[idx].second);
++idx;
}
loop(rep,0,size) {
auto it = bs.lower_bound(size);
if (it == bs.end()) return 0;
bs.erase(it);
}
}
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... |