I have spent all day trying to solve this problem.
unfortunately, I fail again and again.
I have no idea where causes the wrong answer.
I have tested my code by above cases and it runs fine including the empty village case.
Does someone have more test data to let me test my code?
Code: Select all
I have found the bug and got AC.
thanks for reading!