In practice our C++ solutions get to be run with Undefined Behavior Sanitizer, also known as the diagnostics, which catch things like bad memory accesses from out of bounds array indices and integer overflows.↵
↵
I think we should be allowed to enable this during a submission during an actual contest. You'd have a checkbox at the bottom that says something like "enable diagnostic checks (warning: code may run much slower)" where you can choose to enable it or not.↵
↵
Is this unfair? I don't think so, UBSan is basically just a souped up template and you can achieve the same effect with one. You would be able to get the same effect by jamming `assert(result of addition did not overflow)` before every addition or having a template safe int / safe long class that does that for you or `__builtin_add_overflow`. Of course, you shouldn't be told the line number or what the problem was, just runtime error should be sufficient. (Since if you do it yourself the only information you get is that a runtime error happened somewhere.)↵
↵
Other languages also have some variant of this, like java has index out of bounds exception (though I don't believe they natively have overflow detection).↵
↵
It's also somewhat limited in strength, since for your first submission you will probably leave it off (or else you will definitely TLE), so you will end up needing to spend another -50 penalty if you want to check if the problem was an overflow/UB or not.↵
↵
Is this a good idea or is this just cope from failing round 1102 E↵
↵
PS: While we currently don't have that, I found that while practicing it's helpful to use an adblocker to stop myself from accidentally seeing the "diagnostics hint" icon since it's a big giveaway to what the problem is. In uBlock Origin Lite you can do "create a custom filter" -> click on the triangle icon.
↵
I think we should be allowed to enable this during a submission during an actual contest. You'd have a checkbox at the bottom that says something like "enable diagnostic checks (warning: code may run much slower)" where you can choose to enable it or not.↵
↵
Is this unfair? I don't think so, UBSan is basically just a souped up template and you can achieve the same effect with one. You would be able to get the same effect by jamming `assert(result of addition did not overflow)` before every addition or having a template safe int / safe long class that does that for you or `__builtin_add_overflow`. Of course, you shouldn't be told the line number or what the problem was, just runtime error should be sufficient. (Since if you do it yourself the only information you get is that a runtime error happened somewhere.)↵
↵
Other languages also have some variant of this, like java has index out of bounds exception (though I don't believe they natively have overflow detection).↵
↵
It's also somewhat limited in strength, since for your first submission you will probably leave it off (or else you will definitely TLE), so you will end up needing to spend another -50 penalty if you want to check if the problem was an overflow/UB or not.↵
↵
Is this a good idea or is this just cope from failing round 1102 E↵
↵
PS: While we currently don't have that, I found that while practicing it's helpful to use an adblocker to stop myself from accidentally seeing the "diagnostics hint" icon since it's a big giveaway to what the problem is. In uBlock Origin Lite you can do "create a custom filter" -> click on the triangle icon.



