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>> all;
int n;
void init(int N , int A[] , int B[]){
n = N;
for(int i = 0 ; i < n ; i += 1){
all.push_back({A[i],B[i]});
}
sort(all.rbegin(),all.rend());
}
int can(int m , int k[]){
bool seen[n];
memset(seen,0,sizeof seen);
vector<int> f;
for(int i = 0 ; i < m ; i += 1){
f.push_back(k[i]);
}
sort(f.rbegin(),f.rend());
vector<int> f2 = f;
for(int l = 0 ; l < m ; l += 1){
for(int j = 0 ; j < n ; j += 1){
if(seen[j]){
continue;
}
auto i = all[j];
if(i.first <= f2[l] && i.second >= f2[l]){
seen[j] = 1;
f[l] -= 1;
}
if(f[l] == 0){
break;
}
}
if(f[l] != 0){
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... |