이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#ifdef NYAOWO
#include "grader.cpp"
#define OUT_VEC(x) { cout << #x << ":"; { for(auto &IT:x) cout << " " << IT; } cout << "\n" << flush; }
#else
#define OUT_VEC(x)
#endif
#include "doll.h"
#include <bits/stdc++.h>
#define For(i, a, b) for(int i = a; i <= b; i++)
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define sz(x) ((int)x.size())
#define eb emplace_back
using namespace std;
using LL = long long;
using pii = pair<int, int>;
const int MAXM = 100010;
vector<int> x, y;
int solve(vector<int> &v, int l, int r) {
if(l == r) return v[l];
int m = (l + r) / 2;
int id = sz(x);
x.eb(0); y.eb(0);
int a = solve(v, m + 1, r);
int b = solve(v, l, m);
x[id] = a; y[id] = b;
// cout << l << " " << r << " " << id << " " << x[id] << " " << y[id] << " " << (-(id + 1)) << "\n" << flush;
return -(id + 1);
}
void create_circuit(int M, std::vector<int> A) {
A.eb(0);
vector<int> ans(M + 1, -1);
reverse(all(A));
ans[0] = A.back();
A.pop_back();
int lgn = __lg(sz(A) - 1) + 1;
int n = (1 << lgn);
while(sz(A) < n) A.eb(-1);
{
int j = 0;
For(i, 0, n - 1) {
if(i < j) swap(A[i], A[j]);
for(int k = n >> 1; (j ^= k) < k; k >>= 1);
}
}
solve(A, 0, n - 1);
OUT_VEC(ans);
OUT_VEC(x);
OUT_VEC(y);
answer(ans, x, y);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |