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.length()==1){
// if(s=="A"||s=="B") return 1;
// }
// if(s == "ABA") return 3;
// return 0;
// }
string guess_sequence(int n){
vector<char> av;
for(ll i=0;i<26;i++){
char x = ('A'+i);
string tmp = "";;
tmp += x;
if(press(tmp)==1){
av.push_back(x);
}
}
string ans = "";
if(av.size()==1){
string f = "";
for(ll i=0;i<3;i++){
f+=av[0];
}
ans = f;
}else if(av.size()==2){
string f1 = "",f2 = "";
f1 += av[0];
f1 += av[0];
f1 += av[1];
f2 += av[0];
f2 += av[1];
f2 += av[1];
sort(f1.begin(),f1.end());
sort(f2.begin(),f2.end());
do{
if(press(f1)==3){
ans = f1;
}
}while(next_permutation(f1.begin(),f1.end()));
do{
if(press(f2)==3){
ans = f2;
}
}while(next_permutation(f2.begin(),f2.end()));
}
else{
string f1 = "";
f1 += av[0];
f1 += av[1];
f1 += av[2];
sort(f1.begin(),f1.end());
do{
if(press(f1)==3){
ans = f1;
}
}while(next_permutation(f1.begin(),f1.end()));
}
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... |