Submission #734800

#TimeUsernameProblemLanguageResultExecution timeMemory
734800CutebolCombo (IOI18_combo)C++17
100 / 100
47 ms476 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std ; string guess_sequence( int n ) { string ans = "" ; vector <char> vec = { 'A' , 'B' , 'X' , 'Y' } ; int f = 0 ; int x = press ( "AB" ) ; if (x>0){ x = press("A") ; if(x>0) f = 0 ; else f = 1 ; } else{ x = press("X") ; if(x>0) f = 2 ; else f = 3 ; } ans += vec[f] ; swap ( vec[3] , vec[f] ) ; for ( int i = 1 ; i < n-1 ; i ++ ){ string cur = "" ; for ( int j = 0 ; j < 3 ; j ++ ) cur += ans+vec[0]+vec[j] ; cur += ans+vec[1] ; x = press(cur) ; if ( x == (int)ans.size() ) ans += vec[2] ; else if ( x-1 == (int)ans.size() ) ans += vec[1] ; else ans += vec[0] ; } if ( n != 1 ){ x = press( ans+vec[0]+ans+vec[1] ) ; if ( x == (int)ans.size() ) ans += vec[2] ; else{ x = press(ans+vec[0]) ; if(x>(int)ans.size()) ans += vec[0] ; else ans += vec[1] ; } } return ans ; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...