Submission #803726

#TimeUsernameProblemLanguageResultExecution timeMemory
803726ALeonidouCombo (IOI18_combo)C++17
Compilation error
0 ms0 KiB
#include "combo.h" using namespace std; #define ll long long string guess_sequence(int n) { string p, s = ""; string w = "ABXY"; if (n == 1){ ll a = press("A"), b = press("B"), x = press("X"); if (a) return "A"; else if (b) return "B"; else if (x) return "X"; return "Y"; } //find first letter (3 operations) ll f = 0, x = press("AB"); if (x){ x = press("A"); if (x) f= 0; else f = 1; } else{ x = press("X"); if (x) f = 2; else f = 3; } s += w[f]; w.erase(w.begin() + f); if (n == 1) return s; //find all letters until n-1 (n-2 operations) for (ll i =1; i<n-1; i++){ p = s + w[0] + s + w[1] + w[0] + s + w[1] + w[1] + s + w[1] + w[2]; x = press(p); if (x == i) s += w[2]; else if (x == i+1) s += w[0]; else s += w[1]; } //find last letter (2 operations) a = press(s + w[0]), b = press(s + w[1]); if (a == b) s += w[2]; else if (a > b) s += w[0]; else s += w[1]; return s; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:44:5: error: 'a' was not declared in this scope
   44 |     a = press(s + w[0]), b = press(s + w[1]);
      |     ^
combo.cpp:44:26: error: 'b' was not declared in this scope
   44 |     a = press(s + w[0]), b = press(s + w[1]);
      |                          ^