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>
#define pb push_back
#define f first
#define sc second
using namespace std;
typedef long long int ll;
typedef string str;
str guess_sequence(int n){
str s = "";
int r = 0;
while(s.size() < n){
int sz = n - s.size();
int ab = press(s+str(sz, 'A') + s+str(sz, 'B'));
int xy = press(s+str(sz, 'X') + s+str(sz, 'Y'));
if(ab > r){
int a = press(s+str(sz, 'A'));
if(a > r){
r = a;
s = (s+str(sz, 'A')).substr(0, r);
}
else{
r = ab;
s = (s+str(sz, 'B')).substr(0, r);
}
}
else{
int x = press(s+str(sz, 'X'));
if(x > r){
r = x;
s = (s+str(sz, 'X')).substr(0, r);
}
else{
r = xy;
s = (s+str(sz, 'Y')).substr(0, r);
}
}
}
return s;
}
Compilation message (stderr)
combo.cpp: In function 'str guess_sequence(int)':
combo.cpp:12:20: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
12 | while(s.size() < n){
| ~~~~~~~~~^~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |