제출 #1196442

#제출 시각아이디문제언어결과실행 시간메모리
1196442ffeyyaae_Combo (IOI18_combo)C++20
100 / 100
8 ms488 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; string guess_sequence( int N ) { string s = ""; string a = "ABXY"; vector<char> bt; if( press("AB") ) s += (press("A")?"A":"B"); else s += (press("X")?"X":"Y"); if( N == 1 ) return s; for( auto c : a ) if( s[0] != c ) bt.push_back( c ); for( int i=1;i<N-1;i++ ) { string tp = s+bt[0] + s+bt[1]+bt[0] + s+bt[1]+bt[1] + s+bt[1]+bt[2]; int sz = s.size(); int res = press(tp); if( res == sz+1 ) s += bt[0]; else if( res == sz+2 ) s += bt[1]; else s += bt[2]; } if( press(s+bt[0]) == N ) s += bt[0]; else if( press(s+bt[1]) == N ) s += bt[1]; else s += bt[2]; return s; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...