QOJ.ac

QOJ

Time Limit: 15 s Memory Limit: 512 MB Total points: 100 Hackable ✓

#6622. rprmq2

統計

给定正整数 $m$,你需要维护一个 $m\times m$ 的矩阵 $a_{i,j},\;1\le i,j\le m$,初值为 $0$。

共 $m$ 次操作,每次操作给出 $x,\;y,\;z_{0,0},\;z_{0,1},\;z_{1,0},\;z_{1,1}$,

首先对 $0\le p,q\le 1$ 询问矩阵中满足 $[i\ge x]=p,\;[j\ge y]=q$ 的位置的值 $a_{i,j}$ 的最大值,答案记为 $w_{p,q}$,

然后对矩阵每个位置 $(i,j)$,将其值 $a_{i,j}$ 加上 $z_{[i\ge x],[j\ge y]}$。

记号 $[c]$ 在条件 $c$ 为真时值为 $1$,否则值为 $0$。

输入格式

第一行一个正整数 $m$ ;

之后 $m$ 行,每行 $6$ 个数 $x,\;y,\;z_{0,0},\;z_{0,1},\;z_{1,0},\;z_{1,1}$ 表示一次操作,意义如上述。

输出格式

对每次操作,输出 $4$ 行,依次为 $w_{0,0},\;w_{0,1},\;w_{1,0},\;w_{1,1}$。

样例数据

样例 1 输入

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

样例 1 输出

0
0
0
0
9
5
4
2
12
12
6
12
16
14
14
15
23
23
22
22
28
26
31
31
37
33
37
35
39
42
40
37
44
52
41
41
54
54
47
41

子任务

Idea:?,Solution:?,Code:ccz181078,Data:ccz181078

对于 $100\%$ 的数据,$2 \le x,y\le m\le 2\times 10^5$ ,$1\le z_{i,j}\le 10^9$,所有数值为整数。

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.