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>
#define pb push_back
#define vi vector<int>
#define fi first
#define se second
//#define local
#ifndef local
#include "doll.h"
#endif
using namespace std;
void create_circuit(int M, vi A) {
int n = A.size();
vi C(M+1);
vector<int> X, Y;
vector<vector<int> > F(M+1);
int num = 0;
C[0] = A[0];
for (int i = 0; i < n; ++i) {
if (C[A[i]] == 0) C[A[i]] = -(++num);
int id = -C[A[i]];
F[id].pb((i != n-1 ? A[i+1] : 0));
}
for (auto i = 1; i <= M; i++) {
if (F[i].size() == 0) continue;
if (F[i].size() == 1) X.pb(-i), Y.pb(F[i][0]);
else X.pb(F[i][0]), Y.pb(F[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... |