| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 125378 | teomrn | Mechanical Doll (IOI18_doll) | C++14 | 130 ms | 14788 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "doll.h"
#include <bits/stdc++.h>
using namespace std;
const int NMAX = 200010;
vector <int> X, Y, C;
int n, m;
vector <int> urm[NMAX], act;
vector <int> build_ord(int h)
{
if (h == 0)
return { 0 };
auto x = build_ord(h - 1);
auto y = x;
for (auto & i : x)
i *= 2;
for (auto & i : y)
i = 2 * i + 1;
for (auto i : y)
x.push_back(i);
return x;
}
int build_switch(int h, int from, vector <int> & fii)
{
if (h != 0) {
int nod = X.size() + 1;
X.push_back(0);
Y.push_back(0);
int st = build_switch(h - 1, from, fii);
int dr = build_switch(h - 1, from + (1 << (h - 1)), fii);
X[nod - 1] = st;
Y[nod - 1] = dr;
return -nod;
}
return fii[from];
}
void create_circuit(int M, std::vector<int> A) {
n = A.size(), m = M;
A.push_back(0);
C.resize(m + 1);
C[0] = A[0];
int root = -1;
int h = 0;
while ((1 << h) < n)
h++;
auto ord = build_ord(h);
int dec = ord.size() - n;
for (auto & i : ord) {
if (i < dec)
i = root;
else {
assert(i - dec + 1 < A.size());
i = A[i - dec + 1];
}
}
fill(C.begin() + 1, C.end(), build_switch(h, 0, ord));
answer(C, X, Y);
}
컴파일 시 표준 에러 (stderr) 메시지
| # | 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... | ||||
