I used const in global and ans got accepted why?

without const-CodeChef: Practical coding for everyone

with const–CodeChef: Practical coding for everyone
anyone plz explain me this?

1 Like

@ssjgz or @everule1 can you explain this plz ?

I don’t think you understand how much const speeds up execution time. The compiler does some more optimisations if it knows the value won’t be changed.
This is one of my previous submissions
With const declared everywhere possible, like you normally should
Now I removed const, and I get this
Without const

5 Likes

ok got that.It means const makes execution fast.
Thanks.
:smiley:

Google should always be your first priority.
WE ARE NOT HERE TO SEARCH INFORMATION FOR YOU.
In any case, here it is : What kind of optimization does const offer in C/C++? - Stack Overflow

2 Likes