Submission #286120

#TimeUsernameProblemLanguageResultExecution timeMemory
286120NONAMEMechanical Doll (IOI18_doll)C++14
6 / 100
84 ms10972 KiB
#include "doll.h" const int MAX_M = (int)(1e5 + 500); std::vector <int> res, X, Y; std::vector <int> g[MAX_M]; void create_circuit (int m, std::vector <int> a) { int n = (int)(a.size()); res.resize(m + 1); res[0] = a[0]; for (int i = 0; i < n; ++i) g[a[i]].push_back((i + 1 == n) ? 0 : a[i + 1]); int cur = -1; for (int i = 1; i <= m; ++i) { if ((int)(g[i].size()) == 1) res[i] = g[i][0]; if ((int)(g[i].size()) == 2) { res[i] = cur; X.push_back(g[i][0]); Y.push_back(g[i][1]); --cur; } } answer(res, 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...