Пожалуйста, подпишитесь на официальный канал Codeforces в Telegram по ссылке https://t.me/codeforces_official. ×

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

Автор Tenz1n, история, 10 месяцев назад, По-английски

I was solving the problem : 1732D1 - Balance (Easy version). And my solution was same as i keep the track of the kth-MEX of the xth element when ever the request has been made. So for checking whether the kth element is present in the set or not, i used unordered_map<> by while adding the elements in the unordered_map<> when the add operation is processed. But i got TLE at test 36. Later when i checked other's solution they used ordered_map<> and used the .find() function to check whether the element is added to the set or not. And then i also used that .find() function and it got accepted.

Can anyone help tell me why by using mapping with unordered_map<> gives TLE and get Accepted while using .find() function?

Submission 1 : 223430749 Submission 2 : 223513656

Полный текст и комментарии »

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