#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[]) {
bool ok = true;
vll k(m);
loop(i,0,m) k[i] = K[i];
sort(all(k));
for (int i = 0; i < m; ++i) {
ll sz = k[i];
ll cnt = 0;
for (auto it = p.begin(); it != p.end() && cnt < sz; ) {
if (it->first <= sz && it->second >= sz) {
++cnt;
it = p.erase(it);
} else {
++it;
}
}
if (cnt < sz) {
ok = false;
break;
}
}
return ok ? 1 : 0;
}
# | 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... |