# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
654671 | atigun | Combo (IOI18_combo) | C++14 | 0 ms | 0 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>
using namespace std;
typedef long long ll;
string guess_sequence(int N){
map<int, string> M = {{1, "A"}, {2, "B"}, {3, "X"}, {4, "Y"}};
set<int> ava = {1, 2, 3, 4};
string s = "";
if(press(M[1])){
ava.erase(1);
s+= M[1];
}else if(press(M[2])){
ava.erase(2);
s+= M[2];
}else if(press(M[3])){
ava.erase(3);
s+= M[3];
}else{
ava.erase(4);
s+= M[4];
}
vector<int> ch;
for(int i : ava)
ch.push_back(i);
for(int i = 2; i <= N-1; i++){
string ask = s + M[ch[0]] + s + M[ch[1]]+M[ch[0]] + s + M[ch[1]]+M[ch[1]] + s + M[ch[1]]+M[ch[2]];
int ret = press(ask);
if(ret == i-1+1){
s+= M[ch[0]];
}else if(ret == i-1+2){
s+= M[ch[1]];
}else if(ret == i-1){
s+= M[ch[2]];
}
}
if(press(s+M[ch[0]]) == N){
s+= M[ch[0]];
}else if(press(s+M[ch[1]]) == N){
s+= M[ch[1]];
}else{
s+= M[ch[2]];
}
return s;
}