Logo
(追記) (追記ここまで)

21092번 - Rectangle Painting 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
12 초 1024 MB34161164.706%

문제

There is an cell grid infinite in left, right, and upwards directions (all the cells with coordinates $(x, y)$ with $x \in \mathbb{Z},ドル $y \ge 0$ exist). Initially all the cells are white. You have to process $q$ queries of two types:

  1. $y_{i}$ $l_{i}$ $r_{i}$: paint all cells $(x, y_{i})$ for $l_{i} \le x \le r_{i}$ black. If the cell is already black, its color doesn't change.
  2. $l_{i}$ $r_{i}$: consider all cells with $x$ coordinate on the segment $[l_{i}; r_{i}]$. Find the highest cell such that all cells exactly under it are black. Formally, you have to find maximal $h$ such that $\exists \: x \in [l_{i}; r_{i}] \: \forall \: y \in [0;h)$ cell $(x, y)$ is black.

To enforce processing the queries online they are encrypted using previous answers.

입력

The first line contains one integer $q$ (1ドル \le q \le 10^{5}$) --- the number of queries to process.

The next $q$ lines will contain encrypted descriptions of queries. Let $S$ be the sum of answers to all queries of second type processed so far.

Each description has form either 1ドル$ $(y_{i} \oplus S)$ $(l_{i} \oplus S)$ $(r_{i} \oplus S)$ or 2ドル$ $(l_{i} \oplus S)$ $(r_{i} \oplus S)$. It is guaranteed that 0ドル \le y_{i} \le 2 \cdot 10^{5},ドル 0ドル \le l_{i} \le r_{i} \le 2 \cdot 10^{5}$. Note that the guarantees are given on parameters after decryption, the numbers in input might not fit in 32-bit integers.

Don't forget to add the new answer to $S$ after each query of the second type.

출력

Print the answers to all queries of the second type on separate lines.

제한

예제 입력 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

힌트

S Encrypted Query Ans
0 1 0 1 1 1 0 1 1 -
0 2 0 10 2 0 10 1
1 1 1 9 9 1 0 8 8 -
1 1 0 0 6 1 1 1 7 -
1 1 0 3 9 1 1 2 8 -
1 2 5 5 2 4 4 0
1 1 1 5 5 1 0 4 4 -
1 2 5 5 2 4 4 2
3 2 0 5 2 3 6 2
5 1 7 6 3 1 2 3 6 -

출처

Camp > Petrozavodsk Programming Camp > Winter 2021 > Day 5: Almost Retired Dandelion Contest, ICPC Camp Contest 2 K번

Contest > Open Cup > 2020/2021 Season > Stage 11: Grand Prix of Nizhny Novgorod K번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /