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< int > usefulPerson;
vector< int > A;
vector< int > B;
int N;
void init(int n, int a[], int b[]) {
N = n;
A.resize(n);
B.resize(n);
vector< pair<int, int> > temp(n);
for(int i = 0; i < n; i++){
A[i] = a[i];
B[i] = b[i];
temp[i] = make_pair(b[i], a[i]);
}
sort(temp.begin(), temp.end());
for(int i = 0; i < n; i++){
B[i] = temp[i].first;
A[i] = temp[i].second;
}
}
int can(int M, int K[]) {
sort(K, K+M);
vector< int > visited(N, false);
for(int i = 0; i < M; i++){
int rem = K[i];
for(int j = 0; j < N; j++){
if(A[j] <= K[i] && B[j] >= K[i] && !visited[j] && rem){
visited[j] = true;
rem--;
}
}
if(rem) 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... |