제출 #169060

#제출 시각아이디문제언어결과실행 시간메모리
169060Andrei_Cotor콤보 (IOI18_combo)C++14
100 / 100
111 ms1544 KiB
#include "combo.h" using namespace std; string guess_sequence(int n) { string S=""; char a='A',b='B',x='X',y='Y'; S+=a; S+=b; if(press(S)) { S=""; S+=a; if(!press(S)) swap(b,a); } else { S=""; S+=x; if(press(S)) swap(a,x); else swap(a,y); } string rez=""; rez+=a; for(int i=2; i<n; i++) { S=rez; S+=b; S+=rez; S+=x; S+=b; S+=rez; S+=x; S+=x; S+=rez; S+=x; S+=y; int val=press(S); if(val==i) rez+=b; else if(val==i+1) rez+=x; else rez+=y; } if(n>1) { S=rez; S+=b; S+=rez; S+=x; if(press(S)==n) { S=rez; S+=b; if(press(S)==n) rez+=b; else rez+=x; } else rez+=y; } return rez; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...