# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
954852 | Trisanu_Das | 자동 인형 (IOI18_doll) | C++17 | 57 ms | 11168 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include "doll.h"
using namespace std;
vector<int> seq, X, Y, C;
int sz, dpth, layer;
void dfs(int u, int d, int v){
if(d < dpth){
dfs(u * 2, d + 1, v);
dfs(u * 2 + 1, d + 1, v + (1 << (d - 1)));
X[u - 1] = -u * 2; Y[u - 1] = X[u - 1] - 1;
}else{
X[u - 1] = (v >= sz - 1 ? -1 : seq[v]);
if(v + (1 << (d - 1)) == (1 << dpth) - 1) Y[u - 1] = 0;
else Y[u - 1] = (v + (1 << (d - 1)) >= sz - 1 ? -1 : seq[v + (1 << (d - 1))]);
}
}
void create_circuit(int M, vector<int> A){
seq.clear(), X.clear(), Y.clear(), C.clear();
seq = A;
sz = seq.size() + 1;
dpth = log2(sz);
if((1 << dpth) != sz) dpth++;
layer = (1 << dpth) - 1;
X.resize(layer), Y.resize(layer), C.resize(M + 1);
dfs(1, 1, 0);
for(int i = 0; i <= M; i++) C[i] = -1;
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... |