Submission #96128

#TimeUsernameProblemLanguageResultExecution timeMemory
96128kitsu_hiCombo (IOI18_combo)C++14
100 / 100
61 ms584 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; string guess_sequence(int N) { string ans; ans.clear(); 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; char frst = ans[0]; char c[4]; if ( frst == 'A' ) { c[1] = 'B'; c[2] = 'X'; c[3] = 'Y'; } if ( frst == 'B' ) { c[1] = 'A'; c[2] = 'X'; c[3] = 'Y'; } if ( frst == 'X' ) { c[1] = 'A'; c[2] = 'B'; c[3] = 'Y'; } if ( frst == 'Y' ) { c[1] = 'A'; c[2] = 'B'; c[3] = 'X'; } for ( int j = 2 ; j < N; j++ ) { string ct; ct.clear(); for ( int i = 1; i <= 3; i++ ) { ct = ct + ans + c[1] + c[i]; } ct = ct + ans + c[2]; int x = press(ct); if ( x == j - 1) { ans += c[3]; } if ( x == j ) { ans += c[2]; } if ( x == j + 1 ) { ans += c[1]; } } if ( press( ans + c[1] + ans + c[2] ) == N ) { if ( press( ans + c[1]) == N ) ans += c[1]; else ans += c[2]; } else { ans += c[3]; } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...