Submission #585599

#TimeUsernameProblemLanguageResultExecution timeMemory
585599LIFMechanical Doll (IOI18_doll)C++14
0 / 100
8 ms2644 KiB
#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 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...