답안 #38848

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
38848 2018-01-07T07:56:09 Z andy627 최후의 만찬 (IOI12_supper) C++14
0 / 100
391 ms 15232 KB
#include "advisor.h"

#include <stdio.h>
#include <vector>
#include <algorithm>
using namespace std;

int n,k,m,bit;
int c[111111];
int cnt[111111],pos[111111],col[111111];
vector<int> era;

void wri(int num){
    for(int i=0;i<bit;i++){
        if(num&(1<<i)) WriteAdvice(1);
        else WriteAdvice(0);
    }
}

void ComputeAdvice(int *C,int N,int K,int M){
    n=N; k=K; m=M;
    for(int i=0;i<n;i++) c[i]=C[i];

    for(;k>(1<<bit);bit++);

    //printf("%d\n",bit);

    for(int i=0;i<n;i++) cnt[c[i]]++;
    for(int i=0;i<k;i++) col[i]=i;
    for(int i=0;i<k;i++) pos[i]=i;
    for(int i=k;i<n;i++) pos[i]=-1;

    for(int i=0;i<n;i++){
        if(pos[c[i]]>=0) wri(0);
        else{
            if(era.empty()){
                pos[c[i]]=0;
                pos[col[0]]=-1;
                col[0]=c[i];

                wri(1);
            }
            else{
                int eco=era.back(); era.pop_back();
                pos[c[i]]=pos[eco];
                pos[eco]=-1;
                col[pos[c[i]]]=c[i];

                wri(pos[c[i]]+1);
            }
        }

        cnt[c[i]]--;
        if(!cnt[c[i]]) era.push_back(c[i]);
    }
}
#include "assistant.h"

#include <stdio.h>

int nn,kk,rr,bitt,poss;
int a[111111],coll[111111];

int read_(){
    int num=0;
    for(int i=0;i<bitt;i++) num+=a[poss+i]*(1<<i);
    poss+=bitt;

    return num;
}

void Assist(unsigned char *A, int N, int K, int R) {
    nn=N; kk=K; rr=R;
    for(int i=0;i<nn;i++) a[i]=A[i];

    for(;kk>(1<<bitt);bitt++);
    for(int i=0;i<kk;i++) coll[i+1]=i;

    for(int i=0;i<nn;i++){
        int num=read_(); num--;
        //printf("%d ",num);

        if(num){
            PutBack(coll[num]);
            coll[num]=GetRequest();
        }
    }
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 608 KB Error - GetRequest() must be called N times
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 27 ms 1848 KB Error - Putting back a color when it is already on the scaffold
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 276 ms 12008 KB Error - Putting back a color when it is already on the scaffold
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 12008 KB Error - advice is too long
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 337 ms 14464 KB Error - Putting back a color when it is already on the scaffold
2 Incorrect 333 ms 14648 KB Error - Putting back a color when it is already on the scaffold
3 Incorrect 339 ms 14984 KB Error - Putting back a color when it is already on the scaffold
4 Incorrect 347 ms 14984 KB Error - Putting back a color when it is already on the scaffold
5 Incorrect 335 ms 14984 KB Error - Putting back a color when it is already on the scaffold
6 Incorrect 347 ms 15000 KB Error - Putting back a color when it is already on the scaffold
7 Incorrect 391 ms 15000 KB Error - Putting back a color when it is already on the scaffold
8 Incorrect 354 ms 15064 KB Error - Putting back a color when it is already on the scaffold
9 Incorrect 343 ms 15064 KB Error - Putting back a color when it is already on the scaffold
10 Incorrect 360 ms 15232 KB Error - Putting back a color when it is already on the scaffold