# IOI 2018 – Combo Problem and Solution The 30th International Olympiad in Informatics was held in Tsukuba, Japan in 2018. There were two competition days, with 3 problems given to the competitors on each day. You can see Combo problem and solutions below.

ioi2018problem1

### Solution :

``````#include "combo.h"
#include <bits/stdc++.h>
using namespace std;

string guess_sequence(int N) {
string p = "";
if(press("AB") >= 1) p = press("A") ? "A" : "B";
else p = press("X") ? "X" : "Y";
vector<char> chr = {'A', 'B', 'X', 'Y'};
chr.erase(find(chr.begin(), chr.end(), p));
while((int)p.size() <= N - 2){
int query = press(p + chr + chr + p + chr + chr + p + chr + chr);
if(query == p.size()){
p.push_back(chr);
}
else if(query == p.size() + 1){
query = press(p + chr + chr);
if(query == p.size()) p = p + chr + chr;
else if(query == p.size() + 1) p = p + chr + chr;
else p = p + chr + chr;
}
else{
query = press(p + chr + chr);
if(query == p.size()) p = p + chr + chr;
else if(query == p.size() + 1) p = p + chr + chr;
else p = p + chr + chr;
}
}
while(p.size() != N){
if(press(p + chr) == p.size() + 1) p.push_back(chr);
else if(press(p + chr) == p.size() + 1) p.push_back(chr);
else p.push_back(chr);
}
return p;
}``````

### Explanation :

combo-review

47 total views,  1 views today

#### Post Disclaimer

The hole problem statement are given by ioinformatics.org but the solution are generated by the sltechacademy authority if any of the query regarding this post or website fill the following contact form thank you.