Submission #413261

#TimeUsernameProblemLanguageResultExecution timeMemory
413261schseMechanical Doll (IOI18_doll)C++17
2 / 100
60 ms7724 KiB
#include "doll.h" #ifndef EVAL #include "grader.cpp" #endif #include <bits/stdc++.h> using namespace std; struct node { vector<int> out; }; void create_circuit(int M, std::vector<int> A) { int N = A.size(); vector<node> g(M + 1); vector<int> C(M + 1), X, Y; fill(C.begin(), C.end(), 0); C[0] = A[0]; g[0].out.push_back(A[0]); for (int i = 1; i < N; i++) { g[A[i - 1]].out.push_back(A[i]); } for (int i = 0; i < M + 1; i++) { if (g[i].out.size() == 0) C[i] = 0; else if (g[i].out.size() == 1) C[i] = g[i].out[0]; else if (g[i].out.size() == 2) { X.push_back(g[i].out[0]); Y.push_back(g[i].out[1]); C[i] = X.size() * -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...