제출 #305479

#제출 시각아이디문제언어결과실행 시간메모리
305479tengiz05콤보 (IOI18_combo)C++14
100 / 100
39 ms608 KiB
#include "combo.h" //#include "grader.cpp" #include <bits/stdc++.h> using namespace std; string guess_sequence(int n) { string ans = ""; int len = 1; int tt = press("AB"); if(tt == 2){ ans = "A"; }else if(tt == 1){ tt = press("A"); if(tt == 1)ans = "A"; else ans = "B"; }else { tt = press("X"); if(tt == 1)ans = "X"; else ans = "Y"; } char B, X, Y; if(ans[0] == 'A')B='B',X='X',Y='Y'; if(ans[0] == 'B')B='A',X='X',Y='Y'; if(ans[0] == 'X')B='B',X='A',Y='Y'; if(ans[0] == 'Y')B='B',X='X',Y='A'; while(len < n-1){ string p; p = ans+B+B + ans+B+X + ans+B+Y + ans+X; int t = press(p); if(t == len+2){ ans += B; }else if(t == len+1){ ans += X; }else { ans += Y; }len++; // cout << ans << '\n'; } if(n > 1){ string p; p = ans+B + ans+X; int t = press(p); if(t == 1+len){ p = ans+B; t = press(p); if(t == 1+len)ans += B; else ans += X; }else ans += Y; } // cout << len << ' ' << ans << '\n'; return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...