CSUBQ help

I need your help guys,I am getting WA in last subtasks of CSUBQ.I’ve used two segment trees to count the array possibles starting with a number <=HIGH and with a number <LOW .
Solution link Solution

Size of Segment Tree is around ~2N but the index of segment tree node goes upto 4N.

Simply increasing the size of segment tree passes the test cases. Though i am not sure why you got WA instead of SIGSEGV.

2 Likes

Thanks bro,missed the 4N size thing :slight_smile:

No problem mate. BTW you can write code like update(1,l-1,r<=HIGH,0,n-1) instead of if-else, it’s much cleaner.

1 Like