이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> p32;
typedef pair<ll,ll> p64;
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
int press(string p);
string guess_sequence(int n){
char start;
if(press("AB")){
if(press("A"))
start = 'A';
else start = 'B';
}
else{
if(press("X"))
start = 'X';
else start = 'Y';
}
string p = "";
p+=start;
vector<char> ch = {'A','B','X','Y'};
ch.erase(lower_bound(ch.begin(),ch.end(),start));
for (size_t i = 0; i < n-2; i++)
{
int guess = press(p+ch[0]+ch[0]+p+ch[0]+ch[1]+p+ch[0]+ch[2]+p+ch[1]);
if(guess==p.size()+2) p+=ch[0];
else if(guess==p.size()+1) p+=ch[1];
else p+=ch[2];
}
if(press(p+ch[0])==n) return p+ch[0]+'\n';
else if(press(p+ch[1])==n) return p+ch[1]+'\n';
else return p+ch[2]+'\n';
}
컴파일 시 표준 에러 (stderr) 메시지
combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:31:26: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
31 | for (size_t i = 0; i < n-2; i++)
| ~~^~~~~
combo.cpp:34:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
34 | if(guess==p.size()+2) p+=ch[0];
| ~~~~~^~~~~~~~~~~~
combo.cpp:35:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
35 | else if(guess==p.size()+1) p+=ch[1];
| ~~~~~^~~~~~~~~~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |