이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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()==1){
C[i]=destiny[i][0];
}
else if(destiny[i].size()==2){
k++;
C[i]=-k;
X.push_back(destiny[i][0]);
Y.push_back(destiny[i][1]);
}
else if(destiny[i].size()==3){
k++;
C[i]=-k;
X.push_back(-(k+1));
Y.push_back(-(k+2));
X.push_back(-k);
Y.push_back(destiny[i][1]);
k+=2;
X.push_back(destiny[i][0]);
Y.push_back(destiny[i][2]);
}
else{
k++;
C[i]=-k;
X.push_back(-(k+1));
Y.push_back(-(k+2));
k++;
X.push_back(destiny[i][0]);
Y.push_back(destiny[i][2]);
k++;
X.push_back(destiny[i][1]);
Y.push_back(destiny[i][3]);
}
}
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... |