Possibly wrong internal solution

For the test:
4 1 3 0
1 2
2 4
3 4
1
1
The output is “Yes”.
It has one graph where the only path from 1 to 4 has length of 2, and the other graph where the only path length is 0. So the answer should be “No”. But the code assumes that any vertex that has no incoming edges can be a start vertex, and says we have a path from 3 to 4, which violates the problem statement. I also can’t see a constraint on edges that make 1 the only possible vertex with no incoming edges.

1 Like

I think you’re right! The test data for this problem must be very weak.

Opened an issue: Contact Form Submission - Mistake (Solution: Kattis - Quantum Superposition) · Issue #6233 · cpinitiative/usaco-guide · GitHub

1 Like