Recently I was solving 1677B - Tokitsukaze and Meeting task and came up with a solution involving range sum update and point query. I implemented this simply using a Lazy Segment Tree for which I used this template from sharmaharisam.
However, my code gave a runtime error on test case 3 with GNU G++17 7.3.0 set as compiler but got AC with GNU G++20 11.2.0 set as compiler. I have no idea why this is happening but need help so that I can answer what is that which is not supported with the GNU G++17 that leads to the runtime error.
Here is the G++17 submission: 223460126 Here is the G++20 submission: 223458461
The two codes are exactly the same.
The same happened with this submission: 223460828. I am now extremely curious about what in this template is causing this because all I can see is some standard non fancy C++ functions :)
in
push_down
functionDefinitely incorrect expression in if. I'd say it must be
2*v + 2 < 4*n
. But it's up to you to check.Counter test (got with random generation):
This seems to fix it, Thanks. Any idea why it passes with G++20 though?
It's not about standard, it's about compiler version. I can assume different memory layout, nothing else can cross my mind.
Ah, I see. thanks!