QOJ.ac

QOJ

时间限制: 10 s 内存限制: 512 MB 总分: 100 难度: [显示]

#967. 직사각형 색칠하기

统计

왼쪽, 오른쪽, 위쪽으로 무한히 뻗어 있는 격자가 있습니다(좌표 $x \in \mathbb{Z}, y \ge 0$인 모든 칸이 존재합니다). 처음에 모든 칸은 흰색입니다. 당신은 다음 두 가지 유형의 쿼리 $q$개를 처리해야 합니다.

  1. $y_i$ $l_i$ $r_i$: $l_i \le x \le r_i$인 모든 칸 $(x, y_i)$를 검은색으로 칠합니다. 이미 검은색인 칸의 색은 변하지 않습니다.
  2. $l_i$ $r_i$: $x$ 좌표가 구간 $[l_i, r_i]$에 있는 모든 칸을 고려합니다. 그 아래에 있는 모든 칸이 검은색인 가장 높은 칸을 찾습니다. 형식적으로, $\exists x \in [l_i, r_i] \forall y \in [0, h)$에 대해 칸 $(x, y)$가 검은색이 되는 최대 $h$를 찾아야 합니다.

쿼리를 온라인으로 처리하기 위해 이전 답변들을 사용하여 암호화되어 있습니다.

입력

첫 번째 줄에는 처리할 쿼리의 수 $q$ ($1 \le q \le 10^5$)가 주어집니다.

다음 $q$개의 줄에는 암호화된 쿼리 설명이 포함되어 있습니다. 지금까지 처리된 모든 2번 유형 쿼리의 답변 합을 $S$라고 합시다.

각 설명은 “1 $(y_i \oplus S)$ $(l_i \oplus S)$ $(r_i \oplus S)$” 또는 “2 $(l_i \oplus S)$ $(r_i \oplus S)$” 형식으로 주어집니다. 복호화 후의 매개변수에 대해 $0 \le y_i \le 2 \cdot 10^5$, $0 \le l_i \le r_i \le 2 \cdot 10^5$임이 보장됩니다. 복호화 후의 매개변수에 대한 보장이므로, 입력의 숫자는 32비트 정수 범위를 벗어날 수 있음에 유의하십시오.

2번 유형의 쿼리를 처리한 후 새로운 답변을 $S$에 더하는 것을 잊지 마십시오.

출력

2번 유형의 모든 쿼리에 대한 답변을 각 줄에 하나씩 출력하십시오.

예제

입력 1

10
1 0 1 1
2 0 10
1 1 9 9
1 0 0 6
1 0 3 9
2 5 5
1 1 5 5
2 5 5
2 0 5
1 7 6 3

출력 1

1
0
2
2

Editorials

IDTypeStatusTitlePosted ByLast UpdatedActions
#1557EditorialOpenNew Editorial for Problem #967xcx09022026-04-16 19:37:17View
#590Editorial Open集训队作业 解题报告 by 孙梓航Qingyu2026-01-02 22:40:44 Download

Discussions

About Discussions

The discussion section is only for posting: 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.
  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.