Does calling a function takes extra time?

Revision en2, by zero_bitches, 2022-08-15 05:15:43

Problem 1676D : X-Sum

I solved the problem using brute force as the constrains were low. In my first try I used another function to do some iterations in a 2D matrix.

Looking at the editorial, they used the same logic but without using another function. So, I copy pasted my entire 'helper' function in my 'main-solver' function and the time difference was pretty huge. Should we avoid using functions in CP?

Using extra function : 168328426 Time taken : 1185ms

Without using another function : 168328365 Time taken : 46ms

Is this something we should take care of in contests?

Tags functions, time limit

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English zero_bitches 2022-08-15 05:15:43 0 (published)
en1 English zero_bitches 2022-08-15 05:15:12 806 Initial revision (saved to drafts)