https://www.codechef.com/LRNDSA01/problems/MULTHREE

TLE getting a lot of these plz give some tips to void them in the programmes.
here 's my submission-
https://www.codechef.com/viewsolution/31448874

K is upto 10^{12}. So iterating from 0 to K-2 will take 10^{12} operations. A PC can perform at most \approx 10^8 operations in a second.

You need to look for some observations which allow you to optimise code or change the algorithm

2 Likes