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

23709번 - Gleb Evstropov 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
20 초 (추가 시간 없음) 512 MB104480.000%

문제

You are given an array $a$.

Process two types of queries:

  1. You are given $x$ and $y$. Set $a_x$ to $y$.
  2. You are given $l,ドル $r$ and $k$. Find the largest value of $m,ドル such that sequence $k, k+1, \ldots, m$ is a subsequence of $a_{l:r}$.

입력

The first line contains two integers $n$ and $q$ (1ドル \leq n, q \leq 10^6$), the length of $a$ and the number of queries, respectively.

The second line contains $n$ integers $a_i$ (0ドル \leq a_i < n$), the elements of $a$.

$q$ lines follow. Each of them has one of the following forms:

  • 1ドル x y$ (0ドル \leq x, y < n$), describing a query of the first type.
  • 2ドル l r k$ (0ドル \leq l < r \leq n,ドル 0ドル \leq k < n$), describing a query of the second type. Note that half-intervals are used, i.e. $a_{0:3}$ contains elements with indices 0ドル,ドル 1ドル$ and 2ドル$. It is guaranteed that the given half-interval contains at least one element equal to $k$.

출력

For each query of the second type print the corresponding $m$.

제한

예제 입력 1

6 17
0 0 0 1 2 1
2 0 4 0
2 0 5 0
1 3 2
2 0 4 0
2 0 6 0
2 0 4 2
2 5 6 1
1 0 1
2 1 6 1
2 0 5 1
1 0 0
1 5 5
1 2 2
1 4 4
1 3 3
1 1 1
2 0 6 0

예제 출력 1

1
2
0
1
2
1
1
2
5

힌트

출처

Contest > Open Cup > 2018/2019 Season > Stage 16: Grand Prix of Moscow G번

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

출처

대학교 대회

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

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