Submission #121394

#TimeUsernameProblemLanguageResultExecution timeMemory
121394MAMBALast supper (IOI12_supper)C++17
0 / 100
165 ms138536 KiB
#include <bits/stdc++.h> #include "advisor.h" using namespace std; #define rep(i, j, k) for (int i = j; i < (int)k; i++) #define pb push_back void ComputeAdvice(int S[], int n, int k, int ignore) { deque<int> c[n]; vector<bool> mark(n); vector<bool> res(n + k); priority_queue<pair<int, int>> pq; rep(i, 0, k) { c[i].push_back(i); mark[i] = true; } rep(i, 0, n) c[S[i]].push_back(i + k); rep(i, 0, k) { int v = c[i].front(); c[i].pop_front(); int u = n + k; if (!c[i].empty()) u = c[i].front(); pq.push({u, v}); } rep(i, 0, n) { c[S[i]].pop_front(); if (!mark[S[i]]) { int id = pq.top().second; pq.pop(); res[id] = true; if (id >= k) id = S[id - k]; mark[id] = false; int u = n + k; if (!c[S[i]].empty()) u = c[S[i]].front(); pq.push({u, i + k}); mark[S[i]] = true; } } rep(i, 0, k + n) WriteAdvice(res[i]); }
#include <bits/stdc++.h> #include "assistant.h" using namespace std; #define rep(i, j, k) for (int i = j; i < (int)k; i++) #define pb push_back void Assist(unsigned char A[], int n, int k, int ignore) { vector<bool> mark(n); vector<int> q; int l = 0; rep(i, 0, k) { mark[i] = true; if (A[i]) q.pb(i); } rep(i, 0, n) { int g = GetRequest(); if (A[i + k]) q.pb(g); if (!mark[g]) { PutBack(q[l]); mark[q[l++]] = false; mark[g] = 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...
#Verdict Execution timeMemoryGrader output
Fetching results...