이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#include<combo.h>
using namespace std;
using int64 = int64_t;
#define REP(i, n) for(int i = 0, _n = n; i < _n; ++i)
#define REPD(i, n) for(int i = n - 1; i >= 0; --i)
#define FOR(i, l, r) for(int i = l, _r = r; i <= _r; ++i)
#define FORD(i, r, l) for(int i = r, _l = l; i >= _l; --i)
#define left __left
#define right __right
#define prev __prev
#define next __next
#define div __div
#define pb push_back
#define pf push_front
#define sz(v) (int)v.size()
#define range(v) begin(v), end(v)
#define compact(v) v.erase(unique(range(v)), end(v))
#define debug(v) "[" #v " = " << (v) << "]"
template<typename T>
bool minimize(T& a, const T& b){
if(a > b){
a = b;
return true;
}
return false;
}
template<typename T>
bool maximize(T& a, const T& b){
if(a < b){
a = b;
return true;
}
return false;
}
template<int dimension, class T>
struct vec : public vector<vec<dimension - 1, T>> {
static_assert(dimension > 0, "Dimension must be positive !\n");
template<typename... Args>
vec(int n = 0, Args... args) : vector<vec<dimension - 1, T>>(n, vec<dimension - 1, T>(args...)) {}
};
template<class T>
struct vec<1, T> : public vector<T> {
vec(int n = 0, T val = T()) : vector<T>(n, val) {}
};
string guess_sequence(int N){
string s = "", p = "";
p = "AB";
if(press(p)){
p = "A";
if(press(p)){
s += "A";
}
else{
s += "B";
}
}
else{
p = "X";
if(press(p)){
s += "X";
}
else{
s += "Y";
}
}
if(N == 1) return s;
string available = "";
if(s != "A") available += "A";
if(s != "B") available += "B";
if(s != "X") available += "X";
if(s != "Y") available += "Y";
FOR(i, 2, N - 1){
string tmp = s + available[0] + available[0] + s + available[0] + available[1] + s + available[0] + available[2] + s + available[1];
int corrected = press(tmp);
if(corrected == i + 1) s += available[0];
else if(corrected == i) s += available[1];
else s += available[2];
}
if(press(s + available[0]) == N) s += available[0];
else if(press(s + available[1]) == N) s += available[1];
else s += available[2];
return s;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |