GHOSTS - Ghosts having fun
Ghost are living in big castle with K rooms.
As they have around few hundred years and very tired, they decided to buy teleports. Every teleport can work only in one way (to prevent collision). Ghosts have decided which teleports they want to build and in which order they should be built.
King of ghosts, Bob, asked you to check list of teleports and decide which of them do not build. He don't want ghosts having fun in infinite ride with teleports.
Input
In first line - number K <= 1000, number of rooms in castle.
In next line - number T <= 300000 number of teleports.
In next T lines a, b <= K
Rooms are numbered 1 to K
Output
Print teleports which should not be built. End test case with 0 0.
Example
Input: 4 5 2 4 4 3 3 2 1 2 3 1 Output: 3 2 3 1 0 0
hide comments
Pranjali Pratik:
2013-09-23 09:39:06
I have 2 questions.
|
|
Priyank:
2012-02-14 06:15:46
Can the answer to the test case be
|
|
fitcat:
2012-02-09 04:06:14
@Krzysztof Lewko
|
|
Krzysztof Lewko:
2012-01-30 00:44:32
@bashrc the answer should be
|
|
bashrc is back:
2012-01-26 04:42:14
any tricky test case plz.....
|
|
Problem Solver:
2011-09-13 14:52:40
Yes, you are right, but this is meant by default. If there's not specified if it's a->b or b->a we should assume it's a->b.
|
|
biQar:
2011-09-13 14:52:40
@Problem Solver - your comment is also confusing !! u say, "They are undirected edges and it's a->b" ... i think if the edges are really undirected, then they also should be b->a. What u think ? |
|
Problem Solver:
2011-09-13 14:52:40
Come on guys, please, it's like in other graph problems. They are undirected edges and it's a->b. If it's written "it can work only in one way" it's like in life, only in one way :)
|
|
Shiplu:
2011-09-13 14:52:40
@Kryzysztof Lewko: you read it carefully, where you have told these things :P, before set a problem, please make the problem statement clear to other, it is not important that is clear to you, it is important that it should be clear to us :P
|
|
biQar:
2011-09-13 14:52:40
"Every teleport can work only in one way ( to prevent collision )." -> what is the meaning of this line ? The graph is single-directional or bi-directional ? can anyone please give some more i/o ? |
Added by: | Krzysztof Lewko |
Date: | 2011-08-25 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 |