영어 원문입니다. 원문의 수식·표를 글자로 옮겨 모양이 다를 수 있습니다. 정확한 내용은 원문 페이지에서 확인하세요. 원문 페이지 열기 (새 창)
시간 제한 1초 · 메모리 제한 512 MB
Problem
There is a bit string consisting of n bits. Then, there are some changes that invert one given bit. Your task is to report, after each change, the length of the longest substring whose each bit is the same.
Input
The first input line has a bit string consisting of n bits. The bits are numbered 1,2,…,n.
The next line contains an integer m: the number of changes.
The last line contains m integers x_1,x_2,…,x_m describing the changes.
Output
After each change, print the length of the longest substring whose each bit is the same.
Constraints
- 1 ≤ n ≤ 2 · 10^5
- 1 ≤ m ≤ 2 · 10^5
- 1 ≤ x_i ≤ n
Example
Explanation: The bit string first becomes 000011, then 010011, and finally 010001.
예제
예제 1
001011 3 3 2 5
4 2 3