# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1120008 | Captain_Georgia | Ball Machine (BOI13_ballmachine) | C++17 | 240 ms | 33836 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 long long ll;
int32_t main () {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int N, Q;
cin >> N >> Q;
vector<int> g[N];
int root = -1;
for (int i = 0;i < N;i ++) {
int p;
cin >> p;
-- p;
if (p != -1) g[p].push_back(i);
else root = i;
}
assert(root != -1);
const int lg = 20;
vector<vector<int>> up(lg, vector<int>(N, 0));
vector<int> tin(N, 0), tout(N, 0), submn(N), depth(N, 0);
int _time = 0;
function<void(int, int)> dfs_init = [&](int si, int pi) -> void {
up[0][si] = pi;
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... |