제출 #654671

#제출 시각아이디문제언어결과실행 시간메모리
654671atigun콤보 (IOI18_combo)C++14
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h>

using namespace std;
typedef long long ll;

string guess_sequence(int N){
  map<int, string> M = {{1, "A"}, {2, "B"}, {3, "X"}, {4, "Y"}};
  set<int> ava = {1, 2, 3, 4};
  string s = "";
  if(press(M[1])){
    ava.erase(1);
    s+= M[1];
  }else if(press(M[2])){
    ava.erase(2);
    s+= M[2];
  }else if(press(M[3])){
    ava.erase(3);
    s+= M[3];
  }else{
    ava.erase(4);
    s+= M[4];
  }
  vector<int> ch;
  for(int i : ava)
    ch.push_back(i);
  for(int i = 2; i <= N-1; i++){
    string ask = s + M[ch[0]] + s + M[ch[1]]+M[ch[0]] + s + M[ch[1]]+M[ch[1]] + s + M[ch[1]]+M[ch[2]];
    int ret = press(ask);
    if(ret == i-1+1){
      s+= M[ch[0]];
    }else if(ret == i-1+2){
      s+= M[ch[1]];
    }else if(ret == i-1){
      s+= M[ch[2]];
    }
  }
  if(press(s+M[ch[0]]) == N){
    s+= M[ch[0]];
  }else if(press(s+M[ch[1]]) == N){
    s+= M[ch[1]];
  }else{
    s+= M[ch[2]];
  }
  return s;
}

컴파일 시 표준 에러 (stderr) 메시지

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:10:6: error: 'press' was not declared in this scope
   10 |   if(press(M[1])){
      |      ^~~~~
combo.cpp:28:15: error: 'press' was not declared in this scope
   28 |     int ret = press(ask);
      |               ^~~~~
combo.cpp:37:6: error: 'press' was not declared in this scope
   37 |   if(press(s+M[ch[0]]) == N){
      |      ^~~~~