Submission #919516

#TimeUsernameProblemLanguageResultExecution timeMemory
919516NurislamCombo (IOI18_combo)C++14
0 / 100
10 ms756 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; string guess_sequence(int n) { vector<char> v = {'A', 'B', 'X', 'Y'}; string ans = ""; int x = press("AB"); int f; if(x > 0){ x = press("A"); if(x > 0)f = 0; else f = 1; }else{ x = press("X"); if(x > 0)f = 2; else f = 3; } ans+=v[f]; if(n == 1)return ans; swap(v[3], v[f]); for(int i = 1; i < n-1; i++){ string p = ""; for(int j = 0; j < 3; j++)p = ans+v[0]+v[j]; p += ans+v[1]; int x = press(p); if(x==(int)ans.size())ans+=v[2]; else if(x-1 == (int)ans.size())ans+=v[1]; else ans+=v[0]; } if(press(ans+v[0]) == n)return ans+v[0]; else if(press(ans+v[1]) == n)return ans+v[1]; return ans+v[2]; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...