This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
/******************************************************************************
Online C++ Compiler.
Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.
*******************************************************************************/
#include "combo.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// int press(string s){
// if(s=="X") return 1;
// if(s=="XB") return 2;
// if(s == "XBA") return 3;
// return 0;
// }
string guess_sequence(int n){
string st = "";
char ct = 'A';
for(ll i=0;i<26;i++){
char x = ('A'+i);
string tmp = "";;
tmp += x;
if(press(tmp)==1){
st = tmp;
ct = x;
break;
}
}
string ans = st;
vector<char> other = {'A','B','X','Y'};
auto ite = find(other.begin(),other.end(),ct);
other.erase(ite);
for(ll i=1;i<n;i++){
for(ll j=0;j<3;j++){
string tm = ans;
tm += other[j];
if(press(tm)==(i+1)){
ans = tm;
break;
}
}
}
return ans;
}
// int main()
// {
// cout<<guess_sequence(3);
// return 0;
// }
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |