Submission #909941

#TimeUsernameProblemLanguageResultExecution timeMemory
909941raphaelpCombo (IOI18_combo)C++14
100 / 100
14 ms1860 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; string guess_sequence(int N) { string ans; int temp = press("AB"); if (temp) { temp = press("A"); if (temp) ans.push_back('A'); else ans.push_back('B'); } else { temp = press("X"); if (temp) ans.push_back('X'); else ans.push_back('Y'); } if (N == 1) return ans; string left; if (ans != "A") left.push_back('A'); if (ans != "B") left.push_back('B'); if (ans != "X") left.push_back('X'); if (ans != "Y") left.push_back('Y'); for (int i = 1; i < N - 1; i++) { string p = ans; p += left[0]; for (int j = 0; j < 3; j++) { p += ans; p += left[1]; p += left[j]; } temp = press(p); if (temp == i) ans.push_back(left[2]); if (temp == i + 1) ans.push_back(left[0]); if (temp == i + 2) ans.push_back(left[1]); } string p = ans + left[0]; temp = press(p); if (temp == N) ans.push_back(left[0]); else { p = ans + left[1]; temp = press(p); if (temp == N) ans.push_back(left[1]); else ans.push_back(left[2]); } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...