#CCBCHBA0000122. Lưới số theo hàng zích zắc (Zigzag Number Grid)
Lưới số theo hàng zích zắc (Zigzag Number Grid)
Zigzag Number Grid
Source: Phước Hưng OJ
Version: Phuoc Hung OJ Extended
Problem Statement
Given rows and columns, use 1-based row numbers. Odd rows contain ; even rows contain . Print exactly rows and integers per row, separated by one space and without trailing spaces.
Input
One line contains integers , the row and column counts.
Output
Print exactly rows.
Subtasks
-
Subtask 1 (20%): .
-
Subtask 2 (30%): .
-
Subtask 3 (50%): .
Examples
Example 1
Input:
3 4
Output:
1 2 3 4
4 3 2 1
1 2 3 4
Explanation:
Odd rows increase; even rows decrease.
Example 2
Input:
1 1
Output:
1
Explanation:
Odd rows increase; even rows decrease.