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"
// #include "grader.cpp"
using namespace std;
const int maxn = (int)1e5 + 7;
int cnt[maxn];
void create_circuit(int M, vector<int> A) {
int N = A.size();
vector<int> C(M + 1);
vector<int> X, Y;
C[0] = A[0];
for (int i = 0; i < N; i++) {
cnt[A[i]]++;
int to = ((i + 1 == N) ? 0 : A[i + 1]);
if (cnt[A[i]] == 1) {
C[A[i]] = -((int)X.size() + 1);
X.push_back(C[A[i]]);
Y.push_back(to);
} else {
X[-C[A[i]] - 1] = Y[-C[A[i]] - 1];
Y[-C[A[i]] - 1] = to;
}
}
answer(C, X, Y);
}
/*
3 6
1 2 3 2 3 1
*/
# | 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... |