#include <iostream> #include <stdio.h> #include <string.h> #include <algorithm> #define N 40005 #define M 80005 #define LL long long using namespace std; const int INF = 0x3f3f3f3f; int ver[M],edge[M],head[N],Next[M]; int n,m,tot,r…
Tree Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 24253 Accepted: 8060 Description Give a tree with n vertices,each edge has a length(positive integer less than 1001). Define dist(u,v)=The min distance between node u and v. Give an…
题面 luogu cdq分治入门 注意删的是值不是位置! #include <cstdio> #include <algorithm> #include <cmath> #include <cstring> using namespace std; const int N = 1e5 + 5; const int inf = 0x3f3f3f3f; struct Node{ int x, y, z; long long cnt; }node[N]; inli…