today in a problem of div 3 contest, the IDEs which i generally use are printing right(correct) answers but codeforces's IDE printing a different one(wrong answer). pls help code is quite clean,codeforces's custom invocation also printing the wrong answer how it is possible.. code:-> http://mirror.codeforces.com/contest/1006/submission/40444220 IDE's which i use generally:-> https://ide.codingblocks.com/#/ , https://www.codechef.com/ide
Auto comment: topic has been updated by arjun_9426 (previous revision, new revision, compare).
It is happens when your program have undefined behavior. For example, this cycle on 4 iterations — infinite cycle because integer overflow in body.
I changed all
[index]
on.at(index)
for check on out of range, so your program has runtime error:Try to find where you out of range
Yes it is..only mistake is I have taken array vis[n](instead of vis[n+1] since vectices are 1->N). here is link -> http://mirror.codeforces.com/contest/1006/submission/40453565
two online compilers didn't acknowledge that but codeforces's IDE did that also partially XD
I think it would be easy to figure out at that time if compiler has given me something like segmentaton fault which is quite obvious to expect but it did not. and bro we can't use ".at()" with maps it gives runtime error for insertion(i was inserting values in map in dfs function) ,but it can be used for updation..
btw thank you brother for your time..
Yes, I missed std::unordered_set, my fail