Itachi_Uchiha13's blog

By Itachi_Uchiha13, history, 9 months ago, In English

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!

  • Vote: I like it
  • +5
  • Vote: I do not like it

»
9 months ago, # |
  Vote: I like it 0 Vote: I do not like it

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

»
9 months ago, # |
  Vote: I like it +3 Vote: I do not like it
»
9 months ago, # |
  Vote: I like it +3 Vote: I do not like it

You can apply fast IO for Go.

And pass numCount by reference:

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

  • »
    »
    9 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

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

    • »
      »
      »
      9 months ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Yes you are correct, then I think applying fast IO is good enough.