BARCEP bruteforce WA

Hey folks,

I know it’s forbidden to ask personal doubts in the forum.
But please help a noob out!

I wanted 20(partial) points for BARCEP problem - Bacterial Reproduction

I tried very much but 2nd test case of 1st subtask is failing, help me out here, please.

This is one of my first tree implementations…

My Solution

Well, I didn’t look at the code, but the second test case invloved a case where the root (vertex 1) only had one link.
In my code, I checked if the number of links were 1, and if it was, then i decided that it was a leaf node. I didn’t consider that the root can have only 1 link too.
But then i was able to get PA after rectifying that.
Maybe that’s where you are getting stuck up?

1 Like

In line 43, counter example for your code: consider a tree like this

1 2
2 3
2 4
According to your code node 1 is a leaf node which is not

1 Like

Thanks!

I was very noob when I wrote the code