Submission #936792

#TimeUsernameProblemLanguageResultExecution timeMemory
936792PagodePaivaTeams (IOI15_teams)C++17
0 / 100
4088 ms17444 KiB
#include "teams.h" #include<bits/stdc++.h> using namespace std; int n; vector <pair <int, int>> v; void init(int N, int A[], int B[]) { n = N; for(int i = 0;i < n;i++){ v.push_back({B[i], A[i]}); } sort(v.begin(), v.end()); for(auto &x : v){ swap(x.first, x.second); } // for(auto x : v){ // cout << x << ' '; // } } int can(int M, int K[]) { int m = M; vector <int> k; for(int i = 0;i < m;i++) k.push_back(K[i]); sort(k.begin(), k.end()); reverse(k.begin(), k.end()); int l = n-1; for(auto x : k){ int cnt = x; while(cnt > 0){ if(l < 0) return 0; // cout << v[l].first << ' ' << v[l].second << ' ' << x << endl; if(v[l].first <= x and x <= v[l].second){ cnt--; } l--; } } 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...