# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
595042 | FatihSolak | Combo (IOI18_combo) | C++17 | 41 ms | 584 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 "combo.h"
#include <bits/stdc++.h>
using namespace std;
string guess_sequence(int n) {
vector<char> v = {'A','B','X','Y'};
string ans = "";
string p;
if(press("AB")){
if(press("A")){
ans = "A";
}
else{
ans = "B";
}
}
else{
if(press("X")){
ans = "X";
}
else{
ans = "Y";
}
}
if(n == 1)
return ans;
vector<char> nw;
for(auto u:v){
if(u != ans[0])
nw.push_back(u);
}
v = nw;
for(int i = 1;i<n-1;i++){
p = "";
p += ans + v[0] + v[0];
p += ans + v[0] + v[1];
p += ans + v[0] + v[2];
p += ans + v[1];
int num = press(p);
if(num == i){
ans += v[2];
}
if(num == i+1){
ans += v[1];
}
if(num == i+2){
ans += v[0];
}
}
for(int i = 0;i<v.size();i++){
p = "";
p = ans + v[i];
if(i == v.size()-1 || press(p) == n){
return p;
}
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |