# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1052699 | _rain_ | Roadside Advertisements (NOI17_roadsideadverts) | C++14 | 49 ms | 13944 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;
using i64 = long long;
const int maxn = 1e5;
const int maxlog = 16;
vector<pair<int,int>> g[maxn+2];
int sta[maxn+2] , fin[maxn+2] , timedfs = 0 , n;
int par[maxn+2][maxlog+2] , h[maxn+2] , v[maxn+2] ;
i64 d[maxn+2];
void dfs(int u , int p)
{
sta[u] = ++timedfs;
h[u] = h[p]+1;
par[u][0] = p;
for (int i = 1; i <= maxlog; ++i)
par[u][i] = par[par[u][i - 1]][i - 1];
for (auto& v : g[u])
if(v.first != p)
{
d[v.first] = d[u] + v.second;
dfs(v.first , u);
}
fin[u] = timedfs;
return;
}
int LCA(int u , int v)
{
if (h[u] < h[v]) swap(u,v);
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... |