제출 #235654

#제출 시각아이디문제언어결과실행 시간메모리
235654lyc콤보 (IOI18_combo)C++14
0 / 100
1 ms240 KiB
#include "combo.h" #include <iostream> #include <cassert> using namespace std; int q = 0; int ask(string s) { ++q; assert(q <= 8000); //cout << "PRESS " << s << endl; return press(s); } std::string guess_sequence(int N) { string A[] = { "A", "B", "X", "Y" }; string S = ""; if (ask(A[0] + A[1])) { if (ask(A[0])) { S += A[0]; } else { S += A[1]; swap(A[1],A[0]); } } else { if (ask(A[2])) { S += A[2]; swap(A[2],A[0]); } else { S += A[3]; swap(A[2],A[0]); } } if (N == 1) return S; for (int i = 1; i <= N-2; ++i) { string a = S + A[3] + A[1]; string b = S + A[3] + A[2]; string c = S + A[3] + A[3]; string d = S + A[2]; int x = ask(a + b + c + d); S += A[x-i+1]; } if (ask(S + A[1]) == N) S += A[1]; else if (ask(S + A[2]) == N) S += A[2]; else S += A[3]; return S; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...