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) {
int N = A.size();
vector<int> C(M + 1), X(M), Y(M);
vector<vector<int>> next(M + 1);
C[0] = A[0];
A.push_back(0);
for (int i = 0; i < N; ++i) {
next[A[i]].push_back(A[i + 1]);
}
for (int i = 1; i <= M; ++i) {
if (next[i].empty()) {
next[i].push_back(0);
}
C[i] = -i;
if (next[i].size() == 1) {
X[i - 1] = -i;
Y[i - 1] = next[i][0];
}
else {
X[i - 1] = next[i][0];
Y[i - 1] = next[i][1];
}
}
answer(C, 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... |