Problem : https://codeforces.me/edu/course/2/lesson/4/4/practice/contest/274684/problem/B
My submissions:
- Using Vectors: https://ideone.com/eZXWMF
- Using Arrays : https://ideone.com/nSlABV
Can anyone help me in determining the root cause for the TLE verdict? The inspiration of using Arrays instead of Vectors came from : https://codeforces.me/edu/course/2/lesson/4/4/practice?#comment-661428
EDIT: Using a struct matrix instead of a 2D array gave AC. Code : https://ideone.com/w3Mnl7