Submission #500319

#TimeUsernameProblemLanguageResultExecution timeMemory
500319LucaIlieCombo (IOI18_combo)C++17
100 / 100
32 ms716 KiB
#include <iostream> #include "combo.h" using namespace std; string guess_sequence( int n ) { char a, b, x, y; int l, i; string ans; ans = ""; if ( press( "AB" ) ) { if ( press( "A" ) ) { a = 'B'; b = 'X'; x = 'Y'; y = 'A'; } else { a = 'A'; b = 'X'; x = 'Y'; y = 'B'; } } else { if ( press( "X" ) ) { a = 'A'; b = 'B'; x = 'Y'; y = 'X'; } else { a = 'A'; b = 'B'; x = 'X'; y = 'Y'; } } ans += y; for ( i = 2; i < n; i++ ) { l = press( (ans + a) + (ans + b + a) + (ans + b + b) + (ans + b + x) ); if ( l == i ) ans += a; else if ( l == i + 1 ) ans += b; else ans += x; } if ( n > 1 ) { if ( y != 'A' && press( ans + 'A' ) == n ) ans += 'A'; else if ( y != 'B' && press( ans + 'B' ) == n ) ans += 'B'; else if ( y == 'Y' || (y != 'X' && press( ans + 'X' ) == n) ) ans += 'X'; else ans += 'Y'; } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...