Submission #251907

#TimeUsernameProblemLanguageResultExecution timeMemory
251907paradoxCombo (IOI18_combo)C++17
0 / 100
1 ms200 KiB
#include "combo.h" using namespace std; #include <iostream> #include <fstream> #include <vector> #include <set> #include <map> #include <cstring> #include <string> #include <cmath> #include <cassert> #include <ctime> #include <algorithm> #include <sstream> #include <list> #include <queue> #include <deque> #include <stack> #include <cstdlib> #include <cstdio> #include <iterator> #include <functional> #include <unordered_set> #include <unordered_map> char ch[] = {'A', 'B', 'X', 'Y'}; char findNextCharacter(string currentString) { int f = 0, s = 1; string query = currentString + ch[f] + currentString + ch[s]; int res = press(query); if (!res) f = 2, s = 3; query = currentString + ch[f]; res = press(query); return (res ? ch[f] : ch[s]); } string guess_sequence(int N) { char first = findNextCharacter(""); string ans = ""; ans += first; string buttons = ""; for (int i = 0; i < 4; ++i) if (first != ch[i]) buttons += ch[i]; for (int i = 2; i < N; ++i) { string query = ""; query = ans + buttons[1]; for (int j = 0; j < 3; ++j) query += ans + buttons[2] + buttons[j]; int res = press(query); if (res == i - 1) ans += buttons[0]; else if (res == i) ans += buttons[1]; else ans += buttons[2]; } char last = findNextCharacter(ans); ans += last; return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...