제출 #642577

#제출 시각아이디문제언어결과실행 시간메모리
642577superuknown콤보 (IOI18_combo)C++14
5 / 100
1 ms208 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; 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...