제출 #1007420

#제출 시각아이디문제언어결과실행 시간메모리
1007420teesla콤보 (IOI18_combo)C++14
100 / 100
18 ms1816 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; string guess_sequence(int N) { vector<char> possivel; string res = ""; string s = "AB"; int cont = press(s); if(cont >= 1){ if(press("A") == 1){ res += 'A'; possivel = {'B', 'X', 'Y'}; } else {res += 'B'; possivel = {'A', 'X', 'Y'};} } else{ if(press("X")==1){res += 'X';possivel = {'B', 'A', 'Y'};} else{res += 'Y'; possivel = {'B', 'X', 'A'};} } //cout << res << endl; if(N== 1) return res; for(int i=1; i<N-1; i++){ string pref =""; for(auto j: possivel){ pref += res; pref += possivel[0]; pref += j; } pref += res; pref += possivel[1]; cont = press(pref); if(cont == i+1) res += possivel[1]; else if(cont == i+2) res+= possivel[0]; else res += possivel[2]; } cont = press(res + possivel[0]); if(cont == N){ res += possivel[0]; return res; } cont= press(res + possivel[1]); if(cont == N){ res += possivel[1]; return res; } res += possivel[2]; return res; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...