Submission #1244211

#TimeUsernameProblemLanguageResultExecution timeMemory
1244211greenbinjackCombo (IOI18_combo)C++20
Compilation error
0 ms0 KiB
#include "combo.h"

string guess_sequence(int N) {
  string pref = "";
  vector <char> ch;
  if (press ("A") > 0) {
    pref += 'A', ch = {'B', 'X', 'Y'};
  } else if (press ("B") > 0) {
    pref += 'B', ch = {'A', 'X', 'Y'};
  } else if (press ("X") > 0) {
    pref += 'X', ch = {'A', 'B', 'Y'};
  } else {
    pref += 'Y', ch = {'A', 'B', 'X'};
  }

  for (int i = 1; i <= N - 2; i++) {
    int x = press (pref + ch[0] + pref + ch[1] + ch[0] + pref + ch[1] + ch[1] + pref + ch[1] + ch[2]);
    if (x == i + 2) pref += ch[1];
    else if (x == i + 1) pref += ch[0];
    else pref += ch[2];
  }

  if (press (pref + ch[0] + pref + ch[1]) == N) {
    if (press (pref + ch[0]) == N) {
      pref += ch[0];
    } else {
      pref += ch[1];
    }
  } else {
    pref += ch[2];
  }

  return pref;
}

Compilation message (stderr)

combo.cpp:3:1: error: 'string' does not name a type; did you mean 'stdin'?
    3 | string guess_sequence(int N) {
      | ^~~~~~
      | stdin