logo AlgoBeat OnlineJudge
登录 注册

#212622. [UTS 2024] Matrix

内存限制:1024 MiB 时间限制:2000 ms 标准输入输出
题目类型:VJudge(洛谷) 评测方式:VJudge
上传者: 匿名

题目描述

You are given a matrix of size consisting of elements .

We call a triangle on the matrix of size starting at point a set of points that can be reached from in no more than steps going either up or right.

You are asked to find for each the following values:

  • The maximal value in the triangle of size starting at point ;
  • The number of occurrences of the maximal value in that triangle.

输入格式

The first line contains three integers , , and --- dimensions of the matrix and the size of the triangle.

The following lines contain integers --- description of the matrix.

输出格式

Print two matrices of size .

The first matrix in position should contain the maximal value of a triangle of size starting at .

The second matrix in position should contain the number of occurrences of the maximal value in the triangle of size starting at .

样例

样例输入 1

4 4 2
1 2 6 14
12 3 13 5
11 4 7 8
10 16 9 15

样例输出 1

12 13 13 
12 7 13 
16 16 15 
1 1 1 
1 1 1 
1 1 1 

数据范围与提示

  • ( points) ;
  • ( points) ;
  • ( points) ;
  • ( points) ;
  • ( points) no additional restrictions.