# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
783058 | Charizard2021 | Roadside Advertisements (NOI17_roadsideadverts) | C++17 | 1072 ms | 15724 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;
const long long N = 50001;
long long dp[17][N];
vector<pair<long long, long long> > adj[N];
long long level[N];
long long timeIn[N];
long long timeOut[N];
long long dist[N];
long long timeVal = 0;
void dfs(long long u, long long p){
timeIn[u] = timeVal;
timeVal++;
for(pair<long long, long long> x : adj[u]){
long long v = x.first;
if(v != p){
dp[0][v] = u;
level[v] = level[u] + 1;
dist[v] = dist[u] + x.second;
dfs(v, u);
}
}
timeOut[u] = timeVal;
timeVal++;
}
long long solve(long long x, long long k){
long long val = 0;
while(k > 0){
if(k % 2 == 1){
x = dp[val][x];
# | 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... |