Why it is wrong answer? because my program is correct

problem - Contest Page | CodeChef
solution - Solution: 50158110 | CodeChef

Surprised you’re still using this title after last time, but …

Out-of-bounds access on sample test input:

[simon@simon-laptop][18:08:41]
[~/devel/hackerrank/otherpeoples]>./compile-latest-cpp.sh 
Compiling shreyash_49-VCS.cpp
+ g++ -std=c++14 shreyash_49-VCS.cpp -O3 -g3 -Wall -Wextra -Wconversion -DONLINE_JUDGE -D_GLIBCXX_DEBUG -fsanitize=undefined -ftrapv -fno-sanitize-recover
+ set +x
Successful
[simon@simon-laptop][18:08:46]
[~/devel/hackerrank/otherpeoples]>echo "2                                                       
7 4 6
1 4 6 7
1 2 3 4 6 7
4 2 2
1 4
3 4" | ./a.out
shreyash_49-VCS.cpp:28:20: runtime error: index 4 out of bounds for type 'int [*]'
2 Likes

please tell the meaning.
what i have to correct?
i still don’t understand.