Submission #422020

#TimeUsernameProblemLanguageResultExecution timeMemory
422020Dilshod_ImomovCombo (IOI18_combo)C++17
100 / 100
42 ms736 KiB
# include <bits/stdc++.h> # include "combo.h" using namespace std; string guess_sequence(int n) { string s, t; if ( press("AB") ) { if ( press("A") ) { s = "A"; t = "BXY"; } else { s = "B"; t = "AXY"; } } else if ( press("X") ) { s = "X"; t = "ABY"; } else { s = "Y"; t = "ABX"; } if ( n == 1 ) { return s; } int cur = 1; for ( int i = 1; i < n - 1; i++ ) { string k = s; k += t[0]; for ( int j = 0; j < 3; j++ ) { k += s + t[1] + t[j]; } int get = press(k); if ( get == cur ) { s += t[2]; } else if ( get == cur + 1 ) { s += t[0]; } else { s += t[1]; } cur++; } if ( press( s + t[0] ) == cur + 1 ) { s += t[0]; } else if ( press( s + t[1] ) == cur + 1 ) { s += t[1]; } else { s += t[2]; } return s; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...