제출 #288472

#제출 시각아이디문제언어결과실행 시간메모리
288472andrew자동 인형 (IOI18_doll)C++17
2 / 100
46 ms10280 KiB
#include <bits/stdc++.h> #include "doll.h" #define fi first #define se second #define p_b push_back #define m_p make_pair #define sz(x) (int)x.size() #define pii pair <int, int> #define all(x) x.begin(),x.end() using namespace std; typedef long long ll; const ll inf = 1e18; ll stn = 0, id = -1; vector <int> x, y, st; int dfs(int tl, int tr){ if(tl == tr)return st[tl]; else{ int tm = (tl + tr) >> 1; stn++; id--; x.p_b(0); y.p_b(0); x[stn - 1] = dfs(tl, tm); y[stn - 1] = dfs(tm + 1, tr); return id + 1; } } void create_circuit(int M, vector<int> A) { int n = sz(A); stn = -1; std::vector<int> C(M + 1); vector <vector <int>> v(M + 1); A.p_b(0); for(int i = 0; i < n; i++){ v[A[i]].p_b(A[i + 1]); } C[0] = A[0]; for(int i = 1; i <= M; i++){ st = v[i]; if(st.empty())C[i] = 0; else{ C[i] = dfs(0, sz(st) - 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...