is defining an std::function slower than the normal definition of a function ?

Revision en1, by i3mr125, 2023-10-23 15:48:06

so I was solving a standard dp problem but it got TLE using this form of the calc function

code

and it passed by defining the same function exactly outside the solve function like this.

code

So I really don't understand the issue here

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English i3mr125 2023-10-23 15:48:55 46
en1 English i3mr125 2023-10-23 15:48:06 1413 Initial revision (published)