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;
string guess_sequence(int N) {
char crr[]={'A', 'B', 'X', 'Y'};
char wow[N+5];
vector <char> cr;
string S;
for(int i=0;i<N;i++){
//crr[i]=-1;
if(!i){
wow[0]='A';
for(int j=1;j<=3;j++){
string p="";
p+=crr[j];
//printf("!%s\n", p);
int coins=press(p);
if(coins)wow[0]=crr[j];
}
//printf("%c", wow[0]);
for(int j=0;j<4;j++){
//printf("\n%d %d\n", wow[0], crr[j]);
if(wow[0]!=crr[j])
cr.push_back(crr[j]);
}
}
else if(N-1==i){
//printf("%d\n", cr.size());
wow[i]=cr[0];
for(int j=1;j<cr.size();j++){
string p=S;
//std::cout << S << std::endl;
p+=cr[j];
//std::cout << p << std::endl;
//pri
//printf("%s\n", p);
int coins=press(p);
if(coins==i+1){
wow[i]=cr[j];
}
}
}
else{
string p;
for(int j=0;j<3;j++){
p+=S; p+=cr[2]; p+=cr[j];
}
p+=S; p+=cr[1];
//std::cout << S << std::endl;
int coins=press(p);
//printf("%d\n", coins);
for(int j=0;j<3;j++){
if(coins==i+j)
wow[i]=cr[j];
}
}
//printf("??%c\n", wow[i]);
S+=wow[i];
// std::cout << S << std::endl;
//
}
return S;
}
Compilation message (stderr)
combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:31:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
31 | for(int j=1;j<cr.size();j++){
| ~^~~~~~~~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |