Submission #81033

#TimeUsernameProblemLanguageResultExecution timeMemory
81033OctavianVasileCombo (IOI18_combo)C++14
100 / 100
59 ms472 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; string guess_sequence(int n) { string ans; if (press ("AB")) if (press ("A"))ans += 'A'; else ans += 'B'; else if (press ("X"))ans += 'X'; else ans += 'Y'; vector <char> v, I = {'X', 'Y', 'A', 'B'}; for (int i = 0; i < 4; i ++)if (I [i] != ans [0]) v.push_back (I [i]); for (int i = 2; i < n; i ++){ int val = press (ans + v [0] + ans + v [1] + v [0] + ans + v [1] + v [1] + ans + v [1] + v [2]); if (val == (int)ans.size ()) ans.push_back (v [2]); else if (val == (int)ans.size () + 1) ans.push_back (v [0]); else ans.push_back (v [1]); } if(n != 1) { if (press (ans + v [0]) == n) ans += v [0]; else if (press (ans + v [1]) == n) ans += v [1]; else ans += v [2]; } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...