I’m getting WA in task# 3 and 4. Any help would be highly appreciated.
Link to code: Solution: 15021403 | CodeChef
These are the test cases I used for testing and seem to get the right output everytime.
8
5 2
1 4 5 2 3
3 1
1 4 1
4 2
3 4 3 5
5 3
1 2 2 3 2
4 3
3 2 2 1
5 1
2 2 2 2 2
5 1
1 2 3 7 2
5 1
1 1 1 1 6