Submission #1154608

#TimeUsernameProblemLanguageResultExecution timeMemory
1154608omtheprogrammer1콤보 (IOI18_combo)C++17
Compilation error
0 ms0 KiB



// int press(string s) {
//   return 0;
// }

string guess_sequence(int N) {
  string s, t;
  n = N;
  char first = '?';
  s = "ABXY";
  if (press("AB")) {
    if (press("A")) {
      first = 'A';
    }
    else {
      first = 'B';
    }
  }
  else {
    if (press("X")) {
      first = 'X';
    }
    else {
      first = 'Y';
    }
  }
  t = first;
  string keep = "";
  FOR(4) if (first != s[i])keep += s[i];
  FOR(i, 1, n) {
    if (i == n - 1) {
      if (press(t + keep[0]) == n) {
        t += keep[0];
      }
      else if (press(t + keep[1])) {
        t += keep[1];
      }
      else {
        t += keep[2];
      }
      return t;
    }
    string cur;
    cur = t + keep[0] + t + keep[1] + keep[0] + t + keep[1] + keep[1] + t + keep[1] + keep[2];
    int temp = press(cur);
    if (temp == i) {
      t += keep[2];
    }
    else if (temp == i + 1) {
      t += keep[0];
    }
    else {
      t += keep[1];
    }
  }
  return t;
}

// int main() {
//   fastio

// #ifdef LOCAL
//   auto begin = std::chrono::high_resolution_clock::now();
//   freopen("input.txt", "r", stdin);
//   freopen("output.txt", "w", stdout);
//   freopen("error.txt", "w", stderr);
// #endif

//   ll tc = 1;
//   // cin >> tc;
//   // for (int t = 0; t < tc; t++) solve(t);
// #ifdef LOCAL
//   auto end = std::chrono::high_resolution_clock::now();
//   auto elapsed = std::chrono::duration_cast<std::chrono::nanoseconds>(end - begin);
//   // cerr << "Time measured: " << elapsed.count() * 1e-9 << " seconds.\n";
// #endif
// }

Compilation message (stderr)

combo.cpp:8:1: error: 'string' does not name a type
    8 | string guess_sequence(int N) {
      | ^~~~~~