Importance of usage of const

Revision en1, by aastik231205, 2024-07-26 03:37:55

Hello guys, I just realised how much of a difference putting const in a global variable can make. I was doing CSES problem Coin combinations II. I was getting tle on the problem for quite a while. Just for trying i changed the global mod value's datatype from long long to const long long. My code which was giving tle on 1s got executed in 0.2s due to that 1 change.

Here's my Old submission and here's the New one.

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English aastik231205 2024-07-26 06:49:28 40
en1 English aastik231205 2024-07-26 03:37:55 704 Initial revision (published)