# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
239239 | frodakcin | Synchronization (JOI13_synchronization) | C++11 | 333 ms | 23544 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 <cstdio>
#include <cstring>
#include <cassert>
#include <functional>
#include <vector>
#include <set>
const int MN = 1e5+10, MM = 2e5+10;
struct edge
{
public:
int n, id;
};
std::vector<edge> a[MN];
int N, M, Q, p[MN][1], s[MN], d[MN], h[MN], t[MN], l[MN], f[MN], m[MN], w[MN];
const auto cmp=[](int x, int y){return d[x]>d[y];};//decreasing level/depth. no collisions should occur because these are on heavy chains
typedef std::set<int, decltype(cmp)> Set;
Set *hv[MN];
bool u[MN];
void dfs(int n=1)
{
s[n]=1;
for(auto x:a[n])
if(x.n!=p[n][0])
m[x.id]=x.n, p[x.n][0]=n, d[x.n]=d[n]+1, dfs(x.n), s[n]+=s[x.n];
}
void dfs2(int n=1)
{
for(auto x:a[n])
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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |