### arjun_9426's blog

By arjun_9426, history, 15 months ago, ,

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://codeforces.com/contest/1006/submission/40444220 IDE's which i use generally:-> https://ide.codingblocks.com/#/ , https://www.codechef.com/ide

• +2

 » 15 months ago, # |   0 Auto comment: topic has been updated by arjun_9426 (previous revision, new revision, compare).
 » 15 months ago, # |   +2 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: terminate called after throwing an instance of 'std::out_of_range' what(): _Map_base::at Try to find where you out of range
•  » » 15 months ago, # ^ |   0 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://codeforces.com/contest/1006/submission/40453565two 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..
•  » » » 15 months ago, # ^ |   0 Yes, I missed std::unordered_set, my fail