Problem type
Allowed languages
C#, C++, Clang, Clang++, Cobol, D, Groovy, Haskell, Java, JS, Kotlin, Lua, Node JS, ObjectiveC, OCaml, Output, PHP, Prolog, Pypy, Pypy 3, Ruby, Rust, Scala, Swift
Points: 100 Time limit: 1.0s Memory limit: 256M Input: stdin Output: stdout

Cho một bảng số nguyên kích thước nxn. Hãy sắp xếp lại bảng số theo hình ziczac.

Input gồm

  • Dòng 1: Số nguyên dương n (m, n ≤ 10^3)
  • n dòng tiếp theo, mỗi dòng có n số (|a[i][j]| <=10^3)

Output: Bảng số sau khi đã xếp theo hình ziczac

Ví dụ:

Sample Input

3

2 4 10

5 4 2

1 2 3

Sample Ouput

1 2 2

4 3 2

4 5 10


Comments

There are no comments at the moment.