답안 #430453

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
430453 2021-06-16T13:58:26 Z KoD 최후의 만찬 (IOI12_supper) C++17
0 / 100
195 ms 73844 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<int> when(N, -2);
    std::queue<int> dispose;
    for (int i = 0; i < K; ++i) {
        when[i] = -1;
        if (A[i]) {
            dispose.push(i);
        }
    }
    for (int i = 0; i < N; ++i) {
        const int k = GetRequest();
        if (when[k] == -2) {
            PutBack(dispose.front());
            dispose.pop();
        }
        if (A[K + i]) {
            dispose.push(k);
        }
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 484 KB Output is correct
2 Incorrect 1 ms 612 KB Error - Putting back a color when it is already on the scaffold
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 19 ms 7876 KB Error - Putting back a color when it is already on the scaffold
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 127 ms 59276 KB Error - Putting back a color when it is already on the scaffold
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 7 ms 3604 KB Error - Putting back a color when it is already on the scaffold
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 193 ms 73424 KB Error - Putting back a color when it is already on the scaffold
2 Incorrect 164 ms 73568 KB Error - Putting back a color when it is already on the scaffold
3 Incorrect 167 ms 73840 KB Error - Putting back a color when it is already on the scaffold
4 Incorrect 195 ms 73728 KB Error - Putting back a color when it is already on the scaffold
5 Incorrect 180 ms 73844 KB Error - Putting back a color when it is already on the scaffold
6 Incorrect 174 ms 73844 KB Error - Putting back a color when it is already on the scaffold
7 Incorrect 167 ms 73696 KB Error - Putting back a color when it is already on the scaffold
8 Incorrect 186 ms 73824 KB Error - Putting back a color when it is already on the scaffold
9 Incorrect 185 ms 73844 KB Error - Putting back a color when it is already on the scaffold
10 Incorrect 142 ms 72544 KB Error - Not putting back color when it is not on the scaffold