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"
using namespace std;
#define debug(x) cerr<<#x<<" = "<<x<<endl
void create_circuit(int M, vector<int> A) {
int n = A.size();
vector<int> C(M + 1);
C[0] = A[0];
vector<int> destiny[100005];
for(int i=0;i<n-1;i++){
destiny[ A[i] ].push_back(A[i+1]);
}
destiny[ A[n-1] ].push_back(0);
vector<int> X,Y;
int k=0;
for(int i=1;i<=M;i++){
if(destiny[i].size()==0){
C[i]=0;
}
else if(destiny[i].size()==1){
C[i]=destiny[i][0];
}
else{
k++;
X.push_back(destiny[i][0]);
Y.push_back(destiny[i][1]);
C[i]=-k;
}
}
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... |