이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
// Iterative segt implementation makes it easy to implement yay
#include "doll.h"
#include <iostream>
#include <vector>
using namespace std;
#define rep(i, a, b) for (auto i = (a); i < (b); ++i)
#define eb(x...) emplace_back(x)
const int inf = 1e9, N = 1 << 18;
int t[N << 1], r[N];
void create_circuit(int m, vector<int> a) {
a.eb(0); int n = a.size(), sz = 1;
while (sz < n) sz <<= 1;
rep(i, 0, sz) t[i + sz] = inf;
for (int i = 0, j = 0; i < sz; ++i) {
r[i] = r[i >> 1];
if (i & 1) r[i] |= sz;
r[i] >>= 1;
if (sz - n <= r[i])
t[r[i] + sz] = a[j++];
}
int rt = 0;
vector<int> x, y;
for (int i = sz; --i; )
if (t[i << 1|0] != t[i << 1|1]) {
t[i] = --rt;
x.eb(t[i << 1|0]);
y.eb(t[i << 1|1]);
} else t[i] = t[i << 1];
rep(i, 0, -rt) {
if (x[i] == inf) x[i] = rt;
if (y[i] == inf) y[i] = rt;
}
answer(vector<int>(m + 1, rt), 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... |