Binary Sequence and Queries

아직 제출이 없습니다시간 제한3초메모리 제한1024 MB

문제

You are given a binary sequence a_1,a_2,,a_na\_1, a\_2, \ldots, a\_n of length nn. You will also be given qq queries of two different types.

  1. pp tt: replace a_pa\_p with tt.

  2. ll rr xx yy: Find any \[s,e]\[s, e] satisfying the following conditions, or report that none exists:

    • lserl \leq s \leq e \leq r
    • The longest consecutive number of 00's in a_s,a_s+1,,a_ea\_s, a\_{s+1}, \ldots, a\_e is xx.
    • The longest consecutive number of 11's in a_s,a_s+1,,a_ea\_s, a\_{s+1}, \ldots, a\_e is yy.

입력

The first line contains two integers nn and qq (1n,q2×1051 \leq n, q \leq 2 \times 10^5).

The second line contains a binary string of length nn denoting the binary sequence a_1a_2a_na\_1a\_2 \ldots a\_n.

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

  • First type query: 11 pp tt (1pn,t0,11 \leq p \leq n, t \in \\{0, 1\\})
  • Second type query: 22 ll rr xx yy (1lrn,0x,yn1 \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]\[s, e] satisfying the conditions, print two integers ss and ee separated by a single space. Otherwise, print 1-1.

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