이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
//#include <bits/stdc++.h>
#include <iostream>
#include "combo.h"
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <queue>
//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
using namespace std;
#ifdef LOCAL
#define show(x) cerr << #x" = " << (x) << "\n"
#else
#define show(x) 0
#endif
#define pb push_back
#define pp pop_back
#define mp make_pair
#define fst first
#define snd second
#define FOR(var, from, to) for(int var = from; var < int(to); ++var)
#define all(x) x.begin(), x.end()
#define rev(x) x.rbegin(), x.rend()
#define sz(x) int(x.size())
#define vec(x) vector<x>
#define INF 2000000000
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
// use unique second element of pair to work as multiset
//typedef tree<pii,null_type,less<pii>,rb_tree_tag,tree_order_statistics_node_update> ordered_multiset;
const ll mod = 1000000007, mod2 = 998244353;
template<typename T, typename U> ostream &operator<<(ostream &os, pair<T,U> p){os << "(" << p.fst << "," << p.snd << ")"; return os;}
template<typename T, typename U> istream &operator>>(istream &is, pair<T,U> &p){is >> p.fst >> p.snd; return is;}
template<typename T> istream &operator>>(istream &is, vector<T> &v){FOR(i, 0, v.size()) is >> v[i]; return is;}
template<typename T> ostream &operator<<(ostream &os, vector<T> v){for(T x : v) os << x << " "; return os;}
template<typename T> ostream &operator<<(ostream &os, set<T> s){for(T x : s) os << x << " "; return os;}
template<typename T> ostream &operator<<(ostream &os, multiset<T> s){for(T x : s) os << x << " "; return os;}
template<typename T, typename U> ostream &operator<<(ostream &os, map<T,U> m){for(auto x : m) os << x << " "; return os;}
//ostream &operator<<(ostream &os, ordered_set s){for(int x : s) os << x << " "; return os;}
//ostream &operator<<(ostream &os, ordered_multiset s){for(pii x : s) os << x.fst << " "; return os;}
ll mod_pow(ll a, ll b, ll m){ ll sol = 1; while(b){ if(b&1){ sol = (sol*a)%m; b--; }else{ a = (a*a)%m; b/=2; } } return sol;}
ll rem(ll a, ll b){ ll res = a%b; return res < 0 ? res+b : res; }
string guess_sequence(int n){
string abxy = "ABXY";
int f;
string s;
if(press("AB") > 0){
if(press("A") > 0) s = "A", f = 0;
else s = "B", f = 1;
}else{
if(press("X") > 0) s = "X", f = 2;
else s = "Y", f = 3;
}
if(n == 1) return s;
FOR(i, 2, n){
string t;
t += s;
t.pb(abxy[(f+2)%4]);
t += s;
t.pb(abxy[(f+3)%4]);
t.pb(abxy[(f+1)%4]);
t += s;
t.pb(abxy[(f+3)%4]);
t.pb(abxy[(f+2)%4]);
t += s;
t.pb(abxy[(f+3)%4]);
t.pb(abxy[(f+3)%4]);
int ret = press(t);
if(ret == sz(s)) s.pb(abxy[(f+1)%4]);
else if(ret == sz(s)+1) s.pb(abxy[(f+2)%4]);
else s.pb(abxy[(f+3)%4]);
show(s);
}
if(press(s+"A"+s+"B") > sz(s)){
if(press(s+"A") > sz(s)) s.pb('A');
else s.pb('B');
}else{
if(press(s+"X") > sz(s)) s.pb('X');
else s.pb('Y');
}
return s;
}
컴파일 시 표준 에러 (stderr) 메시지
combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:17:17: warning: statement has no effect [-Wunused-value]
17 | #define show(x) 0
| ^
combo.cpp:81:3: note: in expansion of macro 'show'
81 | show(s);
| ^~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |