Quantcast
Channel: CodeChef Discuss - latest questions
Viewing all articles
Browse latest Browse all 40121

Number of subsets

$
0
0

How to find number of subsets of a set containing N integers 1... N .while any of subset can not contain some of pair of integers.
T : number of test cases
N : input for each test case
E : number of pair for each test case
Then next E lines will be there denoting pairs
Sample input
2
3
2
1 2
2 3
5
4
1 2
3 4
2 3
41

Sample output
5
14

In the first test case, the valid coalitions are {1}, {2}, {3}, {1,3}, {} and hence the answer is 5.
In the second test case, the 14 valid ones are {},{1},{2},{3},{4},{5},{1,3},{1,5},{2,4}, {2,5},{3,5},{4,5},{1,3,5},{2,4,5}


Viewing all articles
Browse latest Browse all 40121

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>