最近网赛老出这样的题,不得不去学习学习呀。
参考:这篇博客
如果觉得看的不明白,可以先参考这个ppt
在看的迷迷糊糊,略懂之后稀里糊涂的A了道基础题
#include<iostream>
#include<cstdio>
#include<cstring>
#include<vector>
#define maxn 1<<29
using namespace std;
struct edge
{
int from,to,val;
};
struct node
{
int l,r,val;
}t[41111];
vector<edge>edges;
vector<int>g[11111];
int n,a,b,c,sz;
int f[11111],top[11111],w[11111],s[11111];
int dep[11111],so......
阅读全文