Sắp xếp

PDF

Submit solution

Points: 10.00
Time limit: 1.0s
Memory limit: 64M
Input: stdin
Output: stdout

Problem types
Allowed languages
C++, Python, Scratch

Yêu cầu:

Sắp xếp bảng ~A~ theo các tiêu chí tăng dần theo đường xoắn ốc.

Dữ liệu:

  • Dòng đầu tiên chứa hai số ~m,n~.
  • ~m~ dòng tiếp theo mỗi dòng ghi ~n~ phần tử của ~A~.

    Kết quả:

Mảng A sau khi sắp xếp.

Giới hạn:

~n≤500.~

Input

3 5
9 8 7 6 5
1 2 3 4 0
5 7 9 1 2

Output

0 1 1 2 2
7 8 9 9 3
7 6 5 5 4

Comments

Please read the guidelines before commenting.


There are no comments at the moment.