제출 #128498

#제출 시각아이디문제언어결과실행 시간메모리
128498Just_Solve_The_Problem자동 인형 (IOI18_doll)C++11
6 / 100
79 ms5944 KiB
#include <bits/stdc++.h> #include "doll.h" // #include "grader.cpp" using namespace std; const int maxn = (int)1e5 + 7; int cnt[maxn]; void create_circuit(int M, vector<int> A) { int N = A.size(); vector<int> C(M + 1); vector<int> X, Y; C[0] = A[0]; for (int i = 0; i < N; i++) { cnt[A[i]]++; int to = ((i + 1 == N) ? 0 : A[i + 1]); if (cnt[A[i]] == 1) { C[A[i]] = -((int)X.size() + 1); X.push_back(C[A[i]]); Y.push_back(to); } else { X[-C[A[i]] - 1] = Y[-C[A[i]] - 1]; Y[-C[A[i]] - 1] = to; } } answer(C, X, Y); } /* 3 6 1 2 3 2 3 1 */
#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...