Submission #1014936

#TimeUsernameProblemLanguageResultExecution timeMemory
1014936hyakupCombo (IOI18_combo)C++17
5 / 100
1 ms344 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; string guess_sequence(int N) { string resp; vector<char> opcoes; if( press("AB") ){ if( press("A") ) resp.push_back('A'), opcoes = { 'B', 'X', 'Y' }; else resp.push_back('B'), opcoes = { 'A', 'X', 'Y' }; } else{ if( press("X") ) resp.push_back('X'), opcoes = { 'B', 'A', 'Y' }; else resp.push_back('Y'), opcoes = { 'B', 'X', 'A' }; } for( int i = 1; i < N - 1; i++ ){ string s; for( char c : opcoes ) s = s + resp + opcoes[0] + c; s = s + resp + opcoes[1]; int aux = press(s); if( aux == i ) resp.push_back(opcoes[2]); else if( aux == i + 1 ) resp.push_back(opcoes[1]); else resp.push_back(opcoes[0]); } string s = resp + opcoes[0]; if( press(resp + opcoes[0]) == N ) return resp + opcoes[0]; if( press(resp + opcoes[1]) == N ) return resp + opcoes[1]; return resp + opcoes[2]; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...