[POI2013] POL-Polarization

题意翻译

给定一颗树,请给树边改成有向边,求连通的点对个数的最大最小值。点对连通,要么 $a$ 能到达 $b$,要么 $b$ 能到达 $a$。$(1\le n\le 250000)$。

题目描述

Everyone knew it would only be a matter of time. So what? Faced for years on, a peril becomes the every-day reality. It loses its meaning... Today the letter of the Bitotian char Bittard to the Byteotian king Byteasar was released to the public. Bitotia requested annexation of the whole Byteotia on pain of using the Bit Polarizing Magnet (BPM). If used, the BPM would make each and every road in Byteotia unidirectional. The enemy knows only too well that this could be a fatal blow to the minimalist Byteotian infrastructure - there is a unique way between each pair of towns. How badly can the BPM damage the Byteotian infrastructure? Determine the minimum and the maximum number of such pairs of towns that it will still be possible to travel from one of them to the other while observing the new roads orientation.

输入输出格式

输入格式


The first line of the standard input gives a single integer ![](http://main.edu.pl/images/OI20/pol-en-tex.1.png) (![](http://main.edu.pl/images/OI20/pol-en-tex.2.png)), the number of towns in Byteotia. The ![](http://main.edu.pl/images/OI20/pol-en-tex.3.png) lines that follow describe these roads. Each such line holds two integers, ![](http://main.edu.pl/images/OI20/pol-en-tex.4.png) and ![](http://main.edu.pl/images/OI20/pol-en-tex.5.png) (![](http://main.edu.pl/images/OI20/pol-en-tex.6.png)), which indicate that there is a direct road (still bidirectional at the moment) linking the towns no. ![](http://main.edu.pl/images/OI20/pol-en-tex.7.png) and ![](http://main.edu.pl/images/OI20/pol-en-tex.8.png). In tests worth 60% of the total points, the additional constraint ![](http://main.edu.pl/images/OI20/pol-en-tex.9.png) holds;moreover, in some of those, worth 30% of the total points, it even holds that ![](http://main.edu.pl/images/OI20/pol-en-tex.10.png).

输出格式


Two integers should be printed to the first and only line of the standard output. The first number should be the minimum and the second - the maximum number of pairs of towns which could remain connected (though in one direction only) after the roads are polarized.

输入输出样例

输入样例 #1

4
1 2
1 3
1 4

输出样例 #1

3 5