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 ll long long
#define pii pair<int,int>
#define f first
#define s second
#define all(x) x.begin(),x.end()
#define _ ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int n;
vector<int> a,b;
void init(int N, int A[], int B[]) {
n=N;
for(int i=0;i<n;i++){
a.push_back(A[i]);
b.push_back(B[i]);
}
}
int can(int M, int K[]) {
sort(K,K+M);
vector<vector<int>> st(n+1),en(n+1);
for(int i=0;i<n;i++){
st[a[i]].push_back(i);
en[b[i]].push_back(i);
}
set<pair<int,int>> S;
int cnt=0;
for(int i=1;i<=n;i++){
for(auto v:st[i]){
S.insert({b[v],v});
}
while(cnt<M and K[cnt]==i){
for(int j=0;j<i;j++){
if(S.empty()){
return 0;
}
S.erase(S.begin());
}
cnt++;
}
for(auto v:en[i]){
if(S.find({b[v],v})!=S.end()){
S.erase({b[v],v});
}
}
}
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... |