Matrix Zigzag - MarisaOJ: Marisa Online Judge

Matrix Zigzag

Time limit: 1000 ms
Memory limit: 256 MB
Given an n×m matrix, print the elements in diagonal zigzag order, starting from position (1,1) and ending at position (n,m). For example:
### Input - The first line contains two integers, n and m. - The next n lines each contain m integers representing the matrix. ### Output - Print n integers as the answer. ### Constraints - 1≤n,m≤50. - 1≤Ai≤100 ### Example Input: 33123456789 Output: 124753689