Qualified's blog

By Qualified, history, 6 weeks ago, In English

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.

 
 
 
 
  • Vote: I like it
  • -13
  • Vote: I do not like it

»
6 weeks ago, # |
Rev. 4   Vote: I like it +3 Vote: I do not like it

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