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;
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()) {
continue;
}
C[i] = -(int)X.size() - 1;
if (next[i].size() == 1) {
X.push_back(C[i]);
Y.push_back(next[i][0]);
}
else {
X.push_back(next[i][0]);
Y.push_back(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... |