Hi, CodeForces!↵
↵
I was solving problem 580C — Kefa and Park where I came up with this code: [submission:300260289]. However, it fails on test case 8. If I give it the input:↵
↵
2 1↵
↵
1 1↵
↵
1 2↵
↵
It outputs 0 but when I provide it "2 1" on the last input it would output 1. Why is that happening?↵
↵
Any help will be deeply appreciated.↵
↵
**EDIT 1**: I solved the problem, the error was I was reading the graph (tree) as directed and I hard coded '0' as the root so whenever '0' is not root it bugs!.
↵
I was solving problem 580C — Kefa and Park where I came up with this code: [submission:300260289]. However, it fails on test case 8. If I give it the input:↵
↵
2 1↵
↵
1 1↵
↵
1 2↵
↵
It outputs 0 but when I provide it "2 1" on the last input it would output 1. Why is that happening?↵
↵
Any help will be deeply appreciated.↵
↵
**EDIT 1**: I solved the problem, the error was I was reading the graph (tree) as directed and I hard coded '0' as the root so whenever '0' is not root it bugs!.