이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#define sz(x) ((int) (x).size())
#define all(x) (x).begin(), (x).end()
#define pb push_back
using namespace std;
#include "doll.h"
int n;
vector<int> C, X(1, 1e9), Y(1, 1e9);
vector<int> vis(1e6, 0);
int l;
int new_node(){
X.pb(1e9);
Y.pb(1e9);
return sz(X) - 1;
}
int build(int x, int d, int v){
if(d == l) return v;
if(x == 1e9) x = new_node();
else x = -x - 1;
vis[x]++;
if(vis[x] % 2){
int k = build(X[x], d + 1, v);
X[x] = k;
}
else{
int k = build(Y[x], d + 1, v);
Y[x] = k;
}
return -x - 1;
}
void create_circuit(int M, std::vector<int> A) {
n = A.size();
C = vector<int>(M + 1, -1);
l = ceil(log2(n + 1));
for(auto x : A){
build(-1, 0, x);
}
for(int i = n + 1; i < (1 << l); i++) build(-1, 0, -1);
build(-1, 0, 0);
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... |