Prelude 很好的模板题. 传送到Codeforces:(* ̄3 ̄)╭ Solution 首先要会DSU on Tree,不会的看这里:(❤ ω ❤). 众所周知DSU on Tree是可以用来处理子树信息的,但是有时候也可以用来处理链上信息. IOI 2011 Race是一道著名的点分治模板题,要求统计链信息,也可以用DSU on Tree来做,题目链接在这里:(✿◕‿◕✿). 基本思路和点分治是一样的,对于每个点u,我们统计出所有经过u的路径的信息. 于是我们有了一个非常好的思路:统计每…
D. Arpa's weak amphitheater and Mehrdad's valuable Hoses Problem Description: Mehrdad wants to invite some Hoses to the palace for a dancing party. Each Hos has some weight wi and some beauty bi. Also each Hos may have some friends. Hoses are divided…
codeforces 741D Arpa's letter-marked tree and Mehrdad's Dokhtar-kosh paths 题意 给出一棵树,每条边上有一个字符,字符集大小只有22. 对于每一个子树,询问其中最长的,满足:路径上的字符集可以重组成字符串的路径的长度. 题解 明显是用mask维护信息,然后启发式合并一下. 一般启发式合并需要用map维护信息,这样的复杂度是log^2的.如果保留每个点重儿子的信息,就可以用全局变量维护,全局变量的大小就可以开很大,可以做到l…
题目链接:http://codeforces.com/contest/742/problem/C C. Arpa's loud Owf and Mehrdad's evil plan time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output As you have noticed, there are lovely girls in Ar…
题目链接:http://codeforces.com/contest/742/problem/D D. Arpa's weak amphitheater and Mehrdad's valuable Hoses time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Just to remind, girls in Arpa's lan…
题目链接:http://codeforces.com/contest/742/problem/B B. Arpa's obvious problem and Mehrdad's terrible solution time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output There are some beautiful girls in…
Arpa's loud Owf and Mehrdad's evil plan time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output As you have noticed, there are lovely girls in Arpa's land. People in Arpa's land are numbered from 1…
Arpa's weak amphitheater and Mehrdad's valuable Hoses time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Just to remind, girls in Arpa's land are really nice. Mehrdad wants to invite some Hose…
Arpa's loud Owf and Mehrdad's evil plan time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output As you have noticed, there are lovely girls in Arpa’s land. People in Arpa's land are numbered from 1…
C. Arpa's loud Owf and Mehrdad's evil plan time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output As you have noticed, there are lovely girls in Arpa’s land. People in Arpa's land are numbered fro…