문제
Farmer John has a binary string of length , initially all zeros.
He will first perform () updates on the string, in order. Each update flips every character from to . Specifically, flipping a character changes it from to , or vice versa.
Then, he asks you () queries. For each query, he asks you to output the lexicographically greatest subsequence of length comprised of characters from the substring from to . If your answer is a binary string , then output (that is, its value when interpreted as a binary number) modulo .
A subsequence is a string that can be derived from another string by deleting some or no characters without changing the order of the remaining characters.
Recall that string is lexicographically greater than string of equal length if and only if at the first position , if it exists, where , we have .
입력
The first line contains , , and .
The next lines contain two integers, and () — the endpoints of each update.
The next lines contain three integers, , , and () — the endpoints of each query and the length of the subsequence.
출력
Output lines. The th line should contain the answer for the th query.
예제 입력 1
5 3 9
1 5
2 4
3 3
1 5 5
1 5 4
1 5 3
1 5 2
1 5 1
2 5 4
2 5 3
2 5 2
2 5 1
예제 출력 1
21
13
7
3
1
5
5
3
1
예제 입력 2
9 1 1
7 9
1 8 8
예제 출력 2
3
예제 입력 3
30 1 1
1 30
1 30 30
예제 출력 3
73741816
점수
Input 4: Input 5: Inputs 6-7: Inputs 8-12: Inputs 13-20: No additional constraints.
코드를 제출하려면 로그인이 필요합니다.
로그인