Submission #673588

#TimeUsernameProblemLanguageResultExecution timeMemory
673588tbzardCombo (IOI18_combo)C++14
100 / 100
35 ms572 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+1 == n){ sum = press(ans+s[0] + ans+s[1]); if(sum != n) ans += s[2]; else{ sum = press(ans+s[0]); if(sum == n) 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) 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...