제출 #87113

#제출 시각아이디문제언어결과실행 시간메모리
87113mikigrubic콤보 (IOI18_combo)C++14
100 / 100
52 ms468 KiB
#include <combo.h> std::string guess_sequence(int N) { using namespace std; string s; int a = press("AB"); int b = press("BX"); char c1, c2, c3; if(a > 0 && b == 0){ s = "A"; c1 = 'B'; c2 = 'X'; c3 = 'Y'; } else if(a > 0 && b > 0){ s = "B"; c1 = 'A'; c2 = 'X'; c3 = 'Y'; } else if(a == 0 && b > 0){ s = "X"; c1 = 'A'; c2 = 'B'; c3 = 'Y'; } else{ s = "Y"; c1 = 'A'; c2 = 'B'; c3 = 'X'; } for(int i = 1; i < N-1; ++i){ string s1 = s + c1 + s + c2 + c1 + s + c2 + c2 + s + c2 + c3; int x = press(s1); if(x == i + 1){ s += c1; } else if(x == i + 2){ s += c2; } else{ s += c3; } } if(N > 1){ a = press(s + c1); b = press(s + c2); if(a > N-1){ s += c1; } else if(b > N-1){ s += c2; } else{ s += c3; } } return s; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...