제출 #419981

#제출 시각아이디문제언어결과실행 시간메모리
419981SuhaibSawalha1자동 인형 (IOI18_doll)C++17
0 / 100
55 ms10236 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(M), Y(M); 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()) { next[i].push_back(0); } C[i] = -i; if (next[i].size() == 1) { X[i - 1] = -i; Y[i - 1] = next[i][0]; } else { X[i - 1] = next[i][0]; Y[i - 1] = 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...