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"
const int MAX_M = (int)(1e5 + 500);
std::vector <int> res, X, Y;
std::vector <int> g[MAX_M];
void create_circuit (int m, std::vector <int> a) {
int n = (int)(a.size());
res.resize(m + 1);
res[0] = a[0];
for (int i = 0; i < n; ++i)
g[a[i]].push_back((i + 1 == n) ? 0 : a[i + 1]);
int cur = -1;
for (int i = 1; i <= m; ++i) {
if ((int)(g[i].size()) == 1)
res[i] = g[i][0];
if ((int)(g[i].size()) == 2) {
res[i] = cur;
X.push_back(g[i][0]);
Y.push_back(g[i][1]);
--cur;
}
if ((int)(g[i].size()) == 3) {
res[i] = cur;
X.push_back(cur - 1);
Y.push_back(cur - 2);
X.push_back(cur);
Y.push_back(g[i][1]);
X.push_back(g[i][0]);
Y.push_back(g[i][2]);
cur -= 3;
}
}
answer(res, X, Y);
}
# | 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... |