Submission #867747

#TimeUsernameProblemLanguageResultExecution timeMemory
867747ElenaBMCombo (IOI18_combo)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; string guess_sequence (int N){ vector<char>sec(3); string ans = ""; if (press("AB") > 0){ if (press("A")) { ans += 'A'; sec[0] = 'B'; } else { ans += 'B'; sec[0] = 'A'; } sec[1] = 'X'; sec[2] = 'Y'; } else{ sec[0] = 'A'; sec[1] = 'B'; if (press("X")) { ans += 'X'; sec[2] = 'Y'; } else { ans += 'Y'; } } for (int i = 2; i < N; ++i){ string guess = ans + sec[0] + ans + sec[1] + sec[0] + ans + sec[1] + sec[1] + ans + sec[1] + sec[2]; int x = press(guess); if (x == i) ans += sec[0]; else if (x == i+1) ans += sec[1]; else ans += sec[2]; } string fguess = ans + sec[0]; if (press(fguess) == N)return ans+ sec[0]; fguess = ans + sec[1]; else if (press(fguess) == N) return ans + sec[1]; else return ans + sec[2]; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:42:5: error: 'else' without a previous 'if'
   42 |     else if (press(fguess) == N) return ans + sec[1];
      |     ^~~~