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);
for(int i = 0; i < n; i++){
A[i] = a[i];
B[i] = b[i];
}
}
bool comp(vector< int > &Aa, vector< int > &Bb){
return Aa.size() < Bb.size();
}
bool comp1(int &a, int &b){
return usefulPerson[a] < usefulPerson[b];
}
int can(int M, int K[]) {
usefulPerson.assign(N,0);
vector< vector< int > > work(M);
for(int i = 0; i < N; i++){
for(int j = 0; j < M; j++){
if(A[i] <= K[j] && B[i] >= K[j]){
usefulPerson[i]++;
work[j].push_back(i);
}
}
}
for(int i = 0; i < M; i++){
sort(work[i].begin(), work[i].end());
}
sort(work.begin(), work.end());
vector< bool > USED(N);
for(int i = 0; i < M; i++){
int rem = K[i];
int curr = 0;
while(rem && curr < (int)work[i].size()){
curr++;
if(USED[work[i][curr-1]]){
continue;
}
USED[work[i][curr-1]] = 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... |