![]() |
||||||||||
|
||||||||||
Problem FTime Limit: 20000/10000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 4 Accepted Submission(s): 1 Problem Description A social network is a social structure made up of a set of social actors (such as individuals or organizations) and a set of the relationships between these actors. In simple cases, we may represent people as nodes in a graph, and if two people are friends, then an edge will occur between two nodes. ![]() Figure 1: C knows every one, while D only knows C in this social network. There are many interesting properties in a social network. Recently, we are researching on the Social Butterfly in the network. A Social Butterfly should satisfy the following conditions: 1. She is a female; 2. She knows at least $K$ male friends. Now we have already taken out several networks from database, but since the data only contain nodes and edges, we don't know whether a node represents a male or a female. We are interested, that if there are equal probabilities for a node to be male and female (each with 1/2 probability), what will be the xpectation of number of social butterflies in the network? Input The number of test cases T (T <= 10^4) will occur in the first line of input. For each test case: The first line contains the number of nodes $N (1 \leq N \leq 30)$ and the parameter $K (0 \leq K \lt N)$. Then an $N \times N$ matrix $G$ followed, where $G_{ij} = 1$ denotes $j$ is a friend of $i$, otherwise $G_{ij} = 0$. Here, it's always satisfied that $G_{ii} = 0$ and $G_{ij} = G_{ji}$ for all $1 \leq i, j \leq N$. Output For each test case, output the expectation of number of social butterflies in 3 decimals. Sample Input
Sample Output
Source | ||||||||||
|