Submission #430455

# Submission time Handle Problem Language Result Execution time Memory
430455 2021-06-16T14:00:01 Z KoD Last supper (IOI12_supper) C++17
0 / 100
186 ms 73564 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 (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 2 ms 592 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 18 ms 7872 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 131 ms 59056 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 9 ms 3476 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 183 ms 73024 KB Error - Putting back a color that is not on the scaffold
2 Incorrect 168 ms 73240 KB Error - Putting back a color that is not on the scaffold
3 Incorrect 174 ms 73428 KB Error - Putting back a color that is not on the scaffold
4 Incorrect 161 ms 73432 KB Error - Putting back a color that is not on the scaffold
5 Incorrect 186 ms 73388 KB Error - Putting back a color that is not on the scaffold
6 Incorrect 158 ms 73380 KB Error - Putting back a color that is not on the scaffold
7 Incorrect 160 ms 73312 KB Error - Putting back a color that is not on the scaffold
8 Incorrect 169 ms 73464 KB Error - Putting back a color that is not on the scaffold
9 Incorrect 172 ms 73564 KB Error - Putting back a color that is not on the scaffold
10 Incorrect 149 ms 72308 KB Error - Putting back a color that is not on the scaffold