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

28057번 - Binary Sequence and Queries 서브태스크스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
3 초 1024 MB213473924.224%

문제

You are given a binary sequence $a_1, a_2, \ldots, a_n$ of length $n$. You will also be given $q$ queries of two different types.

  1. $p$ $t$: replace $a_p$ with $t$.
  2. $l$ $r$ $x$ $y$: Find any $[s, e]$ satisfying the following conditions, or report that none exists:
    • $l \leq s \leq e \leq r$
    • The longest consecutive number of 0ドル$'s in $a_s, a_{s+1}, \ldots, a_e$ is $x$.
    • The longest consecutive number of 1ドル$'s in $a_s, a_{s+1}, \ldots, a_e$ is $y$.

입력

The first line contains two integers $n$ and $q$ (1ドル \leq n, q \leq 2 \times 10^5$).

The second line contains a binary string of length $n$ denoting the binary sequence $a_1a_2 \ldots a_n$.

Followed by $q$ lines, each is in one of the following formats:

  • First type query: 1ドル$ $p$ $t$ (1ドル \leq p \leq n, t \in \{0, 1\}$)
  • Second type query: 2ドル$ $l$ $r$ $x$ $y$ (1ドル \leq l \leq r \leq n, 0 \leq x, y \leq n$)

출력

For each query of the second type, if there exists a segment $[s, e]$ satisfying the conditions, print two integers $s$ and $e$ separated by a single space. Otherwise, print $-1$.

If there are multiple possible answers, you may print any.

제한

서브태스크

번호배점제한
110

$n, q \leq 100$

220

$n, q \leq 5000$

330

You are only given a query of second type.

440

No further constraints.

예제 입력 1

4 6
0010
2 1 4 1 1
1 3 0
2 1 4 1 1
2 1 4 3 0
1 4 1
2 1 4 3 1

예제 출력 1

2 3
-1
1 3
1 4

예제 입력 2

1 6
1
2 1 1 0 0
2 1 1 1 0
2 1 1 1 1
1 1 0
2 1 1 1 0
2 1 1 0 1

예제 출력 2

-1
-1
-1
1 1
-1

힌트

출처

University > KAIST > KAIST RUN Spring Contest > 2023 KAIST RUN Spring Contest E번

채점 및 기타 정보

  • 예제는 채점하지 않는다.
(追記) (追記ここまで)

출처

대학교 대회

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

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