Submission #650738

#TimeUsernameProblemLanguageResultExecution timeMemory
650738erkeCombo (IOI18_combo)C++11
100 / 100
36 ms692 KiB
#include <bits/stdc++.h> using namespace std; int press(string p); string guess_sequence(int n) { vector<char> v = {'A', 'B', 'X', 'Y'}; string ret; if (press("AB")) { if (press("A")) { ret += 'A'; swap(v[0], v[3]); } else { ret += 'B'; swap(v[1], v[3]); } } else { if (press("X")) { ret += 'X'; swap(v[2], v[3]); } else { ret += 'Y'; // swap(v[3], v[3]); } } while ((int) ret.size() < n - 1) { string tmp = ret + v[0]; for (int i = 0; i < 3; i++) { tmp += ret + v[1] + v[i]; } int p = press(tmp); if (p == (int) ret.size() + 1) { ret += v[0]; } else if (p == (int) ret.size() + 2) { ret += v[1]; } else { ret += v[2]; } } if (n > 1) { if (press(ret + v[0]) == n) { ret += v[0]; } else if (press(ret + v[1]) == n) { ret += v[1]; } else { ret += v[2]; } } return ret; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...