a GCJ WF week
This week, GCJ WF 2017 was held on Friday evening. Problem C is a little special among six problems. Here's the problem statement. Given \(K\), you need to construct a graph with no more than \(22\) vertexes and without self loops which contains \(K\) spanning trees.\((3\ \leq\ K\ \leq\ 10000)\). It's guaranteed that at least one graph exists under the conditions.
At the weekend, Baidu Star Contest went on. Problem statements were shit, and judging queue was too long. Hope this won't happen in the Elimination Round.
In my previous summary, I've mentioned HDU6057. Solving this problem requires lots of math skills. Let \(b[i]\ =\ B[(2^m-1)\ xor\ i]\) and \(c[i]\ =\ C[(2^m-1)\ xor\ i]\). \(c[r]\ =\ \sum_{p\ or\ q\ =\ r}\ \ \ A[p\ xor\ q]\ \times\ b[p\ and\ q]\). Notice that \((p\ xor\ q)\ +\ (p\ and\ q)\ =\ p\ or\ q\), so we can try to make the formula to be \(c[k]\ =\ \sum_{i\ +\ j\ =\ k}\ \ a[i]\ *\ b[j]\). After some calculation, we can get \(a[i]\ =\ A[i]\ \times\ bit\_count(i)\) and \(c[k]\ =\ \sum_{i,\ j}\ [i\ and\ j\ =\ 0][i\ or\ j\ =\ k]\ \times\ a[i]\ \times\ b[j]\). This then becomes a well-known problem which can be solved by inversion and dp.

浙公网安备 33010602011771号