Submission #585622

#TimeUsernameProblemLanguageResultExecution timeMemory
585622LIFMechanical Doll (IOI18_doll)C++14
16 / 100
76 ms12568 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[100005]; 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]); } if(sum == 3 || sum ==4) { fir++; int ff = fir; c[i] = 0-fir; x.push_back(-(fir+1)); y.push_back(-(fir+2)); if(sum == 3) { x.push_back(node[i][0]); x.push_back(node[i][1]); y.push_back(-ff); y.push_back(node[i][2]); fir+=2; } else { x.push_back(node[i][0]); x.push_back(node[i][1]); y.push_back(node[i][2]); y.push_back(node[i][3]); fir+=2; } } } 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...