제출 #485446

#제출 시각아이디문제언어결과실행 시간메모리
485446status_coding콤보 (IOI18_combo)C++14
100 / 100
40 ms564 KiB
#include "combo.h" using namespace std; char findFirst() { if(press("AB")) { if(press("A")) return 'A'; else return 'B'; } else { if(press("X")) return 'X'; else return 'Y'; } } string guess_sequence(int n) { string ans; ans += findFirst(); if(n == 1) return ans; string alphabet = "ABXY"; char first=0, second=0, third=0; for(char ch : alphabet) { if(ch == ans[0]) continue; if(!first) first=ch; else if(!second) second=ch; else third=ch; } for(int i=2;i<n;i++) { string q; q+=ans; q+=first; q+=ans; q+=second; q+=first; q+=ans; q+=second; q+=second; q+=ans; q+=second; q+=third; int x=press(q); if(x == i) ans += first; if(x == i+1) ans += second; if(x == i-1) ans += third; } string q=ans+first; if(press(q) == n) return q; q=ans+second; if(press(q) == n) return q; q=ans+third; return q; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...