Corrupted · Hard CodeFree
Closing Time
At closing time the wind-up animals escape and hide in the rooms. The guard walks from the entrance to the exit through one-way doors, as long as needed, catching every animal in each room entered. How many can be caught?
Find the most animals the guard can catch, or −1 if the exit cannot be reached.
The number must be exactly right.
N M S E: rooms, doors, the entrance room and the exit room.N. Next M lines: u v, a one-way door from u to v.S to E, or -1.N ≤ 40 000, 0 ≤ M ≤ 100 0008 10 1 8 1 2 3 9 2 4 5 1 1 2 2 3 3 1 2 4 3 5 5 6 6 5 3 7 6 8 7 8
13
Sign in to play. It is free.
Sign in