이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "combo.h"
#include "bits/stdc++.h"
using namespace std;
string guess_sequence(int N)
{
string p = "";
string S = "";
int coin;
char rest[3];
coin=press("AB");
if(coin==0)
{
coin=press("Y");
if(coin==1)
{
S+='Y';
//rest={'A','B','X'};
rest[0]='A';
rest[1]='B';
rest[2]='X';
}else{
S+='X';
//rest={'A','B','Y'};
rest[0]='A';
rest[1]='B';
rest[2]='Y';
}
}else{
coin=press("A");
if(coin==1)
{
S+='A';
//rest={'Y','B','X'};
rest[0]='Y';
rest[1]='B';
rest[2]='X';
}else{
S+='B';
//rest={'A','Y','X'};
rest[0]='A';
rest[1]='Y';
rest[2]='X';
}
}
while(S.length()<N-1)
{
p=S+rest[0]+S+rest[1]+rest[1]+S+rest[1]+rest[2]+S+rest[1]+rest[0];
coin=press(p);
if(coin==S.length()+1)
{
S+=rest[0];
}
else if(coin==S.length())
{
S+=rest[2];
}
else{
S+=rest[1];
}
}
if(S.length()==N-1)
{
p=S+rest[0]+S+rest[1];
coin=press(p);
if(coin==S.length())
{
S+=rest[2];
}else{
p=S+rest[0];
coin=press(p);
if(coin==S.length())
{
S+=rest[1];
}else{
S+=rest[0];
}
}
}
return S;
}
컴파일 시 표준 에러 (stderr) 메시지
combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:48:21: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
48 | while(S.length()<N-1)
| ~~~~~~~~~~^~~~
combo.cpp:52:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
52 | if(coin==S.length()+1)
| ~~~~^~~~~~~~~~~~~~
combo.cpp:56:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
56 | else if(coin==S.length())
| ~~~~^~~~~~~~~~~~
combo.cpp:64:18: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
64 | if(S.length()==N-1)
| ~~~~~~~~~~^~~~~
combo.cpp:68:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
68 | if(coin==S.length())
| ~~~~^~~~~~~~~~~~
combo.cpp:74:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
74 | if(coin==S.length())
| ~~~~^~~~~~~~~~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |