Time Complexity Calculation

Revision en2, by I_lOVE_ROMAN, 2023-10-30 15:29:00

For this Problem

1829E - The Lakes

The solution is written in O(n*m)

But How it is possible if there is recursion calls inside the nested solution.

Solution in tutorial is:

https://mirror.codeforces.com/blog/entry/116108 (Problem E)

Please someone help me understand the time complexity?Shouldn't it be O(n*m*n*m).I know we are not checking same grid twice.

Please someone help me.

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English I_lOVE_ROMAN 2023-10-30 15:29:00 2 Tiny change: 'oblem:1829A]\n\n\nThe' -> 'oblem:1829E]\n\n\nThe'
en1 English I_lOVE_ROMAN 2023-10-29 12:50:26 432 Initial revision (published)