题目链接:Codeforces 191C Fools and Roads
题目大意:给定一个N节点的数,然后有M次操作,每次从u移动到v,问说每条边被移动过的次数。
解题思路:树链剖分维护边,用一个数组标记即可,不需要用线段树。
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
const int maxn = 1e5 + 5;
int N, Q, ne, first[maxn], f[maxn], jump[maxn * 2];
int id, idx[maxn], top[maxn], far[maxn], son[maxn], dep[maxn], cnt[maxn];
struct Edge {
int u, v;
void set (int ......
阅读全文