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, Y, T(M + 1), E(M + 1);
A.insert(A.begin(), 0);
for (int i : A) {
++T[i];
}
A.push_back(0);
for (int i = 0; i <= N; ++i) {
--T[A[i]];
if (T[i] == 0) {
if (E[A[i]] == 0) {
C[A[i]] = A[i + 1];
}
else {
Y[E[A[i]] - 1] = A[i + 1];
}
}
else {
if (E[A[i]] == 0) {
X.push_back(A[i + 1]);
Y.push_back(0);
E[A[i]] = X.size();
C[A[i]] = -E[A[i]];
}
else {
X.push_back(A[i + 1]);
Y.push_back(0);
Y[E[A[i]] - 1] = X.size();
E[A[i]] = X.size();
}
}
}
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... |