Public Judge

pjudge

Time Limit: 3 s Memory Limit: 1024 MB Total points: 100
统计

题目描述

有一个 $N\times M$ 的矩阵 $A$,每个方格 $A_{i,j}$ 可以为正整数,负整数或者 $0$。

对于方格 $(i,j)$,我们定义:

$$C_{i, j} = \left| \sum _{k=1}^ N A_{k, j} - \sum _{k=1}^ M A_{i, k} \right| $$

给定所有的 $C_{i,j}$,你能否构造出一组合法的 $A_{i,j}$?

数据保证至少存在一组解。

输入格式

第一行,两个正整数 $N,M$。

接下来 $N$ 行,第 $i$ 行第 $j$ 个数为 $C_{i,j}$,含义见题面。

保证至少存在一组解。

输出格式

输出 $N$ 行 $M$ 列,第 $i$ 行第 $j$ 个数为 $A_{i,j}$。

多解时,任意输出一组解均可。

你需要保证 $-2^{31}\le A_{i,j}\lt 2^{31}$。

样例输入 1

2 3
3 4 1
6 7 2

样例输出 1

1 2 6
5 3 4

样例输入 2~6

见下发文件。 注:不提供样例 3~6 的样例输出。

数据范围

  • $1\le N,M\le 1 000$;
  • $0\le C_{i,j}\le 1 000$;
  • 保证至少存在一组解。
子任务编号 得分 限制
$1$ $8$ $N,M,C_{i,j}\le 3$
$2$ $7$ $N,M,C_{i,j}\le 6$
$3$ $12$ $N=1$
$4$ $10$ $N,M\ge 2$,$C_{i,j}$ 全相同
$5$ $18$ $N,M\ge 2$,$C_{i,j}$ 两两不同
$6$ $10$ $C_{i,j}\le 1$
$7$ $12$ $N=M$
$8$ $15$ $N,M,C_{i,j}\le 100$
$9$ $8$ 无额外限制
About Issues

We understand that our problem archive is not perfect. If you find any issues with the problem, including the statement, scoring configuration, time/memory limits, test cases, etc.

You may use this form to submit an issue regarding the problem. A problem moderator will review your issue and proceed it properly.

STOP! Before you submit an issue, please READ the following guidelines:

  1. This is not a place to publish a discussion, editorial, or requests to debug your code. Your issue will only be visible by you and problem moderators. Other users will not be able to view or reply your issues.
  2. Do not submit duplicated issues. If you have already submitted one, please wait for an moderator to review it. Submitting multiple issues will not speed up the review process and might cause your account to be banned.
  3. Issues must be filed in English or Chinese only.
  4. Be sure your issue is related to this problem. If you need to submit an issue regarding another problem, contest, category, etc., you should submit it to the corresponding page.

Active Issues 0

No issues in this category.

Closed/Resolved Issues 0

No issues in this category.