# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
829930 | 2023-08-18T15:59:32 Z | Blagoj | 최후의 만찬 (IOI12_supper) | C++17 | 363 ms | 19528 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
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 508 KB | Output is correct |
2 | Incorrect | 1 ms | 508 KB | Error - Putting back a color that is not on the scaffold |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 11 ms | 2416 KB | Error - Putting back a color that is not on the scaffold |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 62 ms | 14904 KB | Error - Putting back a color that is not on the scaffold |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 1304 KB | Error - Putting back a color that is not on the scaffold |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 363 ms | 17692 KB | Error - Putting back a color that is not on the scaffold |
2 | Incorrect | 81 ms | 18092 KB | Error - Putting back a color that is not on the scaffold |
3 | Incorrect | 109 ms | 18272 KB | Error - Putting back a color that is not on the scaffold |
4 | Incorrect | 78 ms | 18300 KB | Error - Putting back a color that is not on the scaffold |
5 | Incorrect | 76 ms | 18292 KB | Error - Putting back a color that is not on the scaffold |
6 | Incorrect | 76 ms | 18348 KB | Error - Putting back a color that is not on the scaffold |
7 | Incorrect | 86 ms | 18268 KB | Error - Putting back a color that is not on the scaffold |
8 | Incorrect | 77 ms | 18264 KB | Error - Putting back a color that is not on the scaffold |
9 | Incorrect | 77 ms | 18296 KB | Error - Putting back a color that is not on the scaffold |
10 | Incorrect | 211 ms | 19528 KB | Error - Putting back a color that is not on the scaffold |