# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
872074 | vjudge1 | Ball Machine (BOI13_ballmachine) | C++17 | 1081 ms | 131072 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> pii;
const int N = 1e5 + 7, SQ = 320;
int n, q, s, t, root, h[N], st[N], sz[N], mn[N], indx[N], it[N];
vector<int> ad[N];
set<pii> ver, one[N], sq[SQ];
pii tree[N];
void input() {
cin >> n >> q;
for (int i = 0; i < n; i++) {
int p;
cin >> p;
p--;
if (p > -1)
ad[p].push_back(i);
else
root = i;
}
}
void dfs(int v) {
sz[v] = 1;
mn[v] = v;
st[v] = s++;
for (int u: ad[v]) {
h[u] = h[v] + 1;
Compilation message (stderr)
# | 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... |