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;
#define ff first
#define ss second
#define all(a) a.begin(), a.end()
/*
int press(string s){
return 1;
}
*/
string guess_sequence(int N){
string ans = "";
if(press("AB")){
if(press("A")) ans.push_back('A');
else ans.push_back('B');
}else{
if(press("X")) ans.push_back('X');
else ans.push_back('Y');
}
if(N == 1) return ans;
vector<char> chars;
for(char ch : "ABXY"){
if(ch != ans[0]) chars.push_back(ch);
}
for(int i = 2;i < N; i++){
int same = press(ans + chars[0] +
ans + chars[1] + chars[0] + ans + chars[1] + chars[1] + ans + chars[1] + chars[2]);
if(same == i){
ans.push_back(chars[0]);
}else if(same == i-1) ans.push_back(chars[2]);
else ans.push_back(chars[1]);
}
if(press(ans + chars[0]) == N) ans+= chars[0];
else if(press(ans + chars[1]) == N) ans+= chars[1];
else ans+= chars[2];
return ans;
}
/*
main(){
int n; cin >> n;
cout << guess_sequence(n);
return 0;
}
*/
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |