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 "combo.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define ff first
#define ss second
ll ttt;
const ll INF=1e18;
const ll MOD=1e9+7;
const ll N=5007;
ll n,m,k;
string guess_sequence(int NN) {
n=NN;
string pf="";
if(press("AB")){
if(press("A"))pf="A";
else pf="B";
}
else if(press("X"))pf+="X";
else pf+="Y";
vector<char>rem;
for(char c:{'A','B','X','Y'}){
if(c!=pf[0])rem.push_back(c);
}
for(int _=0;_<n-2;_++){
string cur="";
cur+=pf+rem[0]+rem[0];
cur+=pf+rem[0]+rem[1];
cur+=pf+rem[0]+rem[2];
cur+=pf+rem[1];
int res=press(cur);
if(res==pf.size())pf+=rem[2];
else if(res==pf.size()+1)pf+=rem[1];
else pf+=rem[0];
}
if(press(pf+rem[0])==pf.size()+1)pf+=rem[0];
else if(press(pf+rem[1])==pf.size()+1)pf+=rem[1];
else pf+=rem[2];
return pf;
}
Compilation message (stderr)
combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:39:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
39 | if(res==pf.size())pf+=rem[2];
| ~~~^~~~~~~~~~~
combo.cpp:40:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
40 | else if(res==pf.size()+1)pf+=rem[1];
| ~~~^~~~~~~~~~~~~
combo.cpp:43:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
43 | if(press(pf+rem[0])==pf.size()+1)pf+=rem[0];
| ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
combo.cpp:44:29: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
44 | else if(press(pf+rem[1])==pf.size()+1)pf+=rem[1];
| ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |