답안 #547163

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
547163 2022-04-09T18:08:11 Z Leo121 최후의 만찬 (IOI12_supper) C++14
0 / 100
16 ms 3440 KB
#include <bits/stdc++.h>
#include "advisor.h"
#define forn(i, a, b) for(int i = int(a); i <= int(b); ++ i)
using namespace std;
void ComputeAdvice(int *C, int N, int K, int M) {
    int bits = log2(N);
    forn(i, 0, N - 1){
        forn(j, 0, bits){
            ((C[i] & (1 << j))) ? WriteAdvice('1') : WriteAdvice('0');
        }
    }
}
#include <bits/stdc++.h>
#include "assistant.h"
#define forn(i, a, b) for(int i = int(a); i <= int(b); ++ i)
using namespace std;
const int lim = 1e5;
bool cubeta[lim + 2];
int apu[lim + 2];
struct ura{
    int numero, sigaparicion;
    const bool operator < (const ura & a) const {
        if(sigaparicion == a.sigaparicion){
            return numero < a.numero;
        }
        return sigaparicion > a.sigaparicion;
    }
};
priority_queue<ura> pq;
priority_queue<ura> pqinv;
vector<int> pos[lim + 2];
void Assist(unsigned char *A, int N, int K, int R) {
    forn(i, 0, K - 1){
        cubeta[i] = 1;
    }
    forn(i, 0, N - 1){
        apu[i]= 0;
    }
    int bits = log2(N);
    int numero;
    forn(i, 0, N - 1){
        numero = 0;
        forn(j, 0, bits){
            if(A[(i * (bits + 1)) + j] == '1'){
                numero |= (1 << j);
            }
        }
        pos[numero].push_back(i);
    }
    forn(i, 0, K - 1){
        pq.push({i, pos[i][apu[i]]});
        pqinv.push({i, -1 * pos[i][apu[i]]});
    }
    forn(i, 0, N - 1){
        pos[i].push_back(N);
    }
    int sig;
    ura aux;
    forn(i, 0, N - 1){
        sig = GetRequest();
        if(cubeta[sig]){
            continue;
        }
        cubeta[sig] = 1;
        while(!pqinv.empty()){
            aux = pqinv.top();
            if(cubeta[aux.numero]){
                if(-1 * aux.sigaparicion < i){
                    if(pos[aux.numero][apu[aux.numero]] == aux.sigaparicion){
                        apu[aux.numero] ++;
                        if(aux.sigaparicion != N){
                            pq.push({i, pos[aux.numero][apu[aux.numero]]});
                            pq.push({i, -1 * pos[aux.numero][apu[aux.numero]]});
                        }
                    }
                }
            }
            if(-1 * aux.sigaparicion >= i){
                break;
            }
            pqinv.pop();
        }
        aux = pq.top();
        PutBack(aux.numero);
        apu[aux.numero] ++;
        cubeta[aux.numero] = 0;
    }
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 2940 KB Error - advice must be 0 or 1
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 3088 KB Error - advice must be 0 or 1
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 8 ms 3328 KB Error - advice must be 0 or 1
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 2940 KB Error - advice must be 0 or 1
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 10 ms 3340 KB Error - advice must be 0 or 1
2 Incorrect 12 ms 3416 KB Error - advice must be 0 or 1
3 Incorrect 9 ms 3392 KB Error - advice must be 0 or 1
4 Incorrect 16 ms 3440 KB Error - advice must be 0 or 1
5 Incorrect 16 ms 3348 KB Error - advice must be 0 or 1
6 Incorrect 11 ms 3340 KB Error - advice must be 0 or 1
7 Incorrect 15 ms 3348 KB Error - advice must be 0 or 1
8 Incorrect 11 ms 3352 KB Error - advice must be 0 or 1
9 Incorrect 12 ms 3340 KB Error - advice must be 0 or 1
10 Incorrect 9 ms 3348 KB Error - advice must be 0 or 1