Submission #411564

#TimeUsernameProblemLanguageResultExecution timeMemory
411564faresbasbsTeams (IOI15_teams)C++14
34 / 100
4062 ms9388 KiB
#include <bits/stdc++.h> #include "teams.h" using namespace std; vector<pair<int,int>> all; int n; void init(int N , int A[] , int B[]){ n = N; for(int i = 0 ; i < n ; i += 1){ all.push_back({A[i],B[i]}); } sort(all.rbegin(),all.rend()); } int can(int m , int k[]){ bool seen[n]; memset(seen,0,sizeof seen); vector<int> f; for(int i = 0 ; i < m ; i += 1){ f.push_back(k[i]); } sort(f.rbegin(),f.rend()); vector<int> f2 = f; for(int l = 0 ; l < m ; l += 1){ for(int j = 0 ; j < n ; j += 1){ if(seen[j]){ continue; } auto i = all[j]; if(i.first <= f2[l] && i.second >= f2[l]){ seen[j] = 1; f[l] -= 1; } if(f[l] == 0){ break; } } if(f[l] != 0){ 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...