Submission #984565

#TimeUsernameProblemLanguageResultExecution timeMemory
984565kachim2Combo (IOI18_combo)C++17
Compilation error
0 ms0 KiB
#include <iostream>

std::string guess_sequence(int N) {
  
  std::string S ;
  if (press("AB") != 0) {
    if (press("A") == 1) {
      S = "A";
    }
    else {
      S="B";
    }
  } else {
    if (press("X") == 1) {
      S = "X";
    }
    else {
      S = "Y";
      
    }
  }
  std::string A = "A", B = "B", C = "X";
  switch (S[0]) {
  case 'A':
    A = "Y";
    break;
  case 'B':
    B = "Y";
    break;
  case 'X':
    C = "Y";
    break;
  default:
    break;
  };
  for (int i = 1; i < N - 1; i++) {
    std::cerr << S + A + S + B + C + S + B + A << '\n';
    int ans = press(S + A + S + B + C + S + B + A + S + B + B);
    std::cerr << ans << '\n';
    if (ans == i+1) {
      S+=A;
    } else if (ans == i+2){
      S+=B;
    } else {
      S+=C;
    }
  }
  if(N!=1){
  if (press(S + A) == S.size()) {
    if (press(S + B) == S.size()) {
      S+= C;
    } else {
      S+=B;
    }
  } else {
    S+=A;
  }
  }
  std::cerr << S;
  return S;
}

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:6:7: error: 'press' was not declared in this scope
    6 |   if (press("AB") != 0) {
      |       ^~~~~
combo.cpp:38:15: error: 'press' was not declared in this scope
   38 |     int ans = press(S + A + S + B + C + S + B + A + S + B + B);
      |               ^~~~~
combo.cpp:49:7: error: 'press' was not declared in this scope
   49 |   if (press(S + A) == S.size()) {
      |       ^~~~~