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

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

I was solving 1955G - GCD on a grid, and I made 2 submissions. The first one 262439330 which gave TLE. The second one 262487569 ran in just 765ms.

The only change I made in these 2 submissions is that I declared a vector isposs globally instead of declaring it again in the function isPoss. Does memory allocation in C++ really have such a large overhead, or is there any other reason? I mean it takes more than 4x time to run, which is unexpected to me.

 Link of diff: https://www.diffchecker.com/vVXUaFzd/

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

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

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

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
  • Проголосовать: не нравится