Submission #807794

#TimeUsernameProblemLanguageResultExecution timeMemory
807794math_rabbit_1028Combo (IOI18_combo)C++14
0 / 100
1 ms208 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; int n; string solve(string s, string t, string u, string v) { string ans, query; ans = s; for (int i = 2; i < n; i++) { query = ""; query += ans; query += t; query += t; query += ans; query += t; query += u; query += ans; query += t; query += v; query += ans; query += u; query += t; int res = press(query); if (res == i + 1) ans += t; if (res == i) ans += u; if (res == i - 1) ans += v; } query = ans + t; if (press(query) == n) return query; query = ans + u; if (press(query) == n) return query; query = ans + v; return query; } std::string guess_sequence(int N) { n = N; int a = press("A"); int b = press("B"); int x = press("X"); if (a == 1) { return solve("A", "B", "X", "Y"); } else if (b == 1) { return solve("B", "A", "X", "Y"); } else if (x == 1) { return solve("X", "A", "B", "Y"); } else { return solve("Y", "A", "B", "X"); } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...