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 int ll;
typedef pair<ll,ll> pl;
typedef vector<ll> vl;
#define po pop_back
#define pb push_back
#define mk make_pair
#define lw lower_bound
#define up upper_bound
#define ff first
#define ss second
#define boost ios_base::sync_with_stdio(); cin.tie(0); cout.tie(0);
#define MOD 1000000007
#define MAX 1e18
#define MIN -1e18
#define rep(i,a,b) for(ll i=a;i<=b;i++)
#define per(i,a,b) for(ll i=b;i>=a;i--)
#define con continue
#define freopen freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
#define PI 3.14159265358979323846264338327950288419716939937510582097494459230781640628
// typedef tree<ll , null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
// template< typename T>
// using indexed_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
ll n,m,ans,mid,mn,mx,T,sum,h1,h2,e[1234567],b[1234567],c[1234567],d[1<<20],k,i,j,l,r,h,a[1234567],w,x,y,z,res,cnt,sz;
bool used[1234567];
vector<ll> v[1234567],vec,vv1,vv2;
string s1,s;
ll dx[4]={-1,1,0,0},dy[4]={0,0,-1,1};
string guess_sequence(int n) {
string S="AB" , SS="";
vector<char> vec{'A','B','C','D'};
if(press(S)!=0){
if(press("A")) SS+='A';
else SS+='B';
}
else{
if(press("X")) SS+='X';
else SS+='Y';
}
if(n==1) return SS;
for(int i=0; i<4; i++)
if(vec[i]==SS[0]){
swap(vec[i] , vec[3]); break;
}
for(int i=2; i<=n-1; i++){
S.clear();
for(int j=0; j<3; j++)
S += SS + vec[0] + vec[j];
S += SS + vec[1];
int id = press(S);
if(id==i+1) SS+=vec[0];
if(id==i) SS+=vec[1];
if(id==i-1) SS+=vec[2];
}
for(int i=0; i<2; i++)
if(press(SS+vec[i]) == n){
SS+=vec[i]; break;
}
if(SS.size()!=n) SS+=vec[2];
return SS;
}
Compilation message (stderr)
combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:61:17: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
61 | if(SS.size()!=n) SS+=vec[2];
| ~~~~~~~~~^~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |