Submission #802789

#TimeUsernameProblemLanguageResultExecution timeMemory
802789happypotatoTeams (IOI15_teams)C++17
34 / 100
4075 ms8940 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) { if (lhs.ss != rhs.ss) return lhs.ss < rhs.ss; return lhs.ff < rhs.ff; } vector<bool> used; 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); // for (pii &cur : v) cerr << cur.ff << ' ' << cur.ss << endl; used.resize(n); } int can(int M, int K[]) { for (int i = 0; i < n; i++) used[i] = 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...