reference runtime error on test 1 (sample): exit status 2
input:
4
1
1
1
1
5
3 4 1 2
1 1 1 1 1
5
4 2 3 1 5
2 1 4 1 5
40
29 15 20 35 37 31 27 1 32 36 38 25 22 8 16 7 3 28 11 12 23 4 14 9 39 13 10 30 6 2 24 17 19 5 34 18 33 26 40 21
3 1 2 2 1 2 3 1 1 1 1 2 1 3 1 1 3 1 1 1 2 2 1 3 3 3 2 3 2 2 2 2 1 3 2 1 1 2 2 2
output:
1
panic: runtime error: index out of range [5] with length 2
goroutine 1 [running]:
main.solveCase(0x1, {0x4000098050?, 0x40000a0f10?, 0x1?}, {0x4000098058, 0x1, 0x400003a668?})
/home/ubuntu/codeforces/2000-2999/2000-2099/2060-2069/2064/2064E.go:140 +0x2e0
main.main()
/home/ubuntu/codeforces/2000-2999/2000-2099/2060-2069/2064/2064E.go:183 +0x1d0
exit status 1