GODOF_Shinobi's blog

By GODOF_Shinobi, history, 8 years ago, In English

This post is regarding yesterday's problem B.

Here are two solutions 27045354 and 27019672 although being similar , one of the two solutions passed and the other had a TLE on Case 39.

I know when we try to find and delete an element which is not present in set using set.erase(set.find(x)) ,then it gives an exception as find returns an iterator that points at the end of the set.

My doubt is does this happen even if I use set.erase(x), or was this ambiguous nature?

Any help would be appreciated.

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

»
8 years ago, # |
  Vote: I like it +2 Vote: I do not like it

because of this you are getting TLE long long int p[200005]={0},and in the second code you have not done this

»
8 years ago, # |
  Vote: I like it 0 Vote: I do not like it

The only difference between given two codes is that in one there was long long int p[200005]={0} but in another one it was long long int p[200005]

so I can only assume that the problem was there

»
8 years ago, # |
  Vote: I like it 0 Vote: I do not like it

You are not initializing y, so it should cause undefined behavior if the first person can't buy a t-shirt.