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

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

Hi,

I was writing a solution for Sereja and Brackets where I used a struct called DSU. However, the struct contained some unnecessary code and used generics, so I removed the struct and moved the relevant code outside. This somehow resulted in slower execution with over 50% more memory usage.

After playing around, I created these two submissions where the only difference as far as I could see was my usage of a struct. Submission 1 (struct, faster) and Submission 2 (no struct, slower).

I'm still pretty new to C++ and I come from a Java/Python background, so if someone could explain this behavior it would be very much appreciated.

Thanks!

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

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