제출 #1197852

#제출 시각아이디문제언어결과실행 시간메모리
1197852MateiKing80자동 인형 (IOI18_doll)C++17
18 / 100
68 ms23584 KiB
#include "doll.h" #include <bits/stdc++.h> using namespace std; vector<int> ansX, ansY, ansLegit; int maxx = 1; void build(int loc, vector<int> a, int elSt) { vector<int> l, r; if ((int)a.size() <= elSt) r = a; else { vector<bool> ocup(a.size(), false); for (int i = 0; i < 2 * ((int)a.size() - elSt); i += 2) { l.push_back(a[i]); ocup[i] = 1; } for (int i = 0; i < (int)a.size(); i ++) if (!ocup[i]) r.push_back(a[i]); } if (elSt == 1) { if (!l.empty()) ansX[-loc - 1] = l[0]; else ansX[-loc - 1] = -1; if (!r.empty()) ansY[-loc - 1] = r[0]; else ansY[-loc - 1] = -1; return; } if (!l.empty()) { ansX[-loc - 1] = -(++ maxx); build(-maxx, l, elSt / 2); } else ansX[-loc - 1] = -1; if (!r.empty()) { ansY[-loc - 1] = -(++ maxx); build(-maxx, r, elSt / 2); } else ansY[-loc - 1] = -1; } void create_circuit(int m, vector<int> a) { a.push_back(0); int n = a.size(); ansLegit.resize(m + 1); ansX.resize(10 * n + 100); ansY.resize(10 * n + 100); for (int i = 0; i <= m; i ++) ansLegit[i] = -1; int x = 1; while (2 * x < n) x *= 2; build(-1, a, x); ansX.resize(maxx); ansY.resize(maxx); answer(ansLegit, ansX, ansY); }
#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...