PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#FT0000183. Truy vấn palindrome với cập nhật ký tự (Palindrome Query)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

Truy vấn palindrome với cập nhật ký tự (Palindrome Query)

Palindrome Query

Source: AtCoder

Version: Phuoc Hung OJ Extended

Problem Statement

Given a lowercase English string SS of length NN, process QQ operations in order. 1 x c replaces the character at position xx by cc. 2 L R asks whether the contiguous substring from position LL to RR equals its own reverse. Updates take effect immediately for subsequent queries. All indices are 1-based and query intervals include both endpoints.

Input

The first line contains N,QN,Q, followed by the string SS. Each of the next QQ lines is 1 x c or 2 L R.

Output

For every type-2 command print exactly Yes for a palindrome and No otherwise.

Subtasks

  • Subtask 1 (20 points): 1≤N≤301\le N\le 30; 1≤Q≤601\le Q\le 60; SS has exactly NN lowercase English letters; each command is 1 x c with 1≤x≤N1\le x\le N, lowercase c, or 2 L R with 1≤L≤R≤N1\le L\le R\le N; at least one type-2 query in PHOJ tests.
  • Subtask 2 (30 points): 1≤N≤50001\le N\le 5000; 1≤Q≤50001\le Q\le 5000; SS has exactly NN lowercase English letters; each command is 1 x c with 1≤x≤N1\le x\le N, lowercase c, or 2 L R with 1≤L≤R≤N1\le L\le R\le N; at least one type-2 query in PHOJ tests.
  • Subtask 3 (50 points): 1≤N≤10000001\le N\le 1000000; 1≤Q≤1000001\le Q\le 100000; SS has exactly NN lowercase English letters; each command is 1 x c with 1≤x≤N1\le x\le N, lowercase c, or 2 L R with 1≤L≤R≤N1\le L\le R\le N; at least one type-2 query in PHOJ tests.

Examples

Example 1

Input

7 8
abcbacb
2 1 5
2 4 7
2 2 2
1 5 c
2 1 5
2 4 7
1 4 c
2 3 6

Output

Yes
No
Yes
No
Yes
Yes

Explanation

  1. 2 1 5: substring abcba; reversed abcba; print Yes.
  2. 2 4 7: substring bacb; reversed bcab; print No.
  3. 2 2 2: substring b; reversed b; print Yes.
  4. 1 5 c: replace a by c at position 5; the string becomes abcbccb. No output.
  5. 2 1 5: substring abcbc; reversed cbcba; print No.
  6. 2 4 7: substring bccb; reversed bccb; print Yes.
  7. 1 4 c: replace b by c at position 4; the string becomes abccccb. No output.
  8. 2 3 6: substring cccc; reversed cccc; print Yes.

Example 2

Input

4 4
aaaa
2 1 4
1 1 b
2 1 4
2 2 3

Output

Yes
No
Yes

Explanation

  1. 2 1 4: substring aaaa; reversed aaaa; print Yes.
  2. 1 1 b: replace a by b at position 1; the string becomes baaa. No output.
  3. 2 1 4: substring baaa; reversed aaab; print No.
  4. 2 2 3: substring aa; reversed aa; print Yes.