#abc243b. B - Hit and Blow
B - Hit and Blow
Score : points
问题描述
给定两个整数序列,每个序列长度为 : 和 。
- 序列 中的所有元素互不相同。
- 序列 中的所有元素也同样互不相同。
请输出以下两个值:
- 在两个序列中同时出现且位置相同的整数个数。换言之,满足条件 的整数 的个数。
- 在两个序列中同时出现但位置不同的整数个数。即,满足条件 且 的整数对 的个数。
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
You are given integer sequences, each of length : and .
All elements of are different. All elements of are different, too.
Print the following two values.
- The number of integers contained in both and , appearing at the same position in the two sequences. In other words, the number of integers such that .
- The number of integers contained in both and , appearing at different positions in the two sequences. In other words, the number of pairs of integers such that and .
Constraints
- are all different.
- are all different.
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the answers in two lines: the answer to1.
in the first line, and the answer to2.
in the second line.
Sample Input 1
4
1 3 5 2
2 3 1 4
Sample Output 1
1
2
There is one integer contained in both and , appearing at the same position in the two sequences: .
There are two integers contained in both and , appearing at different positions in the two sequences: and .
Sample Input 2
3
1 2 3
4 5 6
Sample Output 2
0
0
In both 1.
and 2.
, no integer satisfies the condition.
Sample Input 3
7
4 8 1 7 9 5 6
3 5 1 7 8 2 6
Sample Output 3
3
2
update @ 2024/3/10 10:26:40