제출 #799117

#제출 시각아이디문제언어결과실행 시간메모리
799117I_Love_EliskaM_콤보 (IOI18_combo)C++14
100 / 100
25 ms556 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; string guess_sequence(int n) { char f; if (press("AB")) { if (press("A")) f='A'; else f='B'; } else { if (press("X")) f='X'; else f='Y'; } int len=1; if (len==n) {string s; s+=f; return s;} string ans; ans+=f; char a='0',b='0',c='0'; for (char i='A'; i<='Y'; ++i) { if (i>'B' && i<'X') continue; if (i==f) continue; if (a=='0') a=i; else if (b=='0') b=i; else c=i; } while (len<n-1) { string s; s+=ans; s+=a; s+=a; s+=ans; s+=a; s+=b; s+=ans; s+=a; s+=c; s+=ans; s+=b; int x=press(s); if (x==len+2) ans+=a; else if (x==len+1) ans+=b; else ans+=c; ++len; } string s; s+=ans; s+=a; s+=ans; s+=b; if (press(s)==n) { if (press(ans+a)==n) return ans+a; else return ans+b; } else return ans+c; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...