Submission #802782

#TimeUsernameProblemLanguageResultExecution timeMemory
802782happypotatoTeams (IOI15_teams)C++17
13 / 100
4046 ms16276 KiB
#include "teams.h" #include <bits/stdc++.h> using namespace std; #define pii pair<int, int> #define ff first #define ss second #define pb push_back int n; vector<pii> v; bool cmp(pii &lhs, pii &rhs) { return lhs.ss < rhs.ss; } void init(int N, int A[], int B[]) { n = N; v.resize(n); for (int i = 0; i < n; i++) { v[i] = {A[i], B[i]}; } sort(v.begin(), v.end(), cmp); } vector<bool> used; int can(int M, int K[]) { used.resize(n, false); int m = M; vector<int> tar(m); for (int i = 0; i < m; i++) tar[i] = K[i]; sort(tar.begin(), tar.end()); for (int &cur : tar) { int need = 0; for (int i = 0; i < n; i++) { if (used[i]) continue; if (v[i].ff <= cur && cur <= v[i].ss) { used[i] = true; need++; if (need == cur) break; } } if (need < cur) return false; } return true; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...