제출 #840872

#제출 시각아이디문제언어결과실행 시간메모리
840872ach00콤보 (IOI18_combo)C++17
100 / 100
29 ms672 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; string ans; int n; char first; char one; char two; char remain; string t1,t2,t3; char next() { int val = press((ans + one) + (ans + t1) + (ans + t2) + (ans + t3)); if(val == (int)ans.size()) { return remain; } else if(val == (int)ans.size() + 1) { return one; } else { return two; } } string guess_sequence(int N) { n = N; if(press("AB")) { if(press("A")) { first = 'A'; one = 'B'; two = 'X'; remain = 'Y'; t1 = "XB"; t2 = "XY"; t3 = "XX"; } else { first = 'B'; one = 'A'; two = 'X'; remain = 'Y'; t1 = "XA"; t2 = "XY"; t3 = "XX"; } } else { if(press("X")) { first = 'X'; one = 'A'; two = 'B'; remain = 'Y'; t1 = "BA"; t2 = "BY"; t3 = "BB"; } else { first = 'Y'; one = 'A'; two = 'B'; remain = 'X'; t1 = "BA"; t2 = "BX"; t3 = "BB"; } } ans += first; if(N==1) return ans; while((int)ans.size() < N-1) { ans += next(); } if(press((ans+one)+(ans+two)) == N) { if(press(ans+one) == N) { ans += one; } else { ans += two; } } else { ans += remain; } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...