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"
#ifndef EVAL
#include "grader.cpp"
#endif
#include <bits/stdc++.h>
using namespace std;
struct node
{
vector<int> out;
};
void create_circuit(int M, std::vector<int> A)
{
int N = A.size();
vector<node> g(M + 1);
vector<int> C(M + 1), X, Y;
fill(C.begin(), C.end(), 0);
C[0] = A[0];
g[0].out.push_back(A[0]);
for (int i = 1; i < N; i++)
{
g[A[i - 1]].out.push_back(A[i]);
}
for (int i = 0; i < M + 1; i++)
{
if (g[i].out.size() == 0)
C[i] = 0;
else if (g[i].out.size() == 1)
C[i] = g[i].out[0];
else if (g[i].out.size() == 2)
{
X.push_back(g[i].out[0]);
Y.push_back(g[i].out[1]);
C[i] = X.size() * -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... |