이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "combo.h"
using namespace std;
string guess_sequence(int N){
char c[3];
string s;
int t=press("AB");
if(t){
t=press("A");
if(t)c[0]='B',c[1]='X',c[2]='Y',s+="A";
else c[0]='A',c[1]='X',c[2]='Y',s+="B";
}else{
t=press("X");
if(t)c[0]='B',c[1]='A',c[2]='Y',s+="X";
else c[0]='B',c[1]='X',c[2]='A',s+="Y";
}
if(N==1)return s;
while(s.size()<N-1){
t=press(s+c[0]+c[0]+s+c[0]+c[1]+s+c[0]+c[2]+s+c[1]);
if(t==s.size()){
s+=c[2];
}else if(t==s.size()+1){
s+=c[1];
}else{
s+=c[0];
}
}
t=press(s+"A"+s+"B");
if(t==s.size()+1){
t=press(s+"A");
if(t==s.size()+1)s+="A";
else s+="B";
}else{
t=press(s+"X");
if(t==s.size()+1)s+="X";
else s+="Y";
}
return s;
}
컴파일 시 표준 에러 (stderr) 메시지
combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:18:19: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
18 | while(s.size()<N-1){
| ~~~~~~~~^~~~
combo.cpp:20:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
20 | if(t==s.size()){
| ~^~~~~~~~~~
combo.cpp:22:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
22 | }else if(t==s.size()+1){
| ~^~~~~~~~~~~~
combo.cpp:29:9: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
29 | if(t==s.size()+1){
| ~^~~~~~~~~~~~
combo.cpp:31:13: 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(t==s.size()+1)s+="A";
| ~^~~~~~~~~~~~
combo.cpp:35:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
35 | if(t==s.size()+1)s+="X";
| ~^~~~~~~~~~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |