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

19455번 - Bitwise Queries 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
3 초 512 MB59520417635.484%

문제

You are given an array $a$ of size $n$ and you need to perform $m$ queries on it. There are three types of queries:

  1. "& $l$ $r$ $x$": change $a_i$ to ($a_i$ AND $x$) for all $i$ = $l,ドル $l+1,ドル $\ldots,ドル $r$;
  2. "| $l$ $r$ $x$": change $a_i$ to ($a_i$ OR $x$) for all $i$ = $l,ドル $l+1,ドル $\ldots,ドル $r$;
  3. "? $l$ $r$": find the minimal value among $a_l,ドル $a_{l+1},ドル $\ldots,ドル $a_r$.

Output the answers for all queries of the third type.

입력

The first line contains one integer $n$ (1ドル \le n \le 5 \cdot 10^5$) --- the size of the array.

The second line contains $n$ space-separated integers $a_i$ (0ドル \le a_i < 2^{30}$) --- the elements of the array.

The third line contains one integer $m$ (1ドル \le m \le 2 \cdot 10^5$) --- the number of queries.

Next $m$ lines contain descriptions of queries in the format described above. For all queries 1ドル \le l \le r \le n,ドル for queries of the first and second types 0ドル \le x < 2^{30}$.

출력

For each query of the third type, print the answer on a separate line.

제한

예제 입력 1

5
1 2 3 4 5
4
& 1 2 6
| 3 5 4
? 1 2
? 3 5

예제 출력 1

0
4

힌트

출처

Camp > Petrozavodsk Programming Camp > Summer 2016 > Day 3: Moscow IPT Contest B번

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

출처

대학교 대회

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

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