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 <bits/stdc++.h>
#include "teams.h"
using namespace std;
vector<pair<int, int>> arr;
vector<bool> taken;
int N;
void init(int K, int A[], int B[]){
N = K;
for(int i = 0; i < N; i ++){
arr.push_back({A[i], B[i]});
}
taken.resize(N);
sort(arr.begin(), arr.end());
sort(arr.begin(), arr.end(), [](pair<int,int> a, pair<int,int>b){return a.second < b.second;});
}
int can(int M, int K[]){
fill(taken.begin(), taken.end(), false);
sort(K, K + M);
for(int i = 0; i < M; i ++){
int need = K[i];
int id = 0;
int got = 0;
while(id < N && got < need){
if(!taken[id] && arr[id].first <= need && arr[id].second >= need){
got++;
taken[id] = true;
}
id++;
}
if(got < need){
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... |