Пожалуйста, прочтите новое правило об ограничении использования AI-инструментов. ×

Блог пользователя GODOF_Shinobi

Автор GODOF_Shinobi, история, 7 лет назад, По-английски

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.

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

»
7 лет назад, # |
  Проголосовать: нравится +2 Проголосовать: не нравится

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

»
7 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

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

»
7 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

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