Why my code (for MXMTRIO) is showing RE (SIGSEGV) error? can anyone help?

Solution: 55490268 | CodeChef

int *arr = new int(n);

does not create an array of ints of size n: it creates a single int on the heap, with value n.

You want:

int *arr = new int[n];
1 Like