Here’s a problem from the famous Atcoder Educational DP Contest: Flowers
AC Solution: Link
RE Solution: Link
I made 2 submissions of this problem one being AC and other giving Runtime Error. The only difference between them was that in the AC Solution, the array for segment tree was declared as global vector and i resized the vector in the local function and in the RE Solution I declared the global vector as an array of size 4*N + 5.
Why is one getting accepted and the other isn’t ?? Any kind of help is appreciated.