Submission #1013736

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
10137362024-07-04 05:13:20huutuanDreaming (IOI13_dreaming)C++14
18 / 100
28 ms14672 KiB
#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){
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...