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

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

http://codeforces.com/contest/242/submission/39896396 why my soltion gives TLE while other solution with same approach got accepted Can anyone help me out .Please Don't Downvote i already got -23 Contributions.

UpD:with use of treemap it got accepted but with AbstractMap.SimpleEntry it get tle is it bcz of bad hash function implemented in AbstrtactMap.SimpleEntry ?

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

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

You just answered your own question, HashMap use a hash function which is O(n), however TreeSet is guaranteed to be O(log(n)).