# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
829942 | 2023-08-18T16:03:52 Z | Blagoj | Last supper (IOI12_supper) | C++17 | 2500 ms | 20868 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 | Correct | 0 ms | 516 KB | Output is correct |
2 | Correct | 1 ms | 508 KB | Output is correct |
3 | Correct | 2 ms | 904 KB | Output is correct |
4 | Incorrect | 4 ms | 916 KB | Error - Putting back a color that is not on the scaffold |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 8 ms | 2264 KB | Output is correct |
2 | Incorrect | 750 ms | 8220 KB | Output isn't correct - not an optimal way |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 68 ms | 14528 KB | Output is correct |
2 | Correct | 86 ms | 19136 KB | Output is correct |
3 | Correct | 86 ms | 19304 KB | Output is correct |
4 | Correct | 102 ms | 19148 KB | Output is correct |
5 | Correct | 991 ms | 17752 KB | Output is correct |
6 | Correct | 78 ms | 19296 KB | Output is correct |
7 | Correct | 95 ms | 19156 KB | Output is correct |
8 | Correct | 92 ms | 20868 KB | Output is correct |
9 | Execution timed out | 2559 ms | 14788 KB | Time limit exceeded |
10 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 1304 KB | Output is correct |
2 | Correct | 5 ms | 1592 KB | Output is correct |
3 | Incorrect | 5 ms | 1184 KB | Output isn't correct - not an optimal way |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 363 ms | 17372 KB | Output is correct - 120000 bits used |
2 | Correct | 81 ms | 17916 KB | Output is correct - 122000 bits used |
3 | Correct | 92 ms | 18252 KB | Output is correct - 125000 bits used |
4 | Correct | 87 ms | 18216 KB | Output is correct - 125000 bits used |
5 | Correct | 89 ms | 18152 KB | Output is correct - 125000 bits used |
6 | Correct | 107 ms | 18080 KB | Output is correct - 125000 bits used |
7 | Correct | 84 ms | 18132 KB | Output is correct - 124828 bits used |
8 | Correct | 122 ms | 18140 KB | Output is correct - 124910 bits used |
9 | Correct | 92 ms | 18068 KB | Output is correct - 125000 bits used |
10 | Correct | 229 ms | 19640 KB | Output is correct - 125000 bits used |