Submission #588444

#TimeUsernameProblemLanguageResultExecution timeMemory
588444TemmieTeams (IOI15_teams)C++17
0 / 100
4056 ms38324 KiB
#include "teams.h" #include <bits/stdc++.h> struct cmp { constexpr bool operator () (const std::pair <int, int>& u, const std::pair <int, int>& v) const { return u.second < v.second; } }; int n; std::vector <std::pair <int, int>> v; void init(int N, int a[], int b[]) { v.resize(n = N); for (int i = 0; i < n; i++) { v[i] = { a[i], b[i] }; } std::sort(v.begin(), v.end()); } int can(int m, int k[]) { std::multiset <std::pair <int, int>, cmp> st; int ptr = 0; for (int i = 0; i < m; i++) { while (ptr < n && v[ptr].first <= k[i]) { st.insert(v[ptr++]); } int need = k[i]; while (need && st.size()) { auto it = st.begin(); if (it->second < k[i]) { st.erase(it); continue; } need--; st.erase(it); } if (need) { 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...