# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1013736 | huutuan | Dreaming (IOI13_dreaming) | C++14 | 28 ms | 14672 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 "dreaming.h"
#include <bits/stdc++.h>
using namespace std;
const int N=1e5+10;
vector<pair<int, int>> g[N];
int vis[N], n, m, l, dis[N], par[N];
int mx=-1;
void dfs(int u){
vis[u]=1;
if (mx==-1 || dis[mx]<dis[u]) mx=u;
for (auto &e:g[u]){
int v=e.first, w=e.second;
if (v==par[u]) continue;
par[v]=u; dis[v]=dis[u]+w;
dfs(v);
}
}
pair<int, int> find_diameter(int u){
mx=-1; dis[u]=0; par[u]=-1; dfs(u);
u=mx; mx=-1; dis[u]=0; par[u]=-1; dfs(u);
int v=mx;
pair<int, int> ans;
ans.first=dis[v];
ans.second=1e9;
while (v!=-1){
# | 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... |