Does long long int affects time complexity in comparison to the use of int

Правка en1, от biranchi, 2020-09-03 18:18:30

Hello, I was recently coding a problem and my approach was correct. But I was using all variables in the form of long long int. I had used #define int long long.

In this problem, it was not necessary to use long long.

But I observed that the time taken was above 3200 ms. Then after scratching my head for 1 hour, I atlast went for other users' solutions. The only difference was they used int and approach was the same. I did the same. I deleted this line #define int long long. The time taken was now slightly above 2500 ms. I submitted the code and it was accepted.

Bonus questions : My second successful code was taking time above of 2500ms in my local machine(in cp editor). But the time constraint of that problem was 2 seconds. Why was the code accepted? The problem was from cses problem set. Are there any relatively similar incidents that occurred to you? I would be happy to know some, especially in codeforces platform?

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en3 Английский biranchi 2020-09-03 18:21:03 2
en2 Английский biranchi 2020-09-03 18:20:39 52 (published)
en1 Английский biranchi 2020-09-03 18:18:30 1026 Initial revision (saved to drafts)