제출 #128139

#제출 시각아이디문제언어결과실행 시간메모리
128139MoNsTeR_CuBe팀들 (IOI15_teams)C++17
0 / 100
4072 ms15744 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(pair< vector< int >, int > &Aa, pair< vector< int >, int > &Bb){ return Aa.first.size() < Bb.first.size(); } bool comp1(int &a, int &b){ return usefulPerson[a] < usefulPerson[b]; } int can(int M, int K[]) { usefulPerson.assign(N,0); vector< pair< vector< int >, int > > work(M); for(int i = 0; i < N; i++){ for(int j = 0; j < M; j++){ work[j].second = j; if(A[i] <= K[j] && B[i] >= K[j]){ usefulPerson[i]++; work[j].first.push_back(i); } } } for(int i = 0; i < M; i++){ sort(work[i].first.begin(), work[i].first.end(),comp1); } sort(work.begin(), work.end(),comp); vector< bool > USED(N); for(int i = 0; i < M; i++){ int rem = K[work[i].second]; int curr = 0; while(rem && curr < (int)work[i].first.size()){ curr++; if(USED[work[i].first[curr-1]]){ continue; } USED[work[i].first[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...