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 rep(i,a,b) for(int i = (a); i <= (b); i++)
#define debug(a) cerr << #a << " = " << a << endl;
struct x{
int fin;
int ini;
int id;
bool operator < (const x &a)
const {
return fin < a.fin;
}
};
set<x> rangos;
set<x>::iterator pos;
int visitados[100002];
void init(int N, int A[], int B[]) {
rep(i,0,N-1) rangos.insert({B[i],A[i],i});
}
int can(int M, int K[]) {
int sum;
rep(i,0,100000) visitados[i] = 0;
sort(K,K+M);
rep(i,0,M) {
sum = 0;
pos = rangos.lower_bound({K[i],0,0});
while(pos != rangos.end() && sum < K[i]) {
if ((*pos).ini <= K[i] && visitados[(*pos).id] == 0) {
sum++;
visitados[(*pos).id] = 0;
}
pos++;
}
if (sum < K[i]) 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... |