제출 #426446

#제출 시각아이디문제언어결과실행 시간메모리
426446Monchito자동 인형 (IOI18_doll)C++14
0 / 100
185 ms332 KiB
#include "doll.h" using namespace std; #define sz(x) (int)x.size() void create_circuit(int M, vector<int> A) { vector<int> C(M+1), X, Y; vector<vector<int>> cnt(M); A.push_back(0); cnt[0].push_back(A[0]); for(int i=0; i<sz(A)-1; i++) cnt[A[i]].push_back(A[i+1]); C[0] = A[0]; for(int i=1; i<M+1; i++) { if(!cnt.empty()) C[i] = i; } vector<bool> ok(M+1, false); int current_s = -1; for(int i=0; i<sz(A)-1; i++) { if(ok[A[i]]) continue; if(sz(cnt[A[i]]) == 1) C[A[i]] = cnt[A[i]][0]; else { C[A[i]] = current_s; X.push_back(cnt[A[i]][0]); Y.push_back(cnt[A[i]][1]); current_s--; } ok[A[i]] = true; } 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...