# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
147608 | nandonathaniel | Teams (IOI15_teams) | C++14 | 0 ms | 0 KiB |
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;
typedef pair<int,int> pii;
pii V[100005];
bool sudah[100005];
bool cmp(pii x,pii y){
return x.second<y.second;
}
void init(int N, int A[], int B[]) {
for(int i=0;i<N;i++)V[i]={A[i],B[i]};
sort(V,V+N,cmp);
}
int can(int M, int K[]) {
memset(sudah,false,sizeof(sudah));
for(int i=0;i<M;i++){
int brp=0;
bool ya=false;
for(int j=0;j<N;j++){
if(!sudah[i] && K[i]>=V[j].first && K[i]<=V[j].second){
brp++;
sudah[i]=true;
}
if(brp==K[i]){
ya=true;
break;
}
}
if(!ya)return 0;
}
return 1;
}