Submission #197870

#TimeUsernameProblemLanguageResultExecution timeMemory
197870DavidDamianMechanical Doll (IOI18_doll)C++11
6 / 100
103 ms10972 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()==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 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...