I have been trying to get AC for this problem - ‘Hardware Upgrade’ for quite some time now. I always get TLE. Since I am new to the site, I thought maybe the algorithm I am using is not fast enough. But after reading up the FAQ section and Variable Time Limits Based on Programming Language, I got to know that the time limit listed at the bottom of the page is for programming languages beginning with C and Java gets twice that time.
However, I fail to understand how the previous two submissions which got AC could take times in excess of 2s and 3s. Is something wrong with my understanding here or are the time limits set wrongly? I am okay with having the same time limit for C++ as for Java, since if I get TLE in that case I should probably start learning C++. Actually, what I am worried about here is that maybe the problem can’t be solved in under 2s (since the previous AC submissions take time in excess of that) and I am wasting my time.
Thanks in advance for your comments
P.S. - Any comments on my submission or algorithm or approach or code are also welcome and will be greatly appreciated.