QOJ.ac

QOJ

Time Limit: 2 s Memory Limit: 512 MB Total points: 100

#352. 生存战略

统计
我讨厌「命运」这个词
出生 相遇 离别
成功和失败 人生的幸运和不幸
如果这些都是由命运事先决定好了的话
那我们又是为何而生的呢
在富裕家庭里出生的人
由漂亮妈妈生下来的人
正逢饥荒和战争时期出生的人
如果这一切都是命运
那神明可就太不讲道理 太残酷了
从那时开始 我们就没有未来
因为我们深知 自己必将一事无成    
                        《回转企鹅罐》

给你一个 $n\times m$ 的矩阵从上往下行数递增,从左到右列数递增,对它进行 $q$ 次操作:

  1. 给 $x_1, y_1, x_2, y_2, v$,将 $x_1\le x\le x_2, y_1\le y\le y_2$ 部分的数都加上 $v$。
  2. 给出 $x_1, y_1, l, t$,将 $x_1 \le x \le x_1 + l, y_1\le y\le y_1 + l$ 位置的正方形内部的数逆时针旋转 $t\times 90^\circ$。

有个数据点里有 $opt=0$ 的情况,请当做 $opt=2$ 处理

请你输出操作结束后的矩阵。

矩阵内的数均对 $2^{32}$ 取模,这意味着你可以使用 unsigned int 进行计算。

输入格式

第一行输入四个数 $n, m, q, \mathrm{lim}$

接下来 $q$ 行输入每行第一个数 $opt$ 表示操作类型,然后对应该操作类型输入对应的参数。

输出格式

为了降低输出量,输出 $\mathrm{lim}$ 个数。

假设将矩阵的数第 $i$ 行第 $j$ 列为 a[i][j],令

output[((i - 1) * m + j - 1) % lim] ^= a[i][j] + ((i - 1) * m + j - 1) / lim

输出数组 output[0], output[1], ... output[lim - 1] 即可。

样例数据

样例 1 输入

4 4 2 16
1 2 2 4 4 1
2 3 1 1 1

样例 1 输出

0 0 0 0 0 1 1 1 1 1 1 1 0 0 1 1

样例 1 解释

第一次操作:

0 0 0 0
0 1 1 1
0 1 1 1
0 1 1 1

第二次操作:

0 0 0 0
0 1 1 1
1 1 1 1
0 0 1 1

数据范围

空间限制:$512\texttt{MB}$

时间限制:$2\texttt{s}$

对于 $100\%$ 的数据,保证 $1\le n, m, q\le 2,000, \mathrm{lim} = \min(nm, 10^5)$。

测试点 $n,m$ 特殊性质
$1,2$ $\le100$
$3,4,5,6$ $\le600$
$7,8$ 没有操作 2
$9$ 所有操作 1 在操作 2 之前
$10$

空的地方表示没有额外限制。

提示

这是一道低级数据结构题。

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.