#abc348f. F - Oddly Similar
F - Oddly Similar
Score: points
问题陈述
有 个长度为 的序列,记为 。第 个序列由 个整数 表示。
如果长度为 的两个序列 和 满足满足条件的索引 ,使得 的数量为奇数,则称这两个序列是相似的。
找出满足 且 和 相似的整数对 的数量。
以上为大语言模型 kimi 翻译,仅供参考。
Problem Statement
There are sequences of length , denoted as . The -th sequence is represented by integers .
Two sequences and of length are said to be similar if and only if the number of indices such that is odd.
Find the number of pairs of integers satisfying such that and are similar.
Constraints
- All input values are integers.
Input
The input is given from Standard Input in the following format:
Output
Print the answer as an integer.
Sample Input 1
3 3
1 2 3
1 3 4
2 3 4
Sample Output 1
1
The pair satisfies the condition because there is only one index such that , which is .
The pairs do not satisfy the condition, making the only pair that does.
Sample Input 2
6 5
8 27 27 10 24
27 8 2 4 5
15 27 26 17 24
27 27 27 27 27
27 7 22 11 27
19 27 27 27 27
Sample Output 2
5