이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "combo.h"
//#include "grader.cpp"
#include <bits/stdc++.h>
#define ll int
#define str string
#define ins insert
#define ld long double
#define pb push_back
#define pf push_front
#define pof pop_front()
#define pob pop_back()
#define lb lower_bound
#define ub upper_bound
#define endl "\n"
#define fr first
#define sc second
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define sz size()
#define vll vector<ll>
#define bc back()
#define arr array
#define pll vector<pair<ll,ll>>
using namespace std;/*
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<ll, null_type,less_equal<ll>, rb_tree_tag,tree_order_statistics_node_update>*/
template<class S,class T>
bool chmin(S &a,const T &b) {
return a>b?(a=b)==b:false;
}
template<class S,class T>
bool chmax(S &a,const T &b) {
return a<b?(a=b)==b:false;
}
const ll mod=1e9+7;
const ld eps=1e-9;
const ll N=3e3+7;
str guess_sequence(ll n) {
ll i,j;
ll x=press("AB");
str s;
vector<char> v={'A','B','X','Y'};
if(x){
x=press("A");
if(x)s="A";
else s="B";
}else{
x=press("X");
if(x)s="X";
else s="Y";
}
v.erase(lower_bound(all(v),s[0]));
for(i=2;i<n;i++){
x=press(s+v[0]+s[0]+s+v[1]+v[0]+s+v[1]+v[1]+s+v[1]+v[2]);
if(x==s.sz+1)s+=v[0];
else if(x>s.sz+1)s+=v[1];
else s+=v[2];
}
x=press(s+v[0]+s+v[1]);
if(x==n){
x=press(s+v[0]);
if(x==n)s+=v[0];
else s+=v[1];
}else s+=v[2];
return s;
}
컴파일 시 표준 에러 (stderr) 메시지
combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:59:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
59 | if(x==s.sz+1)s+=v[0];
| ~^~~~~~~~
combo.cpp:60:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
60 | else if(x>s.sz+1)s+=v[1];
| ~^~~~~~~
combo.cpp:43:10: warning: unused variable 'j' [-Wunused-variable]
43 | ll i,j;
| ^
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |