제출 #829344

#제출 시각아이디문제언어결과실행 시간메모리
829344abczz콤보 (IOI18_combo)C++14
100 / 100
29 ms600 KiB
#include "combo.h" #include <iostream> #define ll long long using namespace std; std::string guess_sequence(int N) { string S, T, X; ll x = press("AB"); if (x >= 1) { X += "XY"; x = press("A"); if (x >= 1) S += 'A', X += 'B'; else S += 'B', X += 'A'; } else { X += "AB"; x = press("X"); if (x >= 1) S += 'X', X += 'Y'; else S += 'Y', X += 'X'; } if (N == 1) return S; for (int i=1; i<N-1; ++i) { T = S + X[0] + X[0]; T += S + X[0] + X[1]; T += S + X[0] + X[2]; T += S + X[1]; x = press(T); if (x-i == 0) { S += X[2]; } else if (x-i == 1) { S += X[1]; } else S += X[0]; } T = S + X[0]; T += S + X[1]; x = press(T); if (x == N-1) S += X[2]; else { x = press(S+X[0]); if (x == N-1) S += X[1]; else S += X[0]; } return S; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...