QOJ.ac

QOJ

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

给定正整数 $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$,所有数值为整数。

Discussions

About Discussions

The discussion section is only for posting: Editorials, General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues. Submitting multiple issues may cause your account to be banned.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.