# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
439590 | mangoesry | Combo (IOI18_combo) | C++14 | 42 ms | 724 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){
string res,first;
int first_half = press("AB");
if(first_half == 0){
int second_half = press("X");
first = second_half == 0 ? "Y" : "X";
}else{
int second_half = press("A");
first = second_half == 0 ? "B" : "A";
}
res = res + first;
if(N == 1){
return res;
}
vector<string> chr = {"A","B","X","Y"};
chr.erase(find(chr.begin(),chr.end(),first));
for(int i=1;i<N-1;i++){
string guess = res + chr[0] + chr[0] + res + chr[0] + chr[1] + res + chr[0] + chr[2] + res + chr[1];
int query = press(guess);
if(query == res.size()){
res = res + chr[2];
}else if(query == res.size()+1){
res = res + chr[1];
}else{
res = res + chr[0];
}
}
int last0 = press(res + chr[0]);
int last1 = press(res + chr[1]);
if(last0 == N){
res = res + chr[0];
}else if(last1 == N){
res = res + chr[1];
}else{
res = res + chr[2];
}
return res;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |