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

Автор Qualified, история, 4 года назад, По-английски

Take a look at these two submissions

93514862, 93514890

The only difference between these two was that the data types for variables $$$n, k$$$, and vectors $$$a, hld1, hld2$$$. Instead of having them be long doubles, they were int. Now, look at the execution time! The difference is huge! The one with the ints has around 12 times better time than the one with long doubles! I knew that working with floats led to higher constant factors but didn't know that it would be that big.

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

»
4 года назад, # |
Rev. 4   Проголосовать: нравится +3 Проголосовать: не нравится

You're not just using floats btw

You're using long double which is four times bigger than int.

I also suspect that the difference is in particular related to the long double division