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;
#define rep(a, b) for(int a = 0; a < (b); ++a)
#define st first
#define nd second
#define pb push_back
#define all(a) a.begin(), a.end()
string guess_sequence(int n) {
string c[]={"A", "B", "X", "Y"};
if(!press(c[0]+c[1])) {
swap(c[0], c[2]);
swap(c[1], c[3]);
}
if(!press(c[0])) swap(c[0], c[1]);
string ans=c[0];
if(n==1) return ans;
for(int i=1; i<n-1; ++i) {
int x=press(ans+c[1]+ans+c[2]+c[1]+ans+c[2]+c[2]+ans+c[2]+c[3]);
if(x==ans.size()) {
ans+=c[3];
} else if(x==ans.size()+1) {
ans+=c[1];
} else {
ans+=c[2];
}
}
if(press(ans+c[1])==n) {
ans+=c[1];
} else if(press(ans+c[2])==n) {
ans+=c[2];
} else {
ans+=c[3];
}
return ans;
}
Compilation message (stderr)
combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:22:7: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
22 | if(x==ans.size()) {
| ~^~~~~~~~~~~~
combo.cpp:24:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
24 | } else if(x==ans.size()+1) {
| ~^~~~~~~~~~~~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |