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

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

In this problem 1857/F, I used a binary search to solve this. I wrote the code in Go, but it is giving TLE. I'm not very experienced with Go, so I'd really appreciate it if someone could explain why this is happening.

Link to submission: 222520517

Thanks for the help in advance!

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

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

Auto comment: topic has been updated by Itachi_Uchiha13 (previous revision, new revision, compare).

»
10 месяцев назад, # |
  Проголосовать: нравится +3 Проголосовать: не нравится
»
10 месяцев назад, # |
  Проголосовать: нравится +3 Проголосовать: не нравится

You can apply fast IO for Go.

And pass numCount by reference:

func getValue(x, y int64, numCount *map[int64]int64) int64

  • »
    »
    10 месяцев назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    Thanks! I was curious though, I read that maps are reference types, so they are not copied anyways. Could you please confirm that?