이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include "doll.h"
using namespace std;
const int MN = 2e5 + 3;
void create_circuit (int m, vector<int> a) {
a.push_back(0);
int n = (int)a.size(), go = 1 << (__lg(n - 1) + 1), cur = 1; ++m;
vector<int> c(m), x(1), y(1);
iota(c.begin(),c.end(),0); c[0] = -1;
auto build = [&] (int l, int r, int ind, int dep, const auto &ref) -> int {
if (l == r) {
if (ind - go + n < 0) return -1;
c[a[ind-go+n]] = -1;
return a[ind-go+n];
}
int mid = (l + r) / 2;
int lc = ref(l,mid,ind,dep+1,ref), rc = ref(mid+1,r,ind | (1 << dep),dep+1,ref);
if (lc == rc) return lc;
x.push_back(lc); y.push_back(rc);
return -(++cur);
};
x[0] = build(0,go/2-1,0,1,build); y[0] = build(go/2,go-1,1,1,build);
answer(c,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... |