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

By | 2017-07-24T02:08:19+00:00 July 24th, 2017|Categories: C/C++, Programming|Tags: , , , , , , , |

#include <set> #include <vector> #include <cstdio> #include <cstring> #include <algorithm> using namespace std; const int N=200050; vector<int>vec[N],dis[N],sum[N]; 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[N],nxt[N],v[N],w[N],tot,root,xx,yy,vis[N]; int maxx[N][2],rec[N][2],f[N],Root[N],vv[N],fi,flag,size[N]; void add(int x,int y){w[tot]=1,v[tot]=y,nxt[tot]=first[x],first[x]=tot++;} int find(int x){return x==f[x]?x:f[x]=find(f[x]);} void get_dia(int x,int [...]