PaleBlueDot's blog

By PaleBlueDot, 4 months ago, In English

I was trying the problem Coin Combinations II on the CSES platform, where I encountered a strange behaviour. Firstly my code got rejected with the TLE verdict, but as soon as I changed the way I declared the variable MOD (1e9 + 7), the code got accepted.

In the first code, I globally declared MOD as long long MOD = 1e9 + 7; which led to TLE. While in the second code, I globally defined MOD as #define MOD (long long)(1e9 + 7); which led to my code getting accepted. I just wanted to know the reason behind this difference in the runtime depending on the way I declare the variable MOD.

Code that gave TLE

Code that got AC

Full text and comments »

  • Vote: I like it
  • +1
  • Vote: I do not like it