Need help for my exercise

Write your question here.\
So i have experimented a bit with this exercise but im still not sure how to program it. If possible or if someone knows any algorithm for this exercise could you name it ?
Exercise:
As you know, on the ASM Olympiads teams wear t-shirts of different colors. All team members wear the same T-shirt. Each team chooses several different favorite colors from the set proposed by the organizers of the Olympiad. Each color offered by the organizers has a unique number from 1 to 100.

In many ways, the organizers of the Olympiad can assign each team a color from its set of favorite colors so that all teams have different colors of t-shirts. Two ways are considered different, if at least one team has a different color for T-shirts.

Input format
The first line of input contains the number of test cases T (1 ≤ T ≤ 10). Each test case contains the number N (1 ≤ N ≤ 10) in the first line - the total number of instructions. Each of the following N lines contains from 1 to 100 different numbers, separated by spaces, the color numbers of the T-shirts that the i-th team prefers.

Result Format
For each test case output a single number - the number of possible cases modulo 1000000007 = 109 + 7.\
Input :
2
2
3 5
8 100
3
5 100 1
2
5 100
Output:
4
4

 
  
Last edited on
I can't make any sense of your question. What exactly are you trying to compute here? Probability of a team picking some combination? Number of possible colors? Something else??
We want to find how many ways exist for each team to have different colors and the colors that they picked .
For example in test case 1 :
We have 2 teams. The 1st one wants the t-shirts with the number (or color) 3 and 5
and 2nd team wants the t-shirt with the number 8 and 100 .

Then we look if the 1st team picks number 3 and the second team picks the number 8 and they are different (since 3 != 8) then our result has found one way (result++)

Later we do the same if the 1st team picks number 3 and 2nd team number 100 and 3 != 100 then result++

Then pick for the 1st team the number 5 and so on.....
In the end the result ( which is the number of ways for each team to have different colors and the colors of their own preference ) is equal to 4
Last edited on
But the thing is that there can be 10 teams with 99 different colors and the issue gets bigger and complicated so i want to know if there is any algorithm for this exercise
Registered users can post here. Sign in or register to post.