Submission #128116

#TimeUsernameProblemLanguageResultExecution timeMemory
128116MoNsTeR_CuBeTeams (IOI15_teams)C++17
0 / 100
4057 ms15504 KiB
#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(),comp1); } sort(work.begin(), work.end(),comp); 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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...