Matrix Zigzag - MarisaOJ: Marisa Online Judge
Given an $n \times 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 \le n, m \le 50$.
- $1 \le A_i \le 100$
### Example
Input:
```
3 3
1 2 3
4 5 6
7 8 9
```
Output:
```
1 2 4 7 5 3 6 8 9
```
Topic
Basic
Rating
800
Solution (0)
Solution