Z - New Year Tree CodeForces - 620E 这个题目还没有写,先想想思路,我觉得这个题目应该可以用bitset, 首先这个肯定是用dfs序把这个树转化成线段树,也就是二叉树. 然后就是一个区间修改和区间查询.这个区间查询时查询这个区间的种类数. 这个之前写过几个题目也是查区间种类数的 G. Yash And Trees 线段树 bitset 20190709 暑训 区间种类数 莫队的学习 莫队和权值线段树应该都是不支持修改的,所以这个题目用不上, 然后就是这个高端压位…
C. Propagating tree time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Iahub likes trees very much. Recently he discovered an interesting tree named propagating tree. The tree consists of n n…
Gardener Alexey teaches competitive programming to high school students. To congratulate Alexey on the Teacher’s Day, the students have gifted him a collection of wooden sticks, where every stick has an integer length. Now Alexey wants to grow a tree…
题面 Vasya has a tree consisting of n vertices with root in vertex 1. At first all vertices has 0 written on it. Let d(i,j) be the distance between vertices i and j, i.e. number of edges in the shortest path from i to j. Also, let's denote k-subtree of…
A - Lake Counting POJ - 2386 最最最最最基础的dfs 挂这道题为了提高AC率(糖水不等式 B - Paint it really, really dark gray CodeForces - 717E dfs 待会写题解 C - New Year Transportation CodeForces - 500A 简单的模拟 D - Binary Tree Traversals HDU - 1710 给树的先序中序输出后序 贴下代码 #include <algorith…
Darth Vader and Tree CodeForces - 514E When Darth Vader gets bored, he sits down on the sofa, closes his eyes and thinks of an infinite rooted tree where each node has exactly n sons, at that for each node, the distance between it an its i-th left ch…
On Changing Tree CodeForces - 396C You are given a rooted tree consisting of n vertices numbered from 1 to n. The root of the tree is a vertex number 1. Initially all vertices contain number 0. Then come q queries, each query has one of the two types…
E. Anton and Tree time limit per test: 3 seconds memory limit per test :256 megabytes input:standard input output: standard output Anton is growing a tree in his garden. In case you forgot, the tree is a connected acyclic undirected graph. There are …
题目链接:http://codeforces.com/contest/620/problem/E E. New Year Tree time limit per test 3 seconds memory limit per test 256 megabytes input standard input output standard output The New Year holidays are over, but Resha doesn't want to throw away the N…
B. Alyona and a tree 题目连接: http://codeforces.com/contest/739/problem/B Description Alyona has a tree with n vertices. The root of the tree is the vertex 1. In each vertex Alyona wrote an positive integer, in the vertex i she wrote ai. Moreover, the g…