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

Submitting .cpp to 'oranges2'

You're not logged in! Click here to login

Time Limit: 1 Seconds
Memory Limit: 256MB
Your best score: 0
Source: RI Deccourse 2018 Selection Test (0rang3)

Subtask Score
1 22
2 24
3 14
4 40
5 0