[Question Link](https://codeforces.net/contest/166/problem/E)↵
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: (https://codeforces.net/1e944c/Screenshot 2025-03-19 152843.png)↵
↵
Memory Limit Exceeded: (/predownloaded/02/3f/023fca55b2f4b8a7d50f5c1f407aeb54a33deded.png)
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: (https://codeforces.net/1e944c/Screenshot 2025-03-19 152843.png)↵
↵
Memory Limit Exceeded: (/predownloaded/02/3f/023fca55b2f4b8a7d50f5c1f407aeb54a33deded.png)