ashish_nar's blog

By ashish_nar, history, 7 months ago, In English,

This code is working fine in eclipse but I am getting runtime error on test case 1 in codeforces.

Problem Link :

http://codeforces.com/contest/1051/problem/C

Program Link :

https://ideone.com/Qtv1Pm

 
 
 
 
  • Vote: I like it
  • 0
  • Vote: I do not like it

»
7 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Auto comment: topic has been updated by ashish_nar (previous revision, new revision, compare).

»
7 months ago, # |
  Vote: I like it +1 Vote: I do not like it

Why in the world are you modifying a set while looping through it?

  • »
    »
    7 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    see what my logic is, first I am keeping all the elements who is having odd count in set B and elements with even count in set A. after doing this I am moving those elements from set B to set A whose count is 1 until we will get same number of nice elements in both set A and set B.

    but modifying set can't be the reason of runtime error or is it so ?