# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
430225 | TheWilp | Mechanical Doll (IOI18_doll) | C++14 | 91 ms | 12592 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 <vector>
#include <iostream>
std::vector<int> f[100005];
int cnt = 1;
std::vector<int> C;
std::vector<int> X;
std::vector<int> Y;
int create(int pos,int left,int right){
//std::cout << pos << " " << left << " " << right << std::endl;
if(right == left)
return f[pos][left];
int node_create = cnt;
cnt++;
int mid = (right + left) / 2;
X.push_back(0);Y.push_back(0);
int get1 = create(pos,left,mid);
int get2 =create(pos,mid + 1,right);
X[node_create - 1] = get1;
Y[node_create - 1] = get2;
return -node_create;
}
void print_vector(std::vector<int>& v){
for(int q = 0 ;q<v.size();q++){
std::cout << v[q] << " ";
}std::cout << std::endl;
}
void create_circuit(int M, std::vector<int> A) {
for(int q = 1;q<A.size();q++){
f[A[q - 1]].push_back(A[q]);
}
f[A.back()].push_back(0);
C.push_back(A[0]);
for(int q = 1 ;q<=M;q++){
if(f[q].size() == 0)
C.push_back(0);
else
C.push_back(create(q,0,f[q].size() - 1));
}
//print_vector(C);
//print_vector(X);
// print_vector(Y);
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... |