Submission #690535

#TimeUsernameProblemLanguageResultExecution timeMemory
690535zeroesandonesCombo (IOI18_combo)C++17
100 / 100
33 ms884 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; using ll = long long; using vi = vector<long long>; #define pb emplace_back std::string guess_sequence(int n) { char first = ' '; string res = ""; vector<char> left; set<char> moves = {'A', 'B', 'X', 'Y'}; int ab = press("AB"); int ax = press("AX"); if(ab && ax) first = 'A'; else if(ab) first = 'B'; else if(ax) first = 'X'; else first = 'Y'; res += first; moves.erase(first); for(auto i : moves) left.pb(i); if(n == 1) return res; for(int i = 1; i < n - 1; ++i) { string try1 = res + left[0]; string try2 = res + left[1]; string try21 = try2 + left[0]; string try22 = try2 + left[1]; string try23 = try2 + left[2]; ll curr = press(try1 + try21 + try22 + try23); if(curr == i + 2) res += left[1]; else if(curr == i + 1) res += left[0]; else res += left[2]; } ll try1 = press(res + left[0]); if(try1 == n) return res + left[0]; try1 = press(res + left[1]); if(try1 == n) return res + left[1]; return res + left[2]; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...