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 pb push_back
#define MP make_pair
#define F first
#define S second
#define MEM(i,j) memset(i,j,sizeof i)
#define ALL(v) v.begin(),v.end()
#define ET cout << "\n"
#define DB(a,s,e) {for(int i=s;i<e;++i) cout << a[i] << " ";ET;}
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
vector<int> v[500005];
void init(int N, int A[], int B[])
{
for(int i=0;i<N;++i)
v[A[i]].pb(B[i]);
}
int can(int M, int K[])
{
priority_queue<int,vector<int>,greater<int>> pq;
vector<int> query;
for(int i=0;i<M;++i)
query.pb(K[i]);
sort(ALL(query));
for(int i=0,nw=1,cnt;i<M;++i)
{
for(;nw<=query[i];++nw)
for(int j:v[nw])
pq.push(j);
for(cnt=query[i];pq.size()&&cnt;pq.pop())
if(pq.top()>=query[i])
--cnt;
if(cnt)
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... |