# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1037128 | HappyCapybara | Mechanical Doll (IOI18_doll) | C++17 | 52 ms | 12864 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<bits/stdc++.h>
using namespace std;
void create_circuit(int M, vector<int> A) {
vector<vector<int>> v(M+1);
A.push_back(0);
for (int i=0; i<A.size()-1; i++) v[A[i]].push_back(A[i+1]);
v[0].push_back(A[0]);
vector<int> C(M+1, 0);
vector<int> X, Y;
for (int i=0; i<=M; i++){
if (v[i].size() == 0) continue;
if (v[i].size() == 1) C[i] = v[i][0];
if (v[i].size() == 2){
X.push_back(v[i][0]);
Y.push_back(v[i][1]);
C[i] = -X.size();
}
if (v[i].size() == 3){
int cur = X.size();
C[i] = -(cur+1);
X.push_back(-(cur+2));
Y.push_back(-(cur+3));
X.push_back(v[i][0]);
Y.push_back(-(cur+1));
X.push_back(v[i][1]);
Y.push_back(v[i][2]);
}
if (v[i].size() == 4){
int cur = X.size();
C[i] = -(cur+1);
X.push_back(-(cur+2));
Y.push_back(-(cur+3));
X.push_back(v[i][0]);
Y.push_back(v[i][2]);
X.push_back(v[i][1]);
Y.push_back(v[i][3]);
}
}
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... |