답안 #1005954

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1005954 2024-06-23T08:56:48 Z 정민찬(#10832) 최후의 만찬 (IOI12_supper) C++14
0 / 100
45 ms 69380 KB
#include "advisor.h"
#include <bits/stdc++.h>

using namespace std;

const int B = 13;

void ComputeAdvice(int *C, int N, int K, int M) {
    vector<queue<int>> q(N);
    for (int i=0; i<N; i++) {
        q[C[i]].push(i);
    }
    priority_queue<pair<int,int>> pq;
    for (int i=0; i<K; i++) {
        if (q[i].empty()) pq.push({N, i});
        else pq.push({q[i].front(), i});
    }
    vector<int> use(N, 0);
    for (int i=0; i<K; i++) use[i] = 1;
    for (int i=0; i<N; i++) {
        int x = -1;
        if (!use[C[i]]) {
            while (true) {
                int tp = pq.top().second;
                int cst = pq.top().first;
                pq.pop();
                if (!q[tp].empty() && q[tp].front() != cst) continue;
                if (q[tp].empty() && cst != N) continue;
                if (!use[tp]) continue;
                x = tp;
                break;
            }
            use[x] = 0;
            use[C[i]] = 1;
        }
        q[C[i]].pop();
        if (q[C[i]].empty()) pq.push({N, C[i]});
        else pq.push({q[C[i]].front(), C[i]});
        x ++;
        for (int bit=0; bit<B; bit++) {
            WriteAdvice((1<<bit) & x);
        }
    }
}
#include "assistant.h"

#include <bits/stdc++.h>

using namespace std;

const int B = 13;

void Assist(unsigned char *A, int N, int K, int R) {
    for (int i=0; i<N; i++) {
        int x = 0;
        for (int bit=0; bit<B; bit++) {
            x ^= A[i*B+bit] << bit;
        }
        GetRequest();
        x --;
        if (x != -1) {
            PutBack(x);
        }
    }
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 792 KB Error - advice must be 0 or 1
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 7716 KB Error - advice must be 0 or 1
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 28 ms 55804 KB Error - advice must be 0 or 1
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 3612 KB Error - advice must be 0 or 1
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 45 ms 69172 KB Error - advice must be 0 or 1
2 Incorrect 36 ms 69332 KB Error - advice must be 0 or 1
3 Incorrect 35 ms 69364 KB Error - advice must be 0 or 1
4 Incorrect 34 ms 69180 KB Error - advice must be 0 or 1
5 Incorrect 36 ms 69376 KB Error - advice must be 0 or 1
6 Incorrect 36 ms 69360 KB Error - advice must be 0 or 1
7 Incorrect 35 ms 69044 KB Error - advice must be 0 or 1
8 Incorrect 37 ms 69380 KB Error - advice must be 0 or 1
9 Incorrect 36 ms 69380 KB Error - advice must be 0 or 1
10 Incorrect 39 ms 69372 KB Error - advice must be 0 or 1