제출 #127409

#제출 시각아이디문제언어결과실행 시간메모리
127409AlexLuchianov콤보 (IOI18_combo)C++14
100 / 100
59 ms756 KiB
#include "combo.h" #include <iostream> #include <fstream> #include <cstring> using namespace std; std::string guess_sequence(int N) { std::string p = ""; if(0 < press("AB")) if(press("A")) p = "A"; else p = "B"; else if(press("Y")) p = "Y"; else p = "X"; string init = p; for(int i = 2 ; i < N ; i++){ if(init == "A") { string que = p + "X" + p + "YX" + p + "YY" + p + "YB"; int coins = press(que); if(coins == i - 1) p += "B"; else if(coins == i) p += "X"; else p += "Y"; } else if(init == "B"){ string que = p + "X" + p + "YX" + p + "YY" + p + "YA"; int coins = press(que); if(coins == i - 1) p += "A"; else if(coins == i) p += "X"; else p += "Y"; } else if(init == "X"){ string que = p + "B" + p + "YB" + p + "YY" + p + "YA"; int coins = press(que); if(coins == i - 1) p += "A"; else if(coins == i) p += "B"; else p += "Y"; } else { string que = p + "X" + p + "AX" + p + "AA" + p + "AB"; int coins = press(que); if(coins == i - 1) p += "B"; else if(coins == i) p += "X"; else p += "A"; } } if(1 < N){ if(press(p + "X" + p + "Y") == N) if(press(p + "X") == N) p += "X"; else p += "Y"; else if(press(p + "A") == N) p += "A"; else p += "B"; } return p; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...