Submission #642578

#TimeUsernameProblemLanguageResultExecution timeMemory
642578superuknownCombo (IOI18_combo)C++14
100 / 100
34 ms532 KiB
#include "combo.h" #include <iostream> using namespace std; string guess_sequence(int N) { int coins = 1, p; string S = ""; char c; if (press("AB") > 0){ if (press("A") > 0) c = 'A'; else c = 'B'; } else if (press("X") > 0) c = 'X'; else c = 'Y'; S += c; if(N-1 > 0){ for(int i = 1; i < N-1; i++){ if (c == 'A'){ p = press(S + "BB" + S + "BX" + S + "BY" + S + "X"); if(p == coins+2) S += 'B'; else if(p == coins+1) S += 'X'; else S += 'Y'; } if (c == 'B'){ p = press(S + "AA" + S + "AX" + S + "AY" + S + "X"); if(p == coins+2) S += 'A'; else if(p == coins+1) S += 'X'; else S += 'Y'; } if (c == 'X'){ p = press(S + "AB" + S + "AA" + S + "AY" + S + "Y"); if(p == coins+2) S += 'A'; else if(p == coins+1) S += 'Y'; else S += 'B'; } if (c == 'Y'){ p = press(S + "AB" + S + "AX" + S + "AA" + S + "X"); if(p == coins+2) S += 'A'; else if(p == coins+1) S += 'X'; else S += 'B'; } coins++; } if(c == 'A'){ if(press(S + "B") > coins) S += 'B'; else if(press(S + "X") > coins) S += 'X'; else S += 'Y'; } if(c == 'B'){ if(press(S + "A") > coins) S += 'A'; else if(press(S + "X") > coins) S += 'X'; else S += 'Y'; } if(c == 'X'){ if(press(S + "B") > coins) S += 'B'; else if(press(S + "A") > coins) S += 'A'; else S += 'Y'; } if(c == 'Y'){ if(press(S + "B") > coins) S += 'B'; else if(press(S + "X") > coins) S += 'X'; else S += 'A'; } } return S; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...