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 F first
#define S second
#define pb push_back
#define vll vector<ll>
#define pll pair<ll, ll>
typedef long long ll;
const ll mxN=5e5+5;
ll n, m;
vll adj[mxN];
void init(int N, int a[], int b[]) {
n=N;
for(ll i=0;i<n;i++){
adj[a[i]].pb(b[i]);
}
}
int can(int M, int k[]) {
m=M;
priority_queue<ll, vll, greater<ll>> pq;
vll cnt(n+1);
for(ll i=0;i<m;i++){
cnt[k[i]]+=k[i];
}
for(ll i=1;i<=n;i++){
while(!pq.empty() && pq.top()<i) pq.pop();
for(auto &it:adj[i]){
pq.push(it);
}
while(cnt[i]--){
if(pq.empty()) return 0;
pq.pop();
}
}
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... |