답안 #430155

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
430155 2021-06-16T11:44:01 Z oscar1f 최후의 만찬 (IOI12_supper) C++17
컴파일 오류
0 ms 0 KB
#include<bits/stdc++.h>
#include "advisor.h"
 
using namespace std;
 
const int NB_BITS=13,MAX_COUL=100*1000,INFINI=1000*1000*1000;
set<int> date[MAX_COUL];
int pres[MAX_COUL];
set<pair<int,int>> proch;
set<int>::iterator it;
set<pair<int,int>>::iterator it2;
 
void crypte(int nb) {
  cout<<nb<<endl;
  for (int i=0;i<NB_BITS;i++) {
    WriteAdvice(char(int('0')+nb%2));
    //cout<<char(int('0')+nb%2)<<" ";
    nb/=2;
  }
}
 
void ComputeAdvice(int *ajout, int nbCoul, int taille, int tailleMax) {
  for (int i=0;i<nbCoul;i++) {
    date[i].insert(INFINI);
  }
  for (int i=0;i<nbCoul;i++) {
    date[ajout[i]].insert(i);
  }
  for (int i=0;i<taille;i++) {
    it=date[i].begin();
    proch.insert(make_pair(*it,i));
    pres[i]=1;
  }
  for (int i=0;i<nbCoul;i++) {
    if (pres[ajout[i]]==1) {
      crypte(nbCoul);
      proch.erase(make_pair(i,ajout[i]));
      it=date[ajout[i]].lower_bound(i+1);
      proch.insert(make_pair(*it,ajout[i]));
    }
    else {
      it2=proch.lower_bound(make_pair(INFINI,INFINI));
      it2--;
      crypte((*it2).second);
      pres[(*it2).second]=0;
      proch.erase(*it2);
      it=date[ajout[i]].lower_bound(i+1);
      pres[ajout[i]]=1;
      proch.insert(make_pair(*it,ajout[i]));
    }
  }
}
#include<bits/stdc++.h>
#include "assistant.h"
using namespace std;
 
const int NB_BITS=13;
string ligne;
 
int decrypte(int pos) {
  int rep=0,multi=1;
  for (int i=NB_BITS*pos;i<NB_BITS*(pos+1);i++) {
    rep+=multi*(int(ligne[i])-int('0'));
    multi*=2;
  }
  return rep;
}
 
void Assist(string AA, int NN, int KK, int RR) {
  ligne=AA;
  int nb;
  for (int i=0;i<NN;i++) {
    nb=decrypte(i);
    cout<<nb<<endl;
    nb=GetRequest();
    nb=decrypte(i);
    if (nb!=NN) {
      PutBack(nb);
    }
  }
}

Compilation message

/usr/bin/ld: /tmp/cchskfFQ.o: in function `main':
assistant_grader.cpp:(.text.startup+0x21e): undefined reference to `Assist(unsigned char*, int, int, int)'
collect2: error: ld returned 1 exit status