Submission #101779

#TimeUsernameProblemLanguageResultExecution timeMemory
101779oToToTCombo (IOI18_combo)C++17
100 / 100
49 ms500 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; string guess_sequence( int N ) { string ans; if ( press( "AB" ) ) { if ( press( "A" ) ) ans = "A"; else ans = "B"; } else { if ( press( "X" ) ) ans = "X"; else ans = "Y"; } if ( N == 1 ) return ans; vector< char > c( 3 ); if ( ans == "A" ) c = { 'B', 'X', 'Y' }; else if ( ans == "B" ) c = { 'A', 'X', 'Y' }; else if ( ans == "X" ) c = { 'A', 'B', 'Y' }; else c = { 'A', 'B', 'X' }; for ( int i = 2 ; i <= N - 1 ; ++ i ) { int len = press( ans + c[ 0 ] + ans + c[ 1 ] + c[ 0 ] + ans + c[ 1 ] + c[ 1 ] + ans + c[ 1 ] + c[ 2 ] ); if ( len == i ) ans += c[ 0 ]; else if ( len == i + 1 ) ans += c[ 1 ]; else ans += c[ 2 ]; } if ( press( ans + c[ 0 ] ) == N ) return ans + c[ 0 ]; else if ( press( ans + c[ 1 ] ) == N ) return ans + c[ 1 ]; else return ans + c[ 2 ]; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...