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 sz(v) ((int)(v).size())
typedef long long lint;
typedef pair<int,int> pii;
int n;
pii d[500003];
void init(int N, int A[], int B[]) {
n=N;
for(int i=0;i<n;i++)d[i]={A[i],B[i]};
sort(d,d+n);
}
int can(int M, int K[]) {
sort(K,K+M);
int piv=0;
int ans=1;
priority_queue<int>P;
for(int i=0;i<M;i++)
{
while(piv<n && d[piv].first<=K[i])
{
P.push({-d[piv].second});
piv++;
}
int o=K[i];
while(o && !P.empty())
{
int p=P.top();P.pop();
if(-p <K[i])continue;
else o--;
}
if(o!=0)
{
ans=0;
break;
}
}
return ans;
}
# | 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... |