Index out of bounds error with sample input:
[simon@simon-laptop][19:14:00]
[~/devel/hackerrank/otherpeoples]>./compile-latest-cpp.sh
Compiling prince_000-KMAX2.cpp
+ g++ -std=c++14 prince_000-KMAX2.cpp -O3 -g3 -Wall -Wextra -Wconversion -DONLINE_JUDGE -D_GLIBCXX_DEBUG -fsanitize=undefined -ftrapv -fno-sanitize-recover
+ set +x
Successful
[simon@simon-laptop][19:14:05]
[~/devel/hackerrank/otherpeoples]>echo "1
5 3
1 2 3 4 5
" | ./a.out
/usr/include/c++/7/debug/vector:417:
Error: attempt to subscript container with out-of-bounds index 5, but
container only holds 5 elements.
Objects involved in the operation:
sequence "this" @ 0x0x7ffe1adcc8c0 {
type = std::__debug::vector<int, std::allocator<int> >;
}
Aborted (core dumped)
1 Like
Thank you very much sir , for your help