| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 102699 | bert30702 | Mechanical Doll (IOI18_doll) | C++17 | 168 ms | 10640 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#include "doll.h"
using namespace std;
const int MX = 4e5 + 100;
int c[MX], x[MX], y[MX];
bool GG[MX];
int ptr;
int build(vector<int> v) {
if(*max_element(v.begin(), v.end()) ==
*min_element(v.begin(), v.end())) return v[0];
vector<int> a, b;
int p = --ptr;
for(int i = 0; i < v.size(); i ++) {
if(i & 1) b.push_back(v[i]);
else a.push_back(v[i]);
}
x[-p] = build(a);
y[-p] = build(b);
return p;
}
void create_circuit(int n, vector<int> v) {
int ttt = v.size();
c[0] = v[0];
int k = 1 << __lg(v.size() * 2 - 1);
int need = k - v.size();
auto f = [&](int v) {
int pp = 0;
for(int j = 0; j < __lg(k); j ++) {
if(v & (1 << j)) pp += 1 << (__lg(k) - j - 1);
}
return pp;
};
vector<int> tmp(k, 0);
v.push_back(0);
for(int i = 0; i < need; i ++) tmp[f(i)] = -1;
for(int i = k - 1; i >= 0; i --) {
if(!tmp[i]) tmp[i] = v.back(), v.pop_back();
}
int t = build(tmp);
for(int i = 1; i <= n; i ++) c[i] = -1;
for(int i = 1; i <= -ptr + 1; i ++) {
if(x[i] == -1) x[i] = t;
if(y[i] == -1) y[i] = t;
}
for(int i = 0; i <= n; i ++) {
if(c[i] == -1) c[i] = t;
}
answer(
vector<int>(c, c + 1 + n),
vector<int>(x + 1, x + 1 -ptr),
vector<int>(y + 1, y + 1 -ptr)
);
}Compilation message (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... | ||||
