#E. 打印锯齿矩阵

    Type: Default 1000ms 256MiB

打印锯齿矩阵

You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.

题目描述

锯齿矩阵是指每一行包含的元素个数不相同的矩阵,比如:

3 5 2 6 1
2 3 4
1 6 2 7

初始时矩阵为空,读入 m对整数 (x,y),表示在第 x 行的末尾加上一个元素 y。

输出最终的锯齿矩阵。

输入格式

第一行输入两个整数 n,m (1≤n,m≤10000),其中 n表示锯齿数组的行数,m表示插入的元素总数。

接下来一共 m行,每行两个整数 x,y (1≤x≤n,0≤y≤10000),表示在第 x行的末尾插入一个元素 y。

输出格式

一共输出 n 行,每行若干个用空格分隔的整数。

如果某行没有任何元素,则输出一个空行

输出时每行末尾的多余空格,不影响答案正确性

3 12
1 3
2 2
2 3
2 4
3 1
3 6
1 5
1 2
1 6
3 2
3 7
1 1
3 5 2 6 1
2 3 4
1 6 2 7

动态数组

Not Claimed
Status
Done
Problem
7
Open Since
2024-7-13 0:00
Deadline
2024-7-15 23:59
Extension
24 hour(s)