제출 #254922

#제출 시각아이디문제언어결과실행 시간메모리
254922niyu콤보 (IOI18_combo)C++14
컴파일 에러
0 ms0 KiB
using namespace std;
#include "combo.h"

char c[] = {'A', 'B', 'X', 'Y'};
char s[3];
string ret;

string guess_sequence(int N) {
  if (press("AB")) {
    if (press("A")) {
      ret = "A";
      s = {"B", "X", "Y"};
    }
    else {
      ret = "B";
      s = {"A", "X", "Y"};
    }
  }
  else {
    if (press("X")) {
      ret = "X";
      s = {"A", "B", "Y"};
    }
    else {
      ret = "Y";
      s = {"A", "B", "X"};
    }
  }
  for (int i = 0; i < N - 2; i++) {
    ret += s[press(ret + s[2] + s[0] + ret + s[2] + s[1] + ret + s[2] + s[2] + ret + s[1]) - ret.size()];
  }
  if (press(ret + s[0]) == N) return (ret + s[0]);
  if (press(ret + s[1]) == N) return (ret + s[1]);
  return (ret + s[2]);
}


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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:12:9: error: assigning to an array from an initializer list
   12 |       s = {"B", "X", "Y"};
      |       ~~^~~~~~~~~~~~~~~~~
combo.cpp:16:9: error: assigning to an array from an initializer list
   16 |       s = {"A", "X", "Y"};
      |       ~~^~~~~~~~~~~~~~~~~
combo.cpp:22:9: error: assigning to an array from an initializer list
   22 |       s = {"A", "B", "Y"};
      |       ~~^~~~~~~~~~~~~~~~~
combo.cpp:26:9: error: assigning to an array from an initializer list
   26 |       s = {"A", "B", "X"};
      |       ~~^~~~~~~~~~~~~~~~~