# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
393684 | phathnv | Combo (IOI18_combo) | C++11 | 2 ms | 276 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>
#include "combo.h"
using namespace std;
string guess_sequence(int n) {
char c[4] = {'A', 'B', 'X', 'Y'};
int l = 0, r = 3;
while (l < r){
int mid = (l + r) >> 1;
string tmp;
for(int i = l; i <= mid; i++)
tmp.push_back(c[i]);
if (press(tmp) > 0)
r = mid;
else
l = mid + 1;
}
swap(c[3], c[l]);
string s;
s.push_back(c[3]);
while (s.size() < n - 1){
string q = s + c[1] + s + c[2] + c[0] + s + c[2] + c[1] + s + c[2] + c[2];
s += c[press(q) - s.size()];
}
if (press(s + c[0]) == n)
s += c[0];
else if (press(s + c[1]) == n)
s += c[1];
else
s += c[2];
return s;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |