This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "teams.h"
#include <bits/stdc++.h>
using namespace std;
#define X first
#define Y second
#define mp make_pair
#define pb push_back
typedef long long ll;
typedef pair <int, int> pii;
typedef pair <int, pii> pip;
typedef pair <pii, int> ppi;
typedef pair <ll, ll> pll;
const int INF=0x3f3f3f3f;
const int MAXN=1e5+5;
int n;
pii p[MAXN];
multiset <int> S;
void init(int N, int A[], int B[]) {
n=N;
for (int i=0; i<n; ++i) p[i]=mp(A[i], B[i]);
sort(p, p+n);
}
int can(int M, int K[]) {
sort(K, K+M);
int ind=0;
for (int i=0; i<M; ++i) {
while (ind<n && p[ind].X<=K[i]) S.insert(p[ind++].Y);
while (!S.empty() && *S.begin()<K[i]) S.erase(S.begin());
while (K[i] && !S.empty()) {
S.erase(S.begin());
K[i]--;
}
if (K[i]) return 0;
}
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... |