Submission #823529

#TimeUsernameProblemLanguageResultExecution timeMemory
823529handlewastakenCombo (IOI18_combo)C++17
Compilation error
0 ms0 KiB
#include "combo.h" #include <string> using namespace std; string guess_sequence(int N) { string s, t; int i, er = press("AB"), se = press("AX"); if (er > 0) { if (se > 0) t = "ABXY"; else t = "BXYA"; } else { if (se > 0) t = "XYAB"; else t = "YABX"; } s = t[0]; if (n == 1) return s; for (i = 2; i < n; i++) { er = press(s + t[1] + s + t[2] + t[1] + s + t[2] + t[2] + s + t[2] + t[3]); if (er == i) s += t[1]; else if (er == i + 1) s += t[2]; else s += t[3]; } er = press(s + t[1]); se = press(s + t[2]); if (er == n) s += t[1]; else if (se == n) s += t[2]; else s += t[3]; return s; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:23:9: error: 'n' was not declared in this scope
   23 |     if (n == 1)
      |         ^
combo.cpp:25:21: error: 'n' was not declared in this scope
   25 |     for (i = 2; i < n; i++)
      |                     ^
combo.cpp:37:15: error: 'n' was not declared in this scope
   37 |     if (er == n)
      |               ^