제출 #75621

#제출 시각아이디문제언어결과실행 시간메모리
75621joseacaz콤보 (IOI18_combo)C++17
100 / 100
52 ms584 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; int ans, cnt; string S, first, aux, let1, let2, let3; string guess_sequence ( int N ) { cnt = 1; ans = press ( "AB" ); if ( ans == 0 ) { ans = press ( "X" ); if ( ans == 0 ) first = "Y", S = "Y"; else first = "X", S = "X"; } else if ( ans == 1 ) { ans = press ( "A" ); if ( ans == 0 ) first = "B", S = "B"; else first = "A", S = "A"; } else if ( ans == 2 ) first = "A", S = "AB", cnt = 2; if ( first == "A" ) let1 = "B", let2 = "X", let3 = "Y"; else if ( first == "B" ) let1 = "A", let2 = "X", let3 = "Y"; else if ( first == "X" ) let1 = "A", let2 = "B", let3 = "Y"; else if ( first == "Y" ) let1 = "A", let2 = "B", let3 = "X"; for ( ; cnt < N - 1; cnt++ ) { aux = S + let1; aux += S + let2 + let1; aux += S + let2 + let2; aux += S + let2 + let3; ans = press ( aux ); if ( ans == cnt + 1 ) S += let1; else if ( ans == cnt + 2 ) S += let2; else if ( ans == cnt ) S += let3; } if ( cnt < N ) { ans = press ( S + let1 + S + let2 ); if ( ans == cnt ) S += let3; else if ( ans == cnt + 1 ) { ans = press ( S + let1 ); if ( ans == cnt ) S += let2; else S += let1; } } //cout << S << "\n"; return S; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...