Submission #226023

#TimeUsernameProblemLanguageResultExecution timeMemory
226023Dilshod_ImomovCombo (IOI18_combo)C++17
100 / 100
44 ms720 KiB
#include "combo.h" #include "bits/stdc++.h" using namespace std; string guess_sequence(int N) { string p; vector < char > vc = {'A', 'X', 'B', 'Y'}; if ( press("AB") ) { if ( press("A") ) { p += 'A'; vc.erase(vc.begin()); } else { p += 'B'; vc.erase(vc.begin() + 2); } } else { if ( press("X") ) { p += 'X'; vc.erase(vc.begin() + 1); } else { p += 'Y'; vc.erase(vc.begin() + 3); } } for ( int i = 1; i < N - 1; i++ ) { string t; t += p + vc[0]; t += p + vc[1] + vc[0]; t += p + vc[1] + vc[1]; t += p + vc[1] + vc[2]; int sz = p.size(), x = press(t); if ( x == sz + 1 ) { p += vc[0]; } else if ( x == sz + 2 ) { p += vc[1]; } else { p += vc[2]; } } if ( N != 1 ) { string t; t += p + vc[0]; t += p + vc[1]; if ( press(t) == N ) { t = p + vc[0]; if ( press(t) == N ) { p += vc[0]; } else { p += vc[1]; } } else { p += vc[2]; } } return p; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...