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;
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("AB")){
if(press("A")){
s+= "A";
ava.erase(1);
}else{
s+= "B";
ava.erase(2);
}
}else{
if(press("X")){
s+= "X";
ava.erase(3);
}else{
s+= "Y";
ava.erase(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){
s+= M[ch[0]];
}else if(ret == i+1){
s+= M[ch[1]];
}else if(ret == i-1){
s+= M[ch[2]];
}
}
if(N > 1){
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;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |