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>
#define all(x) x.begin(), x.end()
#define chmax(x, v) x = max(x, v)
#define chmin(x, v) x = min(x, v)
#define pii pair<int, int>
#define pb push_back
#define sz(x) (int)x.size()
#define x first
#define y second
//#define int long long
using namespace std;
const int N_ELEVES = 3e5;
int nInters;
vector<int> fins[N_ELEVES];
void init(int N, int A[], int B[]) {
nInters = N;
for (int i = 0; i < N; ++i)
fins[A[i]].pb(B[i]);
nInters++;
}
int can(int M, int K[]) {
int nReqs[nInters];
for (int i = 0; i < nInters; ++i)
nReqs[i] = 0;
for (int iReq = 0; iReq < M; ++iReq)
nReqs[K[iReq]]++;
priority_queue<int> actus;
for (int i = 0; i < nInters; ++i){
for (int fin : fins[i])
actus.push(-fin);
while (nReqs[i]--){
int nb = 0;
while (!actus.empty() && nb != i){
nb += (-actus.top() >= i);
actus.pop();
}
if (nb < 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... |