제출 #673580

#제출 시각아이디문제언어결과실행 시간메모리
673580tbzard콤보 (IOI18_combo)C++14
0 / 100
1 ms208 KiB
#include <bits/stdc++.h> using namespace std; int press(string s); string guess_sequence(int n){ string ans = ""; string s[4] = {"A", "B", "X", "Y"}; int sum = press(s[0]+s[1]); if(sum == 0){ sum = press(s[2]); if(sum == 1) ans += s[2], swap(s[2], s[3]); else ans += s[3]; } else if(sum == 1){ sum = press(s[0]); if(sum == 1) ans += s[0], swap(s[0], s[3]); else ans += s[1], swap(s[1], s[3]); } else{ ans += s[0]+s[1]; swap(s[0], s[3]); } while((int)ans.length() != n){ int m = ans.length(); if(m == n+1){ sum = press(ans+s[0] + ans+s[1]); if(sum == m+1) ans += s[2]; else{ sum = press(ans+s[0]); if(sum == m+1) ans += s[0]; else ans += s[1]; } } else{ sum = press(ans+s[0] + ans+s[1]+s[0] + ans+s[1]+s[1] + ans+s[1]+s[2]); if(sum == m+1){ if(m+1 == n){ sum = press(ans+s[0]); if(sum == n) ans += s[0]; else ans += s[1]; } else ans += s[0]; } else if(sum == m+2) ans += s[1]; else ans += s[2]; } } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...