Submission #235712

#TimeUsernameProblemLanguageResultExecution timeMemory
235712HeheheCombo (IOI18_combo)C++14
Compilation error
0 ms0 KiB
#include "combo.h" std::string guess_sequence(int N) { std::string t = ""; char first, a[5]; //first letter int p = press("AB"), k = 0, sz = 0; if(p == 2){ t += "AB"; first = 'A'; sz = 2; }else if(p == 1){ int x = press("A"); if(x)t += "A";else t += "B"; sz = 1; first = t[0]; }else{ int x = press("X"); if(x)t += "X";else t += "Y"; sz = 1; first = t[0]; } if (first != 'A') tr[k++] = 'A'; if (first != 'B') tr[k++] = 'B'; if (first != 'X') tr[k++] = 'X'; if (first != 'Y') tr[k++] = 'Y'; //middle while (sz <= N - 2){ std::string temp = t + a[0] + a[0]; temp += t + a[0] + a[1]; temp += t + a[0] + a[2]; temp += t + a[1]; p = press(temp); if (p - sz == 0) t += a[2]; else if (p - sz == 1) t += a[1]; else t += a[0]; sz++; } //end //check end if (sz == N - 1){ p = press(t + "A" + t + "B"); if (p == N){ p = press(t + "A"); if (p == N) t += "A"; else t += "B"; }else{ p = press(t + "X"); if (p == N) t += "X"; else t += "Y"; } } return t; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:24:23: error: 'tr' was not declared in this scope; did you mean 't'?
   24 |     if (first != 'A') tr[k++] = 'A';
      |                       ^~
      |                       t
combo.cpp:25:23: error: 'tr' was not declared in this scope; did you mean 't'?
   25 |     if (first != 'B') tr[k++] = 'B';
      |                       ^~
      |                       t
combo.cpp:26:23: error: 'tr' was not declared in this scope; did you mean 't'?
   26 |     if (first != 'X') tr[k++] = 'X';
      |                       ^~
      |                       t
combo.cpp:27:23: error: 'tr' was not declared in this scope; did you mean 't'?
   27 |     if (first != 'Y') tr[k++] = 'Y';
      |                       ^~
      |                       t