# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
463933 | bonopo | Railway (BOI17_railway) | C++14 | 111 ms | 23824 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>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#define pb push_back
#define rc (i<<1)|1
#define lc (i<<1)
#define el "\n"
#define f first
#define s second
typedef long long ll;
const int MM=1e5+5, MOD=1e9+7, LOG=19;
int N, M, K, psa[MM], dep[MM], son[MM], top[MM], fa[MM], sz[MM], in[MM], ot[MM], cnt;
vector<pair<int,int>> adj[MM];
vector<int> vdj[MM], ans;
void df1(int u, int pa=0) {
dep[u]=dep[pa]+1; fa[u]=pa; sz[u]=1; in[u]=++cnt;
for(auto &e:adj[u]) if(e.f!=pa) {
int v=e.f;
df1(v, u); sz[u]+=sz[v];
if(sz[v]>sz[son[u]]) son[u]=v; }
ot[u]=++cnt;
}
void df2(int u, int pa=0) {
if(son[u]) {
top[son[u]]=top[u]; df2(son[u], u); }
for(auto &e:adj[u]) if(e.f!=pa&&e.f!=son[u]) {
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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |