Segmentation Fault on 4D Vector but not Array?

Правка en1, от SAT2020, 2022-12-29 10:32:43

Hello Codeforces!

After Tuesday's contest, I decided to learn a little bit more about Sparse Tables. While solving this problem on Codechef, I came across some code that has been heavily confusing me for the past few hours. Basically, when I initialize the sparse table "table" as an array, everything works great. But when I initialize it as a 4-D vector inside the function "build_table", the code gives segmentation fault on large test cases! I've attached both submissions below. Any help would be extremely appreciated!

Submission 1 (Array, AC)

Submission 2 (Vector, Seg Fault)

Thanks! -Simon

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский SAT2020 2022-12-29 10:32:43 815 Initial revision (published)