Unable to understand testcase

I can not understand the given testcase for the problem SJ1 given in APRIL Long contest. Some help would be really appreciated.
Question Link:


Draw a tree, that is shown in test case. It will have two leaf nodes with indeces 4 and 5.
If we follow from root to index 4 we get values:
All these values are divisible by mi=2 of node 4. So any combination of values will get us 0 after modular division by 2.
If we follow from root to index 5 we get values:
2, 3, 7
There are many combinations that will get us maximum possible sum after modular division by mi=10. For example: 2 * 1+3 * 0+7 * 1=9.
That’s why the output is
0 9

1 Like