Hi,
While solving problem H of the recent Codeforces Div3 round (link), I came across the following issue:
In my solution, I had to clear up the segment tree after every test case, so I kept track of all the elements I interacted with in an STL container. The issue is that if I use std::set for keeping track of changed elements in the segment tree, I have no issues, but if I use std::vector, I get a weird runtime error on test 4. Here are my two solutions:
- Accepted solution (using std::set variable called changed_elements in segtree structure) link
- Runtime error solution (using std::vector variable called changed_elements in segtree structure) link
Can anyone tell me what's causing this runtime error?