시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
1 초 | 1024 MB | 2 | 0 | 0 | 0.000% |
Fishing is a card game that is played with a deck of cards consisting of 3N (1 ≤ N < 100) pairs of cards, numbered from 1 to 3N (the deck contains 6N cards overall).
Three friends (A, B and C) play Fishing. The rules are as follows:
You are given the hands of the three players at the end of step (1). It's known that at least one pair of same-value cards has to be discarded during each round described at point (3).
Compute the number of different ways the game can play out. Since this number can be quite large, output it modulo 1 000 000 007.
Two ways the game can play out are considered different if during one step the current player chooses to pass a different card.
The first line of input contains two integers N and T (1 ≤ T ≤ 10), where T is the number of game scenarios to analyse.
The description of T game scenarios follows. Each game scenario consists of three lines:
The first line contains 2N card values - player A's hand at the end of step (1).
The second line contains 2N card values - player B's hand at the end of step (1).
The third line contains 2N card values - player C's hand at the end of step (1).
For each game scenario, print the number of different ways the game can play out modulo 1 000 000 007 on a separate line.
번호 | 배점 | 제한 |
---|---|---|
1 | 10 | N = 2, T = 3 |
2 | 10 | N = 3, T = 5 |
3 | 10 | N = 10, T = 5 |
4 | 10 | N = 20, T = 5 |
5 | 10 | N = 50, T = 10 |
6 | 10 | N = 60, T = 10 |
7 | 10 | N = 70, T = 10 |
8 | 10 | N = 80, T = 10 |
9 | 10 | N = 90, T = 10 |
10 | 10 | N = 99, T = 10 |
1 1 1 2 3 3 2 1
2
First, during step (2), player B discards all their cards. At this point, the players' hands are:
There are two ways the game can play out from this point: