# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1113563 | Zflop | Combo (IOI18_combo) | C++14 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
#include "combo.h"
string letter = "ABXY";
std::string guess_sequence(int N) {
string ans;
vector<char>actual;
for (int i = 0; i < 4;++i)
if (press(letter[i])) {
ans += letter[i];
}
else
actual.push_back(letter[i]);
while(ans.size() < N - 1) {
string g = ans + actual[0] + actual[0] + ans + actual[0] + actual[1] + ans + actual[0] + actual[2] + ans + actual[1];
int ret = press(g);
if (ret == ans.size())
ans += actual[2];
else if (ret == ans.size() + 1)
ans += actual[1];
else
ans += actual[0];
}
string g = ans + actual[0];
if (press(g) == N) return g;
g = ans + actual[1];
if (press(g) == N) return g;
return ans + actual[2];
}