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 <string>
#include "combo.h"
using namespace std;
// int press(string mn){
// int tc;
// cout << mn << endl;
// cin >> tc;
// return tc;
// }
string add(string s,string t){
string ans = s;
for(auto it : t)
ans.push_back(it);
return ans;
}
int n;
vector<string> v = {"A","B","X","Y"};
string guess_sequence(int N){
n = N;
// cin >> n;
string s = "";
if(press("AB")){
if(press("A")){
s = "A";
v.erase(v.begin());
}
else{
s = "B";
v.erase(v.begin()+1);
}
}
else{
if(press("X")){
s = "X";
v.erase(v.begin()+2);
}
else{
s = "Y";
v.erase(v.begin()+3);
}
}
// cout << s << endl;
for(int i = 1; i <= n-2; ++i){
int csi = i;
string pos = "";
pos = add(pos,add(s,v[0]));
pos = add(pos,add(s,add(v[1],v[0])));
pos = add(pos,add(s,add(v[1],v[1])));
pos = add(pos,add(s,add(v[1],v[2])));
int val = press(pos);
if(val == csi){
s = add(s,v[2]);
}
if(val == csi+1){
s = add(s,v[0]);
}
if(val == csi+2){
s = add(s,v[1]);
}
}
if(press(add(add(s,v[0]),add(s,v[1]))) == n){
if(press(add(s,v[0])) == n){
s = add(s,v[0]);
}
else{
s = add(s,v[1]);
}
}
else{
s = add(s,v[2]);
}
return s;
}
// int main(){
// cout << guess_sequence(0) << endl;
// return 0;
// }
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |