Sir code is showing segmentation fault . can you please check

i have done some modification

  1. use bool array instead of int as you are storing only 0 and 1
  2. use ll instead of int
  3. make global array

you can check now

code