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, std::vector<int> A) {
int N = A.size();
std::vector<int> x,y;
std::vector<int> c(M+1);
int n = N;
vector<int> node[10005];
int tt = A[0];
c[0] = tt;
node[0].push_back(tt);
for(int i=0; i<=n-2; i++)
{
int xx = A[i];
int kk = A[i+1];
node[xx].push_back(kk);
}
node[A[n-1]].push_back(0);
int fir=0;
for(int i=1;i<=M;i++)
{
int sum = node[i].size();
if(sum==1)
{
c[i] = node[i][0];
}
if(sum==2)
{
fir++;
c[i] = 0-fir;
x.push_back(node[i][0]);
y.push_back(node[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... |