#abc274h. Ex - XOR Sum of Arrays
Ex - XOR Sum of Arrays
Score : points
问题描述
对于长度为 的整数序列 和 ,其中所有元素均为非负整数,定义它们的 异或和 为长度也为 的由非负整数组成的序列 $(B_1\oplus C_1, B_2\oplus C_2, ..., B_{M}\oplus C_{M})$。此处, 表示按位异或运算。
例如,如果 和 ,则有 $S(B, C) = (1\oplus 3, 2\oplus 5, 3\oplus 7) = (2, 7, 4)$。
给定一个由非负整数组成的序列 ,令 表示由第 个到第 个元素组成的连续子序列。
你将收到 个查询请求并需要处理它们,查询如下:
每个查询提供整数 , , , , , 和 ,它们都在 到 (包括两端点)之间,并满足 , , 以及 。如果 在字典序上 严格小于 ,则打印 Yes
;否则打印 No
。
什么是按位异或运算?两个整数 和 的 exclusive logical sum(异或) 定义如下:
- 在二进制表示中, 中的 位()是 当且仅当在 和 的二进制表示中恰好有一个的 位为 ;否则,该位为 。
例如,(二进制表示:)。什么是序列上的字典序?
称序列 在字典序上 严格小于 序列 ,当且仅当满足以下 1. 或 2. 中的一个条件。
- 且 。
- 存在一个整数 ,满足以下两个条件:
- 。
- 。
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
For sequences and , each of length , consisting of non-negative integers, let the XOR sum of and be defined as the sequence $(B_1\oplus C_1, B_2\oplus C_2, ..., B_{M}\oplus C_{M})$ of length consisting of non-negative integers. Here, represents bitwise XOR.
For instance, if and , we have $S(B, C) = (1\oplus 3, 2\oplus 5, 3\oplus 7) = (2, 7, 4)$.
You are given a sequence of non-negative integers. Let denote the contiguous subsequence composed of the -th through -th elements of .
You will be given queries explained below and asked to process all of them.
Each query gives you integers , , , , , and , each between and , inclusive. These integers satisfy , , , and . If is strictly lexicographically smaller than , print Yes
; otherwise, print No
.
What is bitwise XOR? The exclusive logical sum of two integers and is defined as follows.
- The 's place () in the binary notation of is if exactly one of the 's places in the binary notation of and is ; otherwise, it is .
For example, (In binary notation: ). What is lexicographical order on sequences?
A sequence is said to be strictly lexicographically smaller than a sequence if and only if 1. or 2. below is satisfied.
- and .
- There is an integer that satisfies both of the following.
- .
- .
Constraints
- All values in the input are integers.
Input
The input is given from Standard Input in the following format, where represents the -th query:
The queries are in the following format:
Output
Print lines. The -th line should contain the answer to the -th query.
Sample Input 1
4 5
1 2 3 1
1 3 2 4 1 4
1 2 2 3 3 4
1 1 2 2 3 4
1 2 2 3 3 3
1 4 1 4 1 1
Sample Output 1
No
No
Yes
No
Yes
For the first query, we have and , so $S(A(1,3),A(2,4)) = (1 \oplus 2, 2 \oplus 3, 3 \oplus 1) = (3, 1, 2)$. This is lexicographcially larger than , so the answer is No
.
For the second query, we have and , which are equal, so the answer is No
.
Sample Input 2
10 10
725560240 9175925348 9627229768 7408031479 623321125 4845892509 8712345300 1026746010 4844359340 2169008582
5 6 5 6 2 6
5 6 1 2 1 1
3 8 3 8 1 6
5 10 1 6 1 7
3 4 1 2 5 5
7 10 4 7 2 3
3 6 1 4 7 9
4 5 3 4 8 9
2 6 1 5 5 8
4 8 1 5 1 9
Sample Output 2
Yes
Yes
Yes
Yes
No
No
No
No
No
No
update @ 2024/3/10 11:34:20