# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
430459 |
2021-06-16T14:03:46 Z |
KoD |
Last supper (IOI12_supper) |
C++17 |
|
173 ms |
73468 KB |
#include <bits/stdc++.h>
#include "advisor.h"
template <class T> using Vec = std::vector<T>;
void ComputeAdvice(int *C, int N, int K, int M) {
Vec<std::queue<int>> appear(N);
for (int i = 0; i < N; ++i) {
appear[C[i]].push(i);
}
for (int i = 0; i < N; ++i) {
appear[i].push(N);
}
std::set<std::pair<int, int>> heap;
Vec<int> when(N, -2);
for (int i = 0; i < K; ++i) {
heap.emplace(appear[i].front(), i);
when[i] = -1;
}
Vec<int> send(N + K);
for (int i = 0; i < N; ++i) {
if (when[C[i]] == -2) {
const int k = heap.rbegin() -> second;
heap.erase(std::prev(heap.end()));
if (when[k] == -1) {
send[k] = true;
} else {
send[K + when[k]] = true;
}
when[k] = -2;
} else {
heap.erase(std::make_pair(appear[i].front(), i));
}
appear[i].pop();
heap.emplace(appear[i].front(), i);
when[C[i]] = i;
}
for (int i = 0; i < N; ++i) {
if (when[i] != -2) {
if (when[i] == -1) {
send[i] = true;
} else {
send[K + when[i]] = true;
}
}
}
for (const auto x : send) {
WriteAdvice(x);
}
}
#include <bits/stdc++.h>
#include "assistant.h"
template <class T> using Vec = std::vector<T>;
void Assist(unsigned char *A, int N, int K, int R) {
Vec<char> has(N);
std::queue<int> dispose;
for (int i = 0; i < K; ++i) {
has[i] = true;
if (A[i]) {
dispose.push(i);
}
}
for (int i = 0; i < N; ++i) {
const int k = GetRequest();
if (!has[k]) {
PutBack(dispose.front());
has[dispose.front()] = false;
dispose.pop();
has[k] = true;
}
if (A[K + i]) {
dispose.push(k);
}
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
484 KB |
Output is correct |
2 |
Incorrect |
2 ms |
612 KB |
Error - Putting back a color that is not on the scaffold |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
13 ms |
7888 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 |
132 ms |
59064 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 |
6 ms |
3480 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 |
164 ms |
73072 KB |
Error - Putting back a color that is not on the scaffold |
2 |
Incorrect |
158 ms |
73212 KB |
Error - Putting back a color that is not on the scaffold |
3 |
Incorrect |
163 ms |
73468 KB |
Error - Putting back a color that is not on the scaffold |
4 |
Incorrect |
162 ms |
73444 KB |
Error - Putting back a color that is not on the scaffold |
5 |
Incorrect |
158 ms |
73452 KB |
Error - Putting back a color that is not on the scaffold |
6 |
Incorrect |
165 ms |
73400 KB |
Error - Putting back a color that is not on the scaffold |
7 |
Incorrect |
172 ms |
73336 KB |
Error - Putting back a color that is not on the scaffold |
8 |
Incorrect |
167 ms |
73416 KB |
Error - Putting back a color that is not on the scaffold |
9 |
Incorrect |
173 ms |
73408 KB |
Error - Putting back a color that is not on the scaffold |
10 |
Incorrect |
147 ms |
72288 KB |
Error - Putting back a color that is not on the scaffold |