이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "combo.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define ff first
#define ss second
ll ttt;
const ll INF=1e18;
const ll MOD=1e9+7;
const ll N=5007;
ll n,m,k;
string guess_sequence(int NN) {
n=NN;
string pf="";
if(press("AB")){
if(press("A"))pf="A";
else pf="B";
}
else if(press("X"))pf+="X";
else pf+="Y";
vector<char>rem;
for(char c:{'A','B','X','Y'}){
if(c!=pf[0])rem.push_back(c);
}
for(int _=0;_<n-2;_++){
string cur="";
cur+=pf+rem[0]+rem[0];
cur+=pf+rem[0]+rem[1];
cur+=pf+rem[0]+rem[2];
cur+=pf+rem[1];
int res=press(cur);
if(res==pf.size())pf+=rem[2];
else if(res==pf.size()+1)pf+=rem[1];
else pf+=rem[0];
}
if(press(pf+rem[0])==pf.size()+1)pf+=rem[0];
else if(press(pf+rem[1])==pf.size()+1)pf+=rem[1];
else pf+=rem[2];
return pf;
}
컴파일 시 표준 에러 (stderr) 메시지
combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:39:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
39 | if(res==pf.size())pf+=rem[2];
| ~~~^~~~~~~~~~~
combo.cpp:40:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
40 | else if(res==pf.size()+1)pf+=rem[1];
| ~~~^~~~~~~~~~~~~
combo.cpp:43:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
43 | if(press(pf+rem[0])==pf.size()+1)pf+=rem[0];
| ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
combo.cpp:44:29: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
44 | else if(press(pf+rem[1])==pf.size()+1)pf+=rem[1];
| ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |