FFL - April Lunchtime 2020

Hey guys.
This is my solution to the FFL problem in April Lunchtime - https://www.codechef.com/viewsolution/32260188

Can someone explain why my code took up so much memory? Also, give tips on how to reduce memory usage.

Look at other C++ solutions that is 15 MB is the average memory used by C++(generally) so do not worry about memory usage as mostly 1 GB of memory limit ( on an average is allowed in Competitive Programming) so memory would mostly not be an issue.

Okay thanks a lot!

Also what’s the difference between using the C++14 standard and C++17 standard for submitting code in Codechef?

1 Like

Codechef does not have the support for C++17 compiler ( it has only c++14) and the difference between both can be found in the documentation.
Here is a quora link to answer your query.
In practical (specifically competitive programming) usage you will not use most of the features that were added.

Thank you so much!

So using the C++14 standard on codechef and getting the memory usage of around 15MB is alright ? Without worrying about memory usage right?

As I told you 15 MB is somewhat the best memory usage.
You can use as much as nearly 1 - 2 GB ( varies platform to platform) and it would be of no issue.
Just keep in mind to first analyse the memory usage of your code because sometimes the constraints are too high and you should find some other way to solve the problem.

1 Like

Thank you again!

1 Like