Submission #835093

#TimeUsernameProblemLanguageResultExecution timeMemory
835093JohannCombo (IOI18_combo)C++14
5 / 100
1 ms464 KiB
#include "combo.h" #include "bits/stdc++.h" using namespace std; typedef vector<int> vi; typedef vector<vi> vvi; #define sz(x) (int)(x).size() #define all(x) (x).begin(), (x).end() string guess_sequence(int N) { string p; p = "AB"; string start; if (press(p)) start = (press("A")) ? "A" : "B"; else start = (press("X")) ? "X" : "Y"; vector<char> remaining = {'A', 'B', 'X', 'Y'}; for (int i = 0; i < 3; ++i) if (remaining[i] == start[0]) swap(remaining[i], remaining.back()); remaining.pop_back(); for (int i = 1; i < N - 1; ++i) { p = ""; p += start + remaining[0]; for (int j = 0; j < 3; ++j) p += start + remaining[1] + remaining[j]; int tmp = press(p) - i; if (tmp == 0) start += remaining[2]; else if (tmp == 1) start += remaining[0]; else if (tmp == 2) start += remaining[1]; else assert(false); } if (press(start + remaining[0]) == N) start += remaining[0]; else if (press(start + remaining[1]) == N) start += remaining[1]; else start += remaining[2]; assert(sz(start) == N); return start; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...