답안 #558568

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
558568 2022-05-07T14:32:46 Z Jesus 최후의 만찬 (IOI12_supper) C++14
0 / 100
56 ms 6276 KB
#include<bits/stdc++.h>
#include "advisor.h"

using namespace std;

pair<int,int> colores[100001];

int andamio[100001];

queue<int> libres;

void ComputeAdvice(int *C, int N, int K, int M){
    for(int i=0;i<N;i++){
        colores[i]={-1,-1};
    }
    for(int i=0;i<N;i++){
        if(i<K){
            andamio[i]=i;
            colores[i].second=i;
        }
        colores[C[i]].first=i;
    }
    for(int i=0;i<K;i++){
        if(colores[andamio[i]].first==-1) {
                WriteAdvice(0);
                libres.push(i);
        }
        else {
                WriteAdvice(1);
        }
    }

    for(int i=0;i<N;i++){
        if(colores[C[i]].second==-1){
            int pos=0;
            if(libres.size()>0){
                pos=libres.front();
                libres.pop();
            }
            colores[C[i]].second=pos;
            colores[andamio[pos]].second=-1;
            andamio[pos]=C[i];
        }
        if(colores[C[i]].first==i){
            libres.push(colores[C[i]].second);
            WriteAdvice(0);
        }
        else WriteAdvice(1);
    }

}


#include<bits/stdc++.h>
#include "assistant.h"

using namespace std;

queue<int> lib;

int an[100001];

int col[100001];

void Assist(unsigned char *A, int N, int K, int R){
    for(int i=0;i<N;i++){
        if(i<K){
            an[i]=i;
            col[i]=i;
            if(A[i]==0) lib.push(i);
        }
        else col[i]=-1;
    }
    for(int i=0;i<N;i++){
        int c=GetRequest();
        if(col[c]==-1){
            int pos=0;
            if(lib.size()>0){
                pos=lib.front();
                lib.pop();
            }
            PutBack(an[pos]);
            col[an[pos]]=-1;
            col[c]=pos;
            an[pos]=c;
        }
        if(A[i+K]==0) lib.push(col[c]);
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 524 KB Output is correct
2 Correct 1 ms 524 KB Output is correct
3 Correct 2 ms 656 KB Output is correct
4 Incorrect 2 ms 800 KB Output isn't correct - not an optimal way
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 6 ms 1024 KB Output isn't correct - not an optimal way
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 43 ms 5000 KB Output is correct
2 Correct 56 ms 6076 KB Output is correct
3 Correct 55 ms 6232 KB Output is correct
4 Correct 51 ms 6104 KB Output is correct
5 Incorrect 50 ms 5932 KB Output isn't correct - not an optimal way
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 816 KB Output is correct
2 Correct 3 ms 928 KB Output is correct
3 Correct 3 ms 824 KB Output is correct
4 Incorrect 3 ms 832 KB Output isn't correct - not an optimal way
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 48 ms 6032 KB Output isn't correct - not an optimal way
2 Correct 52 ms 6164 KB Output is correct - 122000 bits used
3 Correct 54 ms 6084 KB Output is correct - 125000 bits used
4 Correct 52 ms 6112 KB Output is correct - 125000 bits used
5 Correct 52 ms 6028 KB Output is correct - 125000 bits used
6 Correct 55 ms 6276 KB Output is correct - 125000 bits used
7 Correct 55 ms 6052 KB Output is correct - 124828 bits used
8 Correct 51 ms 6068 KB Output is correct - 124910 bits used
9 Correct 51 ms 6116 KB Output is correct - 125000 bits used
10 Correct 51 ms 6044 KB Output is correct - 125000 bits used