답안 #558191

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
558191 2022-05-07T03:15:10 Z Jesus 최후의 만찬 (IOI12_supper) C++14
0 / 100
60 ms 6136 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;
            andamio[pos]=C[i];
            colores[andamio[pos]].second=-1;
        }
        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(an[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]);
    }
}

Compilation message

advisor.cpp: In function 'void ComputeAdvice(int*, int, int, int)':
advisor.cpp:33:32: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
   33 |         if(colores[C[i]].second=-1){
      |            ~~~~~~~~~~~~~~~~~~~~^~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 620 KB Output isn't correct - not an optimal way
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 1020 KB Output isn't correct - not an optimal way
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 44 ms 5040 KB Output isn't correct - not an optimal way
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 828 KB Output isn't correct - not an optimal way
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 56 ms 5900 KB Output isn't correct - not an optimal way
2 Incorrect 60 ms 5884 KB Output isn't correct - not an optimal way
3 Incorrect 55 ms 5972 KB Output isn't correct - not an optimal way
4 Incorrect 54 ms 6136 KB Output isn't correct - not an optimal way
5 Incorrect 55 ms 6024 KB Output isn't correct - not an optimal way
6 Incorrect 51 ms 5992 KB Output isn't correct - not an optimal way
7 Incorrect 56 ms 6068 KB Output isn't correct - not an optimal way
8 Incorrect 53 ms 5988 KB Output isn't correct - not an optimal way
9 Incorrect 57 ms 5908 KB Output isn't correct - not an optimal way
10 Incorrect 51 ms 5960 KB Output isn't correct - not an optimal way