Submission #1073747

#TimeUsernameProblemLanguageResultExecution timeMemory
1073747Joshua_AnderssonTeams (IOI15_teams)C++14
34 / 100
4056 ms24672 KiB
#include "teams.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; const ll linf = ll(1e18); typedef vector<int> vi; typedef vector<vi> vvi; typedef pair<int, int> p2; #define rep(i, high) for (int i = 0; i < high; i++) #define repp(i, low, high) for (int i = low; i < high; i++) #define repe(i, container) for (auto& i : container) #define sz(container) ((int)container.size()) #define all(x) begin(x),end(x) #if _LOCAL #define assert(x) if (!(x)) __debugbreak() #endif int n; vi a; vi b; void init(int N, int A[], int B[]) { n = N; a.resize(N); b.resize(N); rep(i, N) a[i] = A[i], b[i] = B[i]; } int can(int m, int K[]) { vi k(m); rep(i, m) k[i] = K[i]; sort(all(k)); priority_queue<p2> waiting; rep(i, n) { waiting.emplace(-a[i], i); } priority_queue<int> active; rep(i, m) { int s = k[i]; while (sz(waiting)&&(-waiting.top().first)<=s) { p2 p = waiting.top(); waiting.pop(); active.emplace(-b[p.second]); } int j = 0; while (j<s) { if (active.empty()) return 0; if (-active.top() < s) { active.pop(); continue; } active.pop(); j++; } } 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...