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) {
if (press("A")) {
string M = "BXY", S = "A", control;
if (N==1) return S;
for (int i = 0; i<N-1; ++i) {
control = S+M[0]+M[0];
control += S+M[0]+M[1];
control += S+M[0]+M[2];
control += S+M[1];
int coins = press(control);
if (coins==S.size()) S+=M[2];
else if (coins==S.size()+1) S+=M[1];
else S+=M[0];
}
return S;
}
else if (press("B")) {
string M = "AXY", S = "B", control;
if (N==1) return S;
for (int i = 0; i<N-1; ++i) {
control = S+M[0]+M[0];
control += S+M[0]+M[1];
control += S+M[0]+M[2];
control += S+M[1];
int coins = press(control);
if (coins==S.size()) S+=M[2];
else if (coins==S.size()+1) S+=M[1];
else S+=M[0];
}
return S;
}
else if (press("X")) {
string M = "ABY", S = "X", control;
if (N==1) return S;
for (int i = 0; i<N-1; ++i) {
control = S+M[0]+M[0];
control += S+M[0]+M[1];
control += S+M[0]+M[2];
control += S+M[1];
int coins = press(control);
if (coins==S.size()) S+=M[2];
else if (coins==S.size()+1) S+=M[1];
else S+=M[0];
}
return S;
}
else {
string M = "ABX", S = "Y", control;
if (N==1) return S;
for (int i = 0; i<N-1; ++i) {
control = S+M[0]+M[0];
control += S+M[0]+M[1];
control += S+M[0]+M[2];
control += S+M[1];
int coins = press(control);
if (coins==S.size()) S+=M[2];
else if (coins==S.size()+1) S+=M[1];
else S+=M[0];
}
return S;
}
}
Compilation message (stderr)
combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:16:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
16 | if (coins==S.size()) S+=M[2];
| ~~~~~^~~~~~~~~~
combo.cpp:17:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
17 | else if (coins==S.size()+1) S+=M[1];
| ~~~~~^~~~~~~~~~~~
combo.cpp:31:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
31 | if (coins==S.size()) S+=M[2];
| ~~~~~^~~~~~~~~~
combo.cpp:32:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
32 | else if (coins==S.size()+1) S+=M[1];
| ~~~~~^~~~~~~~~~~~
combo.cpp:46:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
46 | if (coins==S.size()) S+=M[2];
| ~~~~~^~~~~~~~~~
combo.cpp:47:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
47 | else if (coins==S.size()+1) S+=M[1];
| ~~~~~^~~~~~~~~~~~
combo.cpp:61:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
61 | if (coins==S.size()) S+=M[2];
| ~~~~~^~~~~~~~~~
combo.cpp:62:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
62 | else if (coins==S.size()+1) S+=M[1];
| ~~~~~^~~~~~~~~~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |