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

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

My submitted solution: https://www.codechef.com/viewsolution/9929014 I referred to the problem setters solution while solving for fast exponentiation function . The first two test cases passed . The last one — wrong answer (expected TLE) . Where am i going wrong ??

updated my solution to this but still same error:: https://www.codechef.com/viewsolution/9930909

Changed FMOD function to normal % and got AC . Does anyone know why???

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

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

with regards to your matrix exponentiation function.

ans = (ans * a)%1000000007;
#define M 1000000007
ans = ((ans%M)*(a%M))%M;

using Modular Arithmetic.

you missed this !

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