Submission #321043

#TimeUsernameProblemLanguageResultExecution timeMemory
321043gustasonCombo (IOI18_combo)C++14
5 / 100
2 ms200 KiB
#include<bits/stdc++.h> #include "combo.h" using namespace std; string guess_sequence(int N) { string S = "", q; int x; if (press("AB") >= 1) { if (press("A") == 1) { S += 'A'; } else { S += 'B'; } } else { if (press("X") == 1) { S += 'X'; } else { S += 'Y'; } } int sz = 1; for(int i = 1; i < N-1; i++, sz++) { if (S[0] == 'A') { q = S + "B" + S + "XB" + S + "XX" + S + "XY"; x = press(q); if (x == sz) { S += "Y"; } else if (x == sz + 1) { S += "B"; } else { S += "X"; } } else if (S[0] == 'B') { q = S + "A" + S + "XA" + S + "XX" + S + "XY"; x = press(q); if (x == sz) { S += "Y"; } else if (x == sz + 1) { S += "A"; } else { S += "X"; } } else if (S[0] == 'X') { q = S + "A" + S + "BA" + S + "BB" + S + "BY"; x = press(q); if (x == sz) { S += "Y"; } else if (x == sz + 1) { S += "A"; } else { S += "B"; } } else { q = S + "A" + S + "XA" + S + "XB" + S + "XX"; x = press(q); if (x == sz) { S += "B"; } else if (x == sz + 1) { S += "A"; } else { S += "X"; } } } if (S[0] != 'A') { q = S + "A"; x = press(q); if (x == N) return q; } if (S[0] != 'B') { q = S + "B"; x = press(q); if (x == N) return q; } if (S[0] != 'X') { if (S[0] == 'Y') { S += 'X'; return S; } q = S + "X"; x = press(q); if (x == N) return q; } S += "Y"; return S; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...