problem: (F) Expected diameter of a tree Solve In C/C++ Archive

Codeforces Round #411 (Div. 2), problem: (F) Expected diameter of a tree Solution In C/C++

Codeforces Round #411 (Div. 2), problem: (F) Expected diameter of a tree Solution In C/C++

#include <set> #include <vector> #include <cstdio> #include <cstring> #include <algorithm> using namespace std; const int N=200050; vector<int>vec,dis,sum; struct Node{int x,y;double ans;}JY; bool operator<(Node a,Node b){if(a.x!=b.x)return a.x<b.x;return a.y<b.y;} set<Node>s;set<Node>::iterator it; int n,m,q,first,nxt,v,w,tot,root,xx,yy,vis; int maxx,rec,f,Root,vv,fi,flag,size; void add(int …