Submission #1134676

#TimeUsernameProblemLanguageResultExecution timeMemory
1134676adaawfLast supper (IOI12_supper)C++20
0 / 100
6 ms832 KiB
#include <bits/stdc++.h> #include "advisor.h" using namespace std; int f[200005], l[200005], g[200005], d[200005], dd[200005]; void ComputeAdvice(int *c, int n, int k, int m) { int h = n + k; for (int i = h - 1; i >= k; i--) { c[i] = c[i - k]; } for (int i = 0; i < n; i++) { l[i] = 0; d[i] = 0; dd[i] = 0; } for (int i = h - 1; i >= k; i--) { if (l[c[i]] == 0) l[c[i]] = 1e9; f[i] = l[c[i]]; l[c[i]] = i; } set<pair<int, int>> s; for (int i = 0; i < k; i++) { c[i] = i; s.insert({-l[i], i}); g[i] = i; dd[i] = 1; } for (int i = k; i < h; i++) { if (dd[c[i]] == 1) { s.erase({-i, g[c[i]]}); s.insert({-f[i], i}); } else { auto w = *s.begin(); d[w.second = 1]; s.erase(s.begin()); dd[c[-w.first]] = 0; dd[c[i]] = 1; s.insert({-f[i], i}); } g[c[i]] = i; } for (int i = 0; i < h; i++) WriteAdvice(d[i]); }
#include <bits/stdc++.h> #include "assistant.h" using namespace std; int f[200005], l[200005], g[200005], d[200005], dd[200005]; void Assist(unsigned char *a, int n, int k, int r) { int h = n + k; for (int i = 0; i < n; i++) { dd[i] = 0; } stack<int> s; for (int i = 0; i < k; i++) { if (a[i] == '1') s.push(i); dd[i] = 1; } for (int i = k; i < h; i++) { int x = GetRequest(); if (dd[x] == 0) { PutBack(s.top()); dd[s.top()] = 0; s.pop(); dd[x] = 1; } if (a[i] == '1') s.push(x); } }
#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...