제출 #128116

#제출 시각아이디문제언어결과실행 시간메모리
128116MoNsTeR_CuBe팀들 (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...