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;
string guess_sequence(int N) {
string ans = "", corte = "Y", a = "A", b = "B", c = "X";
ll aux,i;
aux = press(corte+a);
if (aux==1) {
if (press(a)==1) swap(corte,a);
}
else {
if (press(b)==1) swap(corte,b);
else swap(corte,c);
}
ans = ans+corte;
for (i=1;i<N-1;i++) {
aux = press(ans+a+ans+b+a+ans+b+c+ans+b+b);
if (aux==ans.size()+1) ans = ans+a;
else if (aux==ans.size()+2) ans = ans+b;
else ans = ans+c;
}
if (N>1) {
aux = press(ans+a+ans+b);
if (aux==ans.size()+1) {
if (press(ans+a)==1) ans = ans + a;
else ans = ans + b;
}
else {
ans = ans+c;
}
}
return ans;
}
Compilation message (stderr)
combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:22:16: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
22 | if (aux==ans.size()+1) ans = ans+a;
| ~~~^~~~~~~~~~~~~~
combo.cpp:23:21: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
23 | else if (aux==ans.size()+2) ans = ans+b;
| ~~~^~~~~~~~~~~~~~
combo.cpp:28:16: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
28 | if (aux==ans.size()+1) {
| ~~~^~~~~~~~~~~~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |