Submission #128199

#TimeUsernameProblemLanguageResultExecution timeMemory
128199MoNsTeR_CuBeTeams (IOI15_teams)C++17
34 / 100
4059 ms12536 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); 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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...