# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
829935 | 2023-08-18T16:00:57 Z | Blagoj | Last supper (IOI12_supper) | C++17 | 328 ms | 19524 KB |
#include <bits/stdc++.h> #include "advisor.h" using namespace std; void ComputeAdvice(int *C, int N, int K, int M) { queue<int> toDelete; unordered_map<int, int> cnt; set<int> s[N + 2]; int Last[N + 2]; for (int i = 0; i < N; i++) { cnt[C[i]]++; s[C[i]].insert(i + K); } for (int i = 0; i < K; i++) { Last[i] = i; if (!cnt[i]) toDelete.push(i); } vector<int> op(N + K); unordered_set<int> have; for (int i = 0; i < K; i++) { have.insert(i); if (!cnt[i]) op[i] = 1; } for (int i = 0; i < N; i++) { Last[C[i]] = i + K; if (have.count(C[i])) { cnt[C[i]]--; if (!cnt[C[i]]) { toDelete.push(C[i]); op[i + K] = 1; } } else { if (toDelete.size() == 0) { int last, position = -1; for (int x : have) { int temp = *s[x].lower_bound(i); if (temp > position) { position = temp; last = x; } } toDelete.push(last); op[Last[last]] = 1; } int fr = toDelete.front(); toDelete.pop(); have.erase(fr); have.insert(C[i]); cnt[C[i]]--; if (!cnt[C[i]]) { toDelete.push(C[i]); op[i + K] = 1; } } } for (int i = 0; i < op.size(); i++) { WriteAdvice(op[i]); } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 516 KB | Error - Putting back a color that is not on the scaffold |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 8 ms | 2268 KB | Error - Putting back a color that is not on the scaffold |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 57 ms | 14544 KB | Error - Putting back a color that is not on the scaffold |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 1264 KB | Error - Putting back a color that is not on the scaffold |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 328 ms | 17368 KB | Error - Putting back a color that is not on the scaffold |
2 | Incorrect | 81 ms | 18016 KB | Error - Putting back a color that is not on the scaffold |
3 | Incorrect | 76 ms | 18144 KB | Error - Putting back a color that is not on the scaffold |
4 | Incorrect | 76 ms | 18068 KB | Error - Putting back a color that is not on the scaffold |
5 | Incorrect | 80 ms | 18128 KB | Error - Putting back a color that is not on the scaffold |
6 | Incorrect | 74 ms | 18048 KB | Error - Putting back a color that is not on the scaffold |
7 | Incorrect | 80 ms | 18052 KB | Error - Putting back a color that is not on the scaffold |
8 | Incorrect | 77 ms | 18056 KB | Error - Putting back a color that is not on the scaffold |
9 | Incorrect | 78 ms | 18092 KB | Error - Putting back a color that is not on the scaffold |
10 | Incorrect | 217 ms | 19524 KB | Error - Putting back a color that is not on the scaffold |