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 <iostream>
#include <algorithm>
#include <vector>
using namespace std;
struct node{
long long int a,b;
}val[1000005];
long long int n,m,k[1000004];
bool cmp1(node x,node y) {
return x.a < y.a;
}
bool cmp2(int x,int y)
{
return x<y;
}
struct cmp3
{
bool operator()(node x,node y)
{
return x.b>y.b;
}
};
void init(int N, int A[], int B[]) {
n=N;
for(int i=0;i<n;i++)
{
val[i].a=A[i];
val[i].b=B[i];
}
sort(val,val+n,cmp1);
}
int can(int M, int K[])
{
m=M;
for(int i=0;i<m;i++)k[i]=K[i];
sort(k,k+m,cmp2);
vector<node> v;
int p=0;
for(int i=0;i<m;i++)
{
while(val[p].a<=k[i] && p<n)
{
v.push_back(val[p]);
push_heap(v.begin(),v.end(),cmp3());
p++;
}
while(v[0].b<k[i] && v.empty()==false){
pop_heap(v.begin(),v.end(),cmp3());
v.pop_back();
}
while(k[i]--)
{
if(v.empty()==true)
{
return 0;
}
pop_heap(v.begin(),v.end(),cmp3());
v.pop_back();
}
}
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... |