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;
const int mxN = 5e5 + 5;
vector<int> until[mxN];
int N;
void init(int _N, int A[], int B[])
{
N = _N;
for(int i = 0; i < N; i++) until[A[i]].push_back(B[i]);
}
int can(int M, int K[]) {
sort(K, K + M);
multiset<int> avilable;
for(int i = 0, j = 0; i < M; i++)
{
while(j < N && j <= K[i])
{
for(int x : until[j])
{
avilable.insert(x);
}
j++;
}
int rem = K[i];
while(rem > 0 && !avilable.empty())
{
int me = *avilable.begin();
avilable.erase(avilable.begin());
if(me < K[i]) continue;
rem--;
}
assert(rem >= 0);
if(rem != 0)
{
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... |