-
Notifications
You must be signed in to change notification settings - Fork 308
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Segment Tree size is too small #82
Comments
Specific testcase your code fails for is:
In this testcase your code queries the segment tree for |
We can probably update cc: @cheran-senthil |
Actually it seems I was a bit mistaken its seems that |
The issue is that if len (the variable self._len) is a power of 2, then query(len, len) or query(len, len, value) will fail. This is arguably not a bug, but it is a werid edge case. The reason why the functions Btw @bogoconic1, it is a lot easier to debug something if you post a runable python script that triggers the bug instead of linking to a codeforces submission. Please try to do so in the future =) |
Thanks, will do so next time |
Describe the bug
Copied LazySegmentTree.py template to solve this problem, but when submitting gave Runtime Error On Test 5
https://codeforces.com/contest/1549/submission/186542539
After debugging, realised that size of self._lazy and self._data is too small. Changed it from 2*_size to 4*_size and the code ACs
https://codeforces.com/contest/1549/submission/186543644
Expected behaviour
Should not throw an index out of bounds error
Additional context
Submitted a pull request for this issue #81
Thanks
The text was updated successfully, but these errors were encountered: