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

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

For problem 1114F - Please, another Queries on Array?:

Does someone has an idea why this submission 49746866 gets WA test 3 (with 17M memory) while this one 49746950 gets MLE in the same test (with 256M Memory) where the only difference in the power function (Iterative vs Recursive)?

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

»
6 лет назад, # |
Rev. 2   Проголосовать: нравится +14 Проголосовать: не нравится

In iterative code, you defined p as unsigned int, but in recursive one it is int, so, if we suppose that temp can be negative (because of a wrong in range query, for example), there will be no issues in iterative code, but there will be infinite calls in recursive code (because p < 0).