From what i understand i have basically done everything the same as the reference code, but i am getting a TLE while they are not, so can some1 please explain why?
Extremely sorry if the answer is rather simple or stupid and due to my ignorance, i am new to this
Thank you in advance
@ssjgz also can u explain why we usually get TLE using while loop but not while using for
loop i have done prob. on this only difference is loop (include.’\n’)
for iterating test case
possibly, but their answer takes less than 0.2s, when mine gets a TLE, moreover on the test case where i did get an answer mine was wrong.
either way i just tried using “/n” instead of endl and still a TLE
using
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
helps with the TLE, but my answer is still wrong somehow, i have used their function and mine and compared the arrays, which seem to be the exact same.
can you please also explain what exactly this bit of code does? sad to see that the code got rejected because of this
Current Solution : CodeChef: Practical coding for everyone
i see, when i had coded this during the contest i had used dpsize = 1e6+2 which is why this was a mistake, and i overlooked the = in my if condition, Thank you so much
is their a possibility that the fast input may make the code not work or should i always include it?
Also, if you really want to see naïve solution, you can check my approach too. Here it is: CodeChef: Practical coding for everyone. Do tell me if you don’t get it.