Submission #233594

#TimeUsernameProblemLanguageResultExecution timeMemory
233594sahil_kCombo (IOI18_combo)C++14
0 / 100
0 ms200 KiB
#include "combo.h" #include <vector> using namespace std; string guess_sequence (int n) { string c0 = ""; vector<string> opts; if (press("AB")) { if (press("A")) { c0 = "A"; opts = {"B", "X", "Y"}; } else{ c0 = "B"; opts = {"A", "X", "Y"}; } } else { if (press("X")) { c0 = "X"; opts = {"A", "B", "Y"}; } else { c0 = "Y"; opts = {"A", "B", "X"}; } } string ans = c0; string q; for (int i=1; i<n-1; i++) { q = ans+opts[0]; for (int j=0; j<3; j++) { q += ans+opts[1]+opts[j]; } int l = press(q); if (l == i) { ans += opts[2]; } else if (l == i+1) { ans += opts[0]; } else { ans += opts[1]; } } if (n > 1) { if (press(ans+opts[0])) { ans += opts[0]; } else if (press(ans+opts[1])) { ans += opts[1]; } else { ans += opts[2]; } } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...