제출 #151505

#제출 시각아이디문제언어결과실행 시간메모리
151505Linca_Robert콤보 (IOI18_combo)C++14
0 / 100
2 ms284 KiB
#include<bits/stdc++.h> #include "combo.h" std::string guess_sequence( int N ) { std::string p = ""; std::string S = ""; char c[] = {'A', 'B', 'X', 'Y'}; p.push_back( 'A' ); p.push_back( 'B' ); if( press(p) != 0 ){ p.clear(); p.push_back( 'A' ); if( press(p) == 1 ) S.push_back( 'A' ); else S.push_back( 'B' ), std::swap( c[0], c[1] ); }else{ p.clear(); p.push_back( 'X' ); if( press(p) == 1 ) S.push_back( 'X' ), std::swap( c[0], c[2] ); else S.push_back( 'Y' ), std::swap( c[0], c[3] ); } for( int i = 2; i < N; i++ ){ p.clear(); p.append( S ); p.push_back( c[1] ); p.push_back( c[0] ); p.append( S ); p.push_back( c[2] ); p.push_back( c[1] ); p.push_back( c[0] ); p.append( S ); p.push_back( c[2] ); p.push_back( c[3] ); p.push_back( c[0] ); int ans = press( p ); if( ans == i ) S.push_back( c[1] ); else if( ans == i + 1 ) S.push_back( c[2] ); else S.push_back( c[3] ); } p.clear(); p = S; p.push_back( c[1] ); if( press(p) == N ){ S = p; }else{ p.back() = c[2]; if( press(p) == N ) S = p; else S.push_back( c[3] ); } return S; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...