Hi,
I have tried all inputs in this thread, and my solution returns corectly all of them. I have no ideea why do i get WA. Are there any trick cases?, What corner cases have you found?
Hello, I'm getting Time Limit Exceeded in this problem. My algorithm is naive. What I simply do is try to remove each vertex in each connected component of the graph and check how many nodes are reachable (by DFS) without the removed node. If this node is less than the nodes reachable with the removed vertex, then it is an articulation point.
I think it is possible to determine if a point is an articulation point with a single graph traversal using DFS. However, I can't figure out how yet.
Can you give me a clue on how can I pass the time limit?
Thanks!
Runtime errors in Pascal are reported as Wrong Answers by the online judge. Be careful.
andmej wrote:I think it is possible to determine if a point is an articulation point with a single graph traversal using DFS. However, I can't figure out how yet.
'Articulation points' and 'DFS' are good enough search terms for google ;)
Also check problem 22-2 in CLRS (link to this problem in 1st edition); it doesn't describe the algorithm, but gives enough hints for you to do it yourself.
After getting WA repeatedly despite having the same output as all the ones in this thread, I came up with the following input for which I finally got the wrong answer. So maybe it can help some of you. The answer should be "City map #1: 0 camera(s) found"...