이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#include "doll.h"
using namespace std;
using ll = long long;
void create_circuit(int m, std::vector<int> arr) {
vector<int> c(m+1);
vector<int> x, y;
auto add = [&](int a, int b){
x.push_back(a), y.push_back(b);
return -(int)x.size();
};
auto tree = [&](auto& tree, vector<int> nxt) {
if (nxt.size() == 1) {
return nxt[0];
}
vector<int> odd, even;
for (int i = 0; i < (int)nxt.size(); i += 2) {
odd.push_back(nxt[i]);
even.push_back(nxt[i+1]);
}
int t1 = tree(tree, odd);
int t2 = tree(tree, even);
return add(t1, t2);
};
arr.push_back(0);
reverse(arr.begin(), arr.end());
while (__builtin_popcount(arr.size()) > 1)
arr.push_back(INT_MAX);
reverse(arr.begin(), arr.end());
c[0] = tree(tree, arr);
for (int i = 0; i < (int)x.size(); i++) {
if (x[i] == INT_MAX)
x[i] = c[0];
if (y[i] == INT_MAX)
y[i] = c[0];
}
for (int i = 1; i <= m; i++)
c[i] = c[0];
answer(c, x, y);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |