Change the Row to Column and Column to Row and it will be Accepted, But Why ?

Revision en3, by ilove_sundarKanya, 2025-03-19 13:09:55

Question Link In this problem, I initially implemented a DP solution by defining the state and transition. However, it resulted in a "Memory Limit Exceeded" error. Surprisingly, when I simply interchanged the row and column while keeping the logic, states, and transitions the same, the solution was accepted.

Can someone explain why this happened?

Accepted Submission: [submission:https://codeforces.me/contest/166/submission/311383136] Memory Limit Exceeded: [submission:https://codeforces.me/contest/166/submission/311381200]

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en4 English ilove_sundarKanya 2025-03-19 13:11:36 47
en3 English ilove_sundarKanya 2025-03-19 13:09:55 194
en2 English ilove_sundarKanya 2025-03-19 13:07:53 176
en1 English ilove_sundarKanya 2025-03-19 13:05:37 479 Initial revision (published)