Looking for failed assertions a legal strategy?

Say I submit during a contest and I get a wrong answer (‘x’). Suppose I’d like to check if my code enters an invalid state so I add an assert(). Then I submit again and if I get a runtime exception ‘!’ I know my assertion has failed.

Is this a legal strategy? The USACO.guide debugging hint section seems to imply it is, but something seems unfair to me about doing it this way.


I see nothing wrong with that.