# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
499721 | mosiashvililuka | Paths (RMI21_paths) | C++14 | 1092 ms | 12360 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;
long long a,b,c,d,e,i,j,ii,jj,zx,xc,K,f[100009],g[100009],DP[100009],dep[100009],msh[100009],msh2[100009],pas;
vector <pair <long long, long long> > v[100009];
void dfsst(long long q, long long w){
msh[q]=w;
for(vector <pair <long long, long long> >::iterator it=v[q].begin(); it!=v[q].end(); it++){
if((*it).first==w) continue;
dep[(*it).first]=dep[q]+(*it).second;
msh2[(*it).first]=(*it).second;
dfsst((*it).first,q);
}
}
void dfs(long long q, long long w){
DP[q]=q;
for(vector <pair <long long, long long> >::iterator it=v[q].begin(); it!=v[q].end(); it++){
if((*it).first==w) continue;
dfs((*it).first,q);
g[(*it).first]=DP[(*it).first];
if(dep[DP[q]]<dep[DP[(*it).first]]) DP[q]=DP[(*it).first];
}
}
int main(){
/*freopen("paths.in","r",stdin);
freopen("paths.out","w",stdout);*/
ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
cin>>a>>K;
for(i=1; i<a; i++){
cin>>c>>d>>e;
v[c].push_back(make_pair(d,e));
# | 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... |