#P1999. xay loves connected graphs

xay loves connected graphs

题目描述

Click here to read PDF of this problem

输入格式

As shown in the PDF.

输出格式

As shown in the PDF

样例

3 
1 1 
1
9

提示

There are 4 nice subsets: (1,2)(1,3) (1,2)(2,3) (1,3)(2,3) (1,2)(1,3)(2,3) Their values are 2,2,2,3 respectively. 录题人:chimp