# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1020919 | Zicrus | Mechanical Doll (IOI18_doll) | C++17 | 49 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 <bits/stdc++.h>
#include "doll.h"
using namespace std;
typedef long long ll;
vector<int> C, X, Y;
void connect(int a, vector<int> b) {
if (b.empty()) return;
if (b.size() == 1) {
C[a] = b[0];
}
else {
X.push_back(b[0]);
Y.push_back(b[1]);
C[a] = -X.size();
}
}
void create_circuit(int M, vector<int> A) {
A.push_back(0);
C = vector<int>(M + 1);
X = vector<int>(); Y = vector<int>();
vector<vector<int>> adj(M + 1);
int prev = 0;
for(auto &e : A) {
adj[prev].push_back(e);
prev = e;
}
for (int i = 0; i < adj.size(); i++) {
connect(i, adj[i]);
}
answer(C, X, Y);
return;
}
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... |