72C H and small cow-off games (dynamic point divide and conquer)

Effect: a given tree, each point of initial weights 0, asking each given $ x $, $ x $ weights +1, seek distance not exceeding $ X $ 2 and the weight.

 

This problem data is too large, dynamic point divide and conquer card is not in the past.

Consider adding a time range of $ 1 $.

 

	while (m--) {
		int x;
		scanf("%d", &x);
		++c[0][x],++c[1][x],++c[1][fa[x]];
		printf("%d\n",c[0][fa[x]]+c[1][x]);
	}

 

Guess you like

Origin www.cnblogs.com/uid001/p/10992840.html