제출 #370567

#제출 시각아이디문제언어결과실행 시간메모리
370567leinad2콤보 (IOI18_combo)C++17
5 / 100
2 ms200 KiB
#include "combo.h" #include<bits/stdc++.h> using namespace std; string guess_sequence(int N) { string s; string p;p+='A';p+='B'; if(press(p)>0) { string pp;pp+='A'; if(press(pp)>0)s+='A'; else s+='B'; } else { string pp;pp+='X'; if(press(pp)>0)s+='X'; else s+='Y'; } char a, b, c; if(s[0]=='A')a='B',b='X',c='Y'; else if(s[0]=='B')a='A',b='X',c='Y'; else if(s[0]=='X')a='A',b='B',c='Y'; else a='A',b='B',c='X'; for(int i=1;i<N-1;i++) { string pp={}; for(int j=0;j<i;j++)pp+=s[j]; pp+=a; for(int j=0;j<i;j++)pp+=s[j]; pp+=b; pp+=a; for(int j=0;j<i;j++)pp+=s[j]; pp+=b; pp+=b; for(int j=0;j<i;j++)pp+=s[j]; pp+=b; pp+=c; int x=press(pp); if(x==i+1)s+=a; else if(x==i+2)s+=b; else s+=c; } string x; for(int i=0;i<N-1;i++)x+=s[i]; x+=a; if(press(x)==N)s+=a; else { string k; for(int i=0;i<N-1;i++)k+=s[i]; k+=b; if(press(k)==N)s+=b; else s+=c; } return s; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...