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

Автор PaleBlueDot, 4 месяца назад, По-английски

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

Полный текст и комментарии »

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