Submission #1014940

#TimeUsernameProblemLanguageResultExecution timeMemory
1014940hyakupCombo (IOI18_combo)C++17
100 / 100
22 ms2004 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; #define bug(x) cout << #x << " " << x << endl; 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' }; } if( N == 1 ) return resp; 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]); } 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...