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;
const int MAXN = 100100;
const int INF = 123456;
int app[MAXN];
bool secondTime[MAXN];
void printAns(vector<int> C, vector<int> X, vector<int> Y) {
cout << "C: ";
for (int x : C)
cout << x << " ";
cout << endl;
cout << "(X, Y): ";
for (int i = 0; i < (int)X.size(); i++) {
cout << "(" << X[i] << ", "
<< Y[i] << ") ";
}
cout << endl;
}
void create_circuit(int M, std::vector<int> A) {
A.push_back(0);
int reqTrig = A.size();
memset(app, 0, sizeof(app));
memset(secondTime, false, sizeof(secondTime));
vector<int> C(M + 1, INF);
vector<int> X, Y;
for (int x : A)
app[x]++;
int sCount = -1;
C[0] = A[0];
for (int i = 0; i < reqTrig-1; i++) {
int now = A[i];
int nex = A[i+1];
if (secondTime[now]) {
Y[-C[now]-1] = nex;
} else if (app[A[i]] == 2) {
C[now] = sCount;
sCount -= 1;
X.push_back(nex);
Y.push_back(-1);
} else {
C[now] = nex;
}
secondTime[now] = true;
}
for (int i = 1; i <= M; i++) {
if (C[i] == INF)
C[i] = 0;
}
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... |