제출 #592818

#제출 시각아이디문제언어결과실행 시간메모리
592818Summers콤보 (IOI18_combo)C++14
100 / 100
37 ms656 KiB
#include "combo.h" #include<iostream> using namespace std; std::string guess_sequence(int n) { string s,s1; long long br=1,le=0; char cc; char m[10]={'A','B','X','Y'}; if(press("XY")) { if(press("X")){s="X";cc='X';} else {s="Y";cc='Y';} } else if(press("A")){s="A";cc='A';} else {s="B";cc='B';} char c[3]; for(int i=0;i<=3;i++) { if(m[i]!=cc)c[le++]=m[i]; } while(br<n-1) { s1=s+c[0]+c[1]+s+c[0]+c[0]+s+c[0]+c[2]+s+c[1]; long long is=press(s1); if(is==br){s=s+c[2];br++;continue;} if(is==br+1){s=s+c[1];br++;continue;} s=s+c[0];br++;continue; } if(br<n){ if(press(s+c[0])==br+1)s+=c[0]; else if(press(s+c[1])==br+1)s+=c[1]; else s+=c[2];} return s; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...