Submission #419986

#TimeUsernameProblemLanguageResultExecution timeMemory
419986SuhaibSawalha1Mechanical Doll (IOI18_doll)C++17
6 / 100
87 ms12736 KiB
#include "doll.h" #include <bits/stdc++.h> using namespace std; void create_circuit(int M, vector<int> A) { int N = A.size(); vector<int> C(M + 1), X, Y; vector<vector<int>> next(M + 1); C[0] = A[0]; A.push_back(0); for (int i = 0; i < N; ++i) { next[A[i]].push_back(A[i + 1]); } for (int i = 1; i <= M; ++i) { if (next[i].empty()) { continue; } C[i] = -(int)X.size() - 1; if (next[i].size() == 1) { X.push_back(C[i]); Y.push_back(next[i][0]); } else { X.push_back(next[i][0]); Y.push_back(next[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...