Submission: 215289964
Problem: 1487E - Cheap Dinner
Here is my logic and "analysis" of the Time Complexity of this solution. Please do let me know where I am going wrong!
Logic and attempt at runtime analysis
I am not sure how to proceed on speeding this up. ( or if I should give up and look at the editorial :) )