TRUETWIN - Finding true twins
In every university there is a group of N students that like to run parties, and there are M friendships among the students. Friendship among the students is reciprocal: if A is friend with B then B is also friend with A. Hence the pairs A,B and B,A count as a single friendship. Every Saturday evening one of the students would invite all his/her friends to his home. At some universities it was observed that there are two students A, B which are always invited together or not invited at all at every party run by the other students. Such students are called twins. When the twins are friends they are called true twins and when they are not friends they are called false twins.
Input
The first line of the input contains an integer T – the amount of test cases. Then T test descriptions follow. The first line of each test consists of two integers N and M separated with a space. Then M lines follow, each containing two integers A and B separated with a space, describing friendships. No testcase will contain twice the same friendship A, B.
The limits are 1≤T≤10, 1≤N≤10000, 0≤M≤100050, 1≤A<B≤N.
Output
For each test case, output a line
Case #X: Y
where X is the test case number, starting from 1, and Y is either the string "No twins" without the quotes if there are no true twins, otherwise it is the string "A B" where A, B is the lexicographical smallest true twin pair.
Example
Input: 2
6 8
1 2
1 4
1 5
2 3
2 4
3 4
3 6
5 6
6 7
1 2
1 4
1 5
2 3
3 4
3 6
5 6 Output: Case #1: 2 4
Case #2: No twins
hide comments
Francky:
2016-11-15 15:59:53
Are all test cases enable ? If you have multiple test cases files, please check that they are enable to master judge (#0 #1 #2 #3 ...) in the sequence.
|
|
Christoph Dürr:
2016-11-15 14:52:36
Dear Karsten Ari Agathon, Blue.Marry and Francky,
|
|
Francky:
2016-11-15 14:47:14
I had contact with psetter by mail, and test cases have an issue, this will be soon corrected ; please be patient. |
|
[Rampage] Blue.Mary:
2016-11-15 11:35:11
Have you ever corrected the test cases?
|
|
Christoph Dürr:
2016-11-15 11:04:07
I raised the size of the instance for more fun. So have fun. |
|
Christoph Dürr:
2016-11-11 20:23:39
Franky, envoie moi ton code, je vais regarder.
|
|
Francky:
2016-11-11 15:46:11
I do believe in my Python solution (not in my C one), did I misunderstood the problem ? Are all IO files corrected ?
|
|
Christoph Dürr:
2016-11-11 12:40:38
to Blue.Marry: oh right, the limit on M is 10e5
|
|
hari123:
2016-11-10 20:15:44
How did u create this IO file http://www-desir.lip6.fr/~durrc/tmp/test.in Christoph Durr? |
|
hari123:
2016-11-10 20:09:46
Please, someone, explain me the example calculation, plz, ty. Last edit: 2016-11-10 20:11:34 |
Added by: | xtof |
Date: | 2016-10-12 |
Time limit: | 1s-20s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 GOSU |