# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
430429 | TheWilp | Mechanical Doll (IOI18_doll) | C++14 | 407 ms | 262148 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 "doll.h"
#include <iostream>
#include <vector>
int cnt = 1;
std::vector<int> C;
std::vector<int> X;
std::vector<int> Y;
void print_vector(std::vector<int>& v){
for(int q = 0 ;q<v.size();q++){
std::cout << v[q] << " ";
}std::cout << std::endl;
}
int create(std::vector<int> v){
if(v.size() == 1)
return v[0];
X.push_back(0);Y.push_back(0);
int node_create = cnt++;
std::vector<int> vleft;
std::vector<int> vright;
for(int q = 0 ;q<v.size();q+=2){
vleft.push_back(v[q]);
}
for(int q = 1 ;q<v.size();q+=2){
vright.push_back(v[q]);
}
if(vleft.size() > vright.size()){
vright.push_back(vleft.back());
vleft.push_back(-node_create);
}
int get1 = create(vleft);
int get2 = create(vright);
X[node_create - 1] = get1;
Y[node_create - 1] = get2;
return -node_create;
}
void create_circuit(int M, std::vector<int> A) {
for(int q = 0 ;q<=M;q++){
C.push_back(-1);
}
create(A);
answer(C, X, Y);
}
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... |