Submission #547167

# Submission time Handle Problem Language Result Execution time Memory
547167 2022-04-09T18:16:50 Z Leo121 Last supper (IOI12_supper) C++14
0 / 100
360 ms 19400 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, N - 1){
        pos[i].push_back(N);
    }
    forn(i, 0, K - 1){
        pq.push({i, pos[i][apu[i]]});
        pqinv.push({i, -1 * pos[i][apu[i]]});
    }
    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;
    }
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 2952 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 31 ms 4380 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 287 ms 16080 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 2 ms 2940 KB Error - advice is too long
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 360 ms 19248 KB Error - Putting back a color that is not on the scaffold
2 Incorrect 353 ms 19268 KB Error - Putting back a color that is not on the scaffold
3 Incorrect 343 ms 19364 KB Error - Putting back a color that is not on the scaffold
4 Incorrect 344 ms 19216 KB Error - Putting back a color that is not on the scaffold
5 Incorrect 344 ms 19284 KB Error - Putting back a color that is not on the scaffold
6 Incorrect 343 ms 19368 KB Error - Putting back a color that is not on the scaffold
7 Incorrect 342 ms 19188 KB Error - Putting back a color that is not on the scaffold
8 Incorrect 341 ms 19400 KB Error - Putting back a color that is not on the scaffold
9 Incorrect 343 ms 19348 KB Error - Putting back a color that is not on the scaffold
10 Incorrect 348 ms 19140 KB Error - Putting back a color that is not on the scaffold