Блог пользователя Nakagawa.Kanon

Автор Nakagawa.Kanon, история, 5 лет назад, По-английски

Lately I've been submitted codes to Building Skyscrapers. You don't have to understand my code but to better explanation, my first idea is to use unordered set and map to reduce first half of the solutions to $$$O(N)$$$ but it got TLE : 57946506. I've managed to submit again and get 100pt just by get rid of the ordered set (still use the unordered map) and running time reduce from > 3500ms to 2589 ms : 57994251. Finally, I get rid of both of them and just sort the whole vector and use the two pointer in $$$O(NlgN)$$$, the time reduced to 655 ms : 58085217.

I believed there is something wrong with the default hash function. Can anyone improve it ?

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

»
5 лет назад, # |
Rev. 2   Проголосовать: нравится -26 Проголосовать: не нравится

[Sorry, wrong comment]