제출 #197873

#제출 시각아이디문제언어결과실행 시간메모리
197873DavidDamian자동 인형 (IOI18_doll)C++11
0 / 100
26 ms11052 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...