이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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 (; S.size() < N ; ) {
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];
if (coins==S.size()+1) S+=M[1];
if (coins==S.size()+2) S+=M[0];
}
return S;
}
else if (press("B")) {
string M = "AXY", S = "B", control;
if (N==1) return S;
for (; S.size() < N ; ) {
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];
if (coins==S.size()+1) S+=M[1];
if (coins==S.size()+2) S+=M[0];
}
return S;
}
else if (press("X")) {
string M = "ABY", S = "X", control;
if (N==1) return S;
for (; S.size() < N ; ) {
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];
if (coins==S.size()+1) S+=M[1];
if (coins==S.size()+2) S+=M[0];
}
return S;
}
else {
string M = "ABX", S = "Y", control;
if (N==1) return S;
for (; S.size() < N ; ) {
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];
if (coins==S.size()+1) S+=M[1];
if (coins==S.size()+2) S+=M[0];
}
return S;
}
}
컴파일 시 표준 에러 (stderr) 메시지
combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:10:25: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
10 | for (; S.size() < N ; ) {
| ~~~~~~~~~^~~
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:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
17 | if (coins==S.size()+1) S+=M[1];
| ~~~~~^~~~~~~~~~~~
combo.cpp:18:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
18 | if (coins==S.size()+2) S+=M[0];
| ~~~~~^~~~~~~~~~~~
combo.cpp:25:25: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
25 | for (; S.size() < N ; ) {
| ~~~~~~~~~^~~
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:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
32 | if (coins==S.size()+1) S+=M[1];
| ~~~~~^~~~~~~~~~~~
combo.cpp:33:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
33 | if (coins==S.size()+2) S+=M[0];
| ~~~~~^~~~~~~~~~~~
combo.cpp:40:25: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
40 | for (; S.size() < N ; ) {
| ~~~~~~~~~^~~
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:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
47 | if (coins==S.size()+1) S+=M[1];
| ~~~~~^~~~~~~~~~~~
combo.cpp:48:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
48 | if (coins==S.size()+2) S+=M[0];
| ~~~~~^~~~~~~~~~~~
combo.cpp:55:25: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
55 | for (; S.size() < N ; ) {
| ~~~~~~~~~^~~
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:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
62 | if (coins==S.size()+1) S+=M[1];
| ~~~~~^~~~~~~~~~~~
combo.cpp:63:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
63 | if (coins==S.size()+2) S+=M[0];
| ~~~~~^~~~~~~~~~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |