1. The "constraints" states that the nodes are 1-indexed, which are wrong. The nodes are 0-indexed, as stated in the first paragraph.
2. Sorry there exists a mistake in sample testcase explanation, the first query explanation should be 0->4->3 instead of 0->1->3
Subtask | Score |
---|---|
1 | 22 |
2 | 24 |
3 | 14 |
4 | 40 |
5 | 0 |