제출 #434277

#제출 시각아이디문제언어결과실행 시간메모리
434277SuhaibSawalha1자동 인형 (IOI18_doll)C++17
0 / 100
1 ms204 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, T(M + 1), E(M + 1); A.insert(A.begin(), 0); for (int i : A) { ++T[i]; } A.push_back(0); for (int i = 0; i <= N; ++i) { --T[A[i]]; if (T[i] == 0) { if (E[A[i]] == 0) { C[A[i]] = A[i + 1]; } else { Y[E[A[i]] - 1] = A[i + 1]; } } else { if (E[A[i]] == 0) { X.push_back(A[i + 1]); Y.push_back(0); E[A[i]] = X.size(); C[A[i]] = -E[A[i]]; } else { X.push_back(A[i + 1]); Y.push_back(0); Y[E[A[i]] - 1] = X.size(); E[A[i]] = X.size(); } } } 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...