# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
346444 | lebasivillar | Combo (IOI18_combo) | C++14 | 41 ms | 552 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 <cstdio>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include "combo.h"
using namespace std;
string guess_sequence(int N){
string t;
if (press("AB") > 0){
if (press("A") > 0) t.push_back('A');
else t.push_back('B');
}
else {
if (press("X") > 0) t.push_back('X');
else t.push_back('Y');
}
if (N == 1) return t;
string sequence = "ABXY";
vector <string> left;
for (int i = 0; i < sequence.size(); ++i){
if (sequence[i] != t[0]) {
string word;
word.push_back(sequence[i]);
left.push_back(word);
}
}
vector <string> ends = {left[1], left[2] + left[0], left[2] + left[1], left[2]+ left[2]};
while (t.size() < N - 1){
int value = press(t + ends[0] + t + ends[1] + t + ends[2] + t + ends[3]) -t.size();
if (value == 0) t += left[0];
if (value == 1) t += left[1];
if (value == 2) t += left[2];
}
if (press(t + left[0]) == N) t += left[0];
else if (press(t + left[1]) == N) t += left[1];
else t += left[2];
return t;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |