Submission #136822

#TimeUsernameProblemLanguageResultExecution timeMemory
136822quotitquotCombo (IOI18_combo)C++14
100 / 100
54 ms588 KiB
#include<bits/stdc++.h> #include "combo.h" using namespace std; string ans = ""; std::string guess_sequence(int N) { string p = ""; if( press( "AB" ) == 0 ) { if( press( "X" ) == 1 ) ans = "X"; else ans = "Y"; } else { if( press( "A" ) == 1 ) ans = "A"; else ans = "B"; } if( N == 1 ) return ans; if( ans == "A" ) p = "BXY"; if( ans == "B" ) p = "AXY"; if( ans == "X" ) p = "ABY"; if( ans == "Y" ) p = "ABX"; for( int i = 2; i < N; i ++ ) { string p1 = ans; p1 += p[0]; p1 += p[0]; p1 += ans; p1 += p[0]; p1 += p[1]; p1 += ans; p1 += p[0]; p1 += p[2]; p1 += ans; p1 += p[1]; int now = press( p1 ); if( now == i+1 ) ans += p[0]; else if( now == i ) ans += p[1]; else ans += p[2]; } string p1 = ans; p1 += p[0]; string p2 = ans; p2 += p[1]; if( press( p1 ) == N ) ans += p[0]; else if( press( p2 ) == N ) ans += p[1]; else ans += p[2]; return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...