# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1105125 | thelegendary08 | Combo (IOI18_combo) | C++14 | 29 ms | 1872 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;
std::string guess_sequence(int N) {
int r = press("AB");
char f;
if(r >= 1){
r = press("A");
if(r == 1)f = 'A';
else f = 'B';
}
else{
r = press("X");
if(r == 1)f = 'X';
else f = 'Y';
}
vector<char>cs = {'A', 'B', 'X', 'Y'};
vector<char>e;
for(auto u : cs){
if(u != f)e.push_back(u);
}
//for(auto u : e)cout<<u<<' ';
//cout<<'\n';
string s = "";
s+=f;
//cout<<s<<'\n';
for(int i = 1; i<N-1; i++){
string quer = "";
quer += s;
quer += e[0];
//cout<<quer<<" QUER"<<'\n';
for(auto u : e){
quer += s;
quer += e[1];
quer += u;
}
//cout<<quer<<" QUER"<<'\n';
r = press(quer);
if(r == s.size()){
s += e[2];
}
else if(r == s.size() + 1){
s += e[0];
}
else s += e[1];
}
if(N != 1){
r = press(s + e[0]);
if(r == N){
s += e[0];
}
else{
r = press(s + e[1]);
if(r == N){
s += e[1];
}
else s += e[2];
}
}
return s;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |