Submission #1007415

#TimeUsernameProblemLanguageResultExecution timeMemory
1007415teeslaCombo (IOI18_combo)C++14
5 / 100
2 ms384 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; 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...