제출 #602272

#제출 시각아이디문제언어결과실행 시간메모리
602272skittles1412자동 인형 (IOI18_doll)C++17
66.61 / 100
148 ms14460 KiB
#include "bits/extc++.h" using namespace std; template <typename T> void dbgh(const T& t) { cerr << t << endl; } template <typename T, typename... U> void dbgh(const T& t, const U&... u) { cerr << t << " | "; dbgh(u...); } #ifdef DEBUG #define dbg(...) \ cerr << "L" << __LINE__ << " [" << #__VA_ARGS__ << "]: "; \ dbgh(__VA_ARGS__); #else #define dbg(...) #define cerr \ if (false) \ cerr #endif #define endl "\n" #define long int64_t #define sz(x) int((x).size()) void answer(vector<int> C, vector<int> X, vector<int> Y); vector<pair<int, int>> ans; pair<int, int> alloc() { int o = sz(ans), oind = -o - 1; ans.emplace_back(0, 0); return {o, oind}; } int construct(const vector<int>& arr) { if (all_of(begin(arr), end(arr), [&](int x) -> bool { return x == arr[0]; })) { return arr[0]; } auto [o, oind] = alloc(); int targ = 1 << (__lg(sz(arr) - 1)), cind = 0; vector<int> l, r; for (int i = 0; i < 2 * targ - sz(arr); i++) { l.push_back(oind); r.push_back(arr[cind++]); } while (cind < sz(arr)) { l.push_back(arr[cind++]); r.push_back(arr[cind++]); } ans[o] = {construct(l), construct(r)}; return oind; } void create_circuit(int m, vector<int> arr) { int first = arr[0]; arr.erase(arr.begin()); arr.push_back(0); vector<int> ans1(m + 1, construct(arr)); ans1[0] = first; vector<int> ans2, ans3; for (auto& [x, y] : ans) { ans2.push_back(x); ans3.push_back(y); } answer(ans1, ans2, ans3); }
#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...