Блог пользователя dkyu021

Автор dkyu021, история, 5 лет назад, По-английски

Hello everyone, I hope you all are doing well and are healthy & fit.

I just wanted to ask why am I getting TLE with this submission My Submission, whereas all other codes with same logic and I guess same code structure is accepted, For example

Question Link

I don't know what am I missing in my submission?

Your help is very much appreciated and Thank you in advance.

Update:

  • Yes changing i<=sqrt(n) to i*i<=n is worth changing. But after that also I was getting a TLE!
  • After changing Long Long to int gave me AC.

I get the reason why changing sqrt(n) can decrease time, but what's with changing Long Long to int, how is it contributing to reduce time??

  • Проголосовать: нравится
  • +1
  • Проголосовать: не нравится

»
5 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Use int instead of long long. It worked for me.

»
5 лет назад, скрыть # |
← Rev. 2  
Проголосовать: нравится 0 Проголосовать: не нравится

Your code worked when i<=sqrt(n) was replaced by i*i<=n.