# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
729384 | jampm | Election Campaign (JOI15_election_campaign) | C++17 | 1071 ms | 30888 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
const int Mxn = 1e5 + 1;
const int mxn = 2e5 + 1;
//hld
//nomás porq soy un mamador y es menos código hacer lca así que con binary lifting
int tin[Mxn], tout[Mxn], Sz[Mxn], head[Mxn], P[Mxn], Depth[Mxn], cnt = 1;
vector<int> g[Mxn];
void get_sz(int node = 1, int parent = 1) {
Sz[node] = 0; Depth[node] = Depth[parent] + 1; P[node] = parent;
if (g[node][0] == parent) swap(g[node][0], g[node].back());
for (auto & child : g[node]) {
if (child == parent) continue;
get_sz(child, node); Sz[node] += Sz[child];
if (Sz[child] > Sz[g[node][0]]) swap(child, g[node][0]);
}
}
void dfs_hld(int node = 1, int parent = 1) {
tin[node] = cnt++;
for (auto child : g[node]) {
if (child == parent) continue;
head[child] = (child == g[node][0]) ? head[node] : child;
dfs_hld(child, node);
}
tout[node] = cnt++;
}
void init_hld() {head[1] = 1; Depth[1] = 0; get_sz(), dfs_hld();}
# | 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... |