답안 #363019

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
363019 2021-02-05T02:47:06 Z 2qbingxuan 최후의 만찬 (IOI12_supper) C++14
0 / 100
453 ms 20416 KB
#include "advisor.h"
#include <bits/stdc++.h>
using namespace std;

void ComputeAdvice(int *C, int N, int K, int M) {
    const int LG = __lg(N) + 1;
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < LG; j++) {
            WriteAdvice(C[i] >> j & 1);
        }
    }
    // cerr << "C = ";
    // for (int i = 0; i < N; i++)
    //     cerr << C[i] << ' ';
    // cerr << '\n';
}
#include "assistant.h"
#include <bits/stdc++.h>
using namespace std;

const int maxn = 100025;

int C[maxn];
vector<int> last[maxn];
int scaffold[maxn];
bool onScaffold[maxn];

void Assist(unsigned char *A, int N, int K, int R) {
    const int LG = __lg(N) + 1;
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < LG; j++) {
            C[i] |= A[i*LG + j] * (1<<j);
        }
    }
    // cerr << "C = ";
    // for (int i = 0; i < N; i++)
    //     cerr << C[i] << ' ';
    // cerr << '\n';
    
    auto getLast = [](int i) {
        return last[i].empty()
            ? maxn
            : last[i].back();
    };

    for (int i = N-1; i >= 0; i--)
        last[C[i]].push_back(i);
    set<pair<int,int>, greater<>> st; // last, j
    for (int i = 0; i < K; i++) {
        scaffold[i] = i;
        onScaffold[i] = true;
        st.insert({ getLast(i), i });
    }


    for (int i = 0; i < N; i++) {
        int req = GetRequest();
        if (!onScaffold[req]) {
            int pos = st.begin() -> second;
            st.erase(st.begin());
            last[req].pop_back();
            st.insert({ getLast(req), pos });
            PutBack(scaffold[pos]);
            scaffold[pos] = req;
            onScaffold[scaffold[pos]] = false;
            onScaffold[req] = true;
        }
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 3284 KB Output is correct
2 Incorrect 3 ms 3212 KB Error - Not putting back color when it is not on the scaffold
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 38 ms 4544 KB Error - Not putting back color when it is not on the scaffold
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 359 ms 15872 KB Error - Not putting back color when it is not on the scaffold
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 3264 KB Error - advice is too long
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 453 ms 18940 KB Error - Not putting back color when it is not on the scaffold
2 Incorrect 450 ms 19400 KB Error - Not putting back color when it is not on the scaffold
3 Incorrect 444 ms 19104 KB Error - Not putting back color when it is not on the scaffold
4 Incorrect 449 ms 19180 KB Error - Not putting back color when it is not on the scaffold
5 Incorrect 447 ms 19104 KB Error - Not putting back color when it is not on the scaffold
6 Incorrect 443 ms 19228 KB Error - Not putting back color when it is not on the scaffold
7 Incorrect 441 ms 19484 KB Error - Not putting back color when it is not on the scaffold
8 Incorrect 442 ms 19380 KB Error - Not putting back color when it is not on the scaffold
9 Incorrect 443 ms 19076 KB Error - Not putting back color when it is not on the scaffold
10 Incorrect 450 ms 20416 KB Error - Not putting back color when it is not on the scaffold