Hi all, I'm getting a runtime error while trying to submit my solution for 1588C - Game with Stones which I cannot replicate on the custom invocation tab or locally in vscode. Any help debugging this would be very appreciated.
My code submission: 135533102
UPDATE: I was able to edit the logic for modifying the map to get A/C but unable to see what the issue was. New submission- 135560689
What do you think is
container.rend().base()
?I think container.rend().base() == container.begin()
I copied this piece of code from here btw, it explains the relationship between reverse iterator and base() https://stackoverflow.com/questions/1830158/how-to-call-erase-with-a-reverse-iterator
If
it = endings.rend()
, thenit.base() = endings.begin()
— YesAnd you are erasing
endinds.begin()
. What happens?it
holding invalid invalid iterator andit != endgins.rend()
is incorrect expression (left invalid iterator, right valid iterator, expression is UB [not sure undefined or unspecified])So you need do
instead of
P.S. Sorry, of course increment is wrong, just erase increment of copy (135675180).
Thank you so much! This explains it :)
your submission link is for 1588C-game with stones, while you have tagged the question 1584C-Two Arrays as your question and i agree with you sometimes it is throwing RTE on custom invocation and sometime it is working fine.
Thanks! fixed. I was able to modify the solution to get A/C, but still unsure about the issue. 135560689
Auto comment: topic has been updated by insurgentes (previous revision, new revision, compare).