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

Revision en2, by biranchi, 2020-09-03 18:20:39

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.

I submitted code and result was TLE. And I observed that the time taken was above 3200 ms in cp editor. 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?

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en3 English biranchi 2020-09-03 18:21:03 2
en2 English biranchi 2020-09-03 18:20:39 52 (published)
en1 English biranchi 2020-09-03 18:18:30 1026 Initial revision (saved to drafts)