# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
786944 | n1427 | Ball Machine (BOI13_ballmachine) | C++17 | 189 ms | 27932 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;
int n, q, root, timer = 0;
vector<int> parent, depth, subtreeMin, subtreeSize, timeIn;
vector<vector<int>> ancestor;
vector<vector<int>> adjList;
vector<pair<int, int>> queries;
vector<bool> colour;
priority_queue<pair<int, int>> whiteNodes;
void depthFirstSearchA(const int& u)
{
subtreeMin[u] = u;
subtreeSize[u] = 1;
for (auto &v : adjList[u])
{
depth[v] = depth[u] + 1;
ancestor[v][0] = u;
for (int b = 1; ancestor[v][b - 1] != -1; b++)
ancestor[v][b] = ancestor[ancestor[v][b - 1]][b - 1];
depthFirstSearchA(v);
subtreeMin[u] = min(subtreeMin[v], subtreeMin[u]);
subtreeSize[u] += subtreeSize[v];
}
sort(adjList[u].begin(), adjList[u].end(), [&](const int& v1, const int& v2) -> bool
# | 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... |