Problem E
Cycles (Hard)
Note that this is a harder version of the problem cycleseasy.
You are given a complete undirected graph with
You are asked to find the number of Hamiltonian cycles in
this graph that don’t use any of the given
Input
The first line of input gives the number of cases,
You may assume that
Output
For each test case, output one line containing "Case
#
Sample Input 1 | Sample Output 1 |
---|---|
2 4 1 1 2 8 4 1 2 2 3 4 5 5 6 |
Case #1: 1 Case #2: 660 |