Submission #235635

#TimeUsernameProblemLanguageResultExecution timeMemory
235635dannber_BRCombo (IOI18_combo)C++14
Compilation error
0 ms0 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; string Btns[] = {"A","B","X","Y"}; string guess_sequence(int N) { string Btns[] = {"A","B","X","Y"}; string s = ""; int p = 0; if (press(Btns[0]) == 1) { s += Btns[0]; p = 0; for(int i = 0;i < 4;i++) { if (i != p) { if (press(s + Btns[i]) == 2) s += Btns[i]; } } } else if (press(Btns[1]) == 1) { s += Btns[1]; p = 1; for(int i = 0;i < 4;i++) { if (i != p) { if (press(s + Btns[i]) == 2) s += Btns[i]; } } } else if (press(Btns[2]) == 1){ s += Btns[2]; p = 2; for(int i = 0;i < 4;i++) { if (i != p) { if (press(s + Btns[i]) == 2) s += Btns[i]; } } } else if (press(Btns[3]) == 1) { s += Btns[3]; p = 3; for(int i = 0;i < 4;i++) { if (i != p) { if (press(s + Btns[i]) == 2) s += Btns[i]; } } } int last_one = 0; for(int i = 3;i <= N;i++) { bool fact = false; if (press(s + Btns[last_one]) == i) { s += Btns[j]; fact = true; break; } else { for(int j = 0;j <= 3;j++) { if(j != p && !fact) { if(press(s + Btns[j]) == i) { s += Btns[j]; fact = true; last_one = j; break; } } } } } return s; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:65:21: error: 'j' was not declared in this scope
   65 |           s += Btns[j];
      |                     ^