#abc231f. F - Jealous Two
F - Jealous Two
Score : points
问题陈述
Snuke 计划分别给 Takahashi 和 Aoki 各赠送一件礼物。 有 个候选礼物。Takahashi 对第 个候选礼物的印象为 ,而 Aoki 对它的印象为 。
这两个人非常嫉妒。如果 Takahashi 对 Aoki 获得的礼物的印象大于 Takahashi 自己获得的礼物的印象,那么 Takahashi 就会嫉妒 Aoki 并开始争斗,反之亦然。
在 种可能的送礼方式中,有多少种不会导致他们争斗?
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
Snuke is planning on giving one gift each to Takahashi and Aoki.
There are candidates for the gifts. Takahashi's impression of the -th candidate is , and Aoki's impression of it is .
The two are very jealous. If Takahashi's impression of the gift Aoki gets is greater than Takahashi's impression of the gift Takahashi gets, Takahashi gets jealous of Aoki and starts fighting, and vice versa.
Among the possible ways of giving the gifts, how many do not lead to fighting?
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the answer.
Sample Input 1
3
50 100 150
1 3 2
Sample Output 1
4
For example, if we give the -st candidate to Takahashi and the -nd candidate to Aoki, Takahashi's impression of the gift Aoki gets is , while Takahashi's impression of the gift Takahashi gets is , so Takahashi gets jealous of Aoki and starts fighting.
As another example, if we give the -rd candidate to Takahashi and the -nd candidate to Aoki, the two will not start fighting.
Note that it is allowed to give the same gift to the two.
Sample Input 2
3
123456789 123456 123
987 987654 987654321
Sample Output 2
6
Sample Input 3
10
3 1 4 1 5 9 2 6 5 3
2 7 1 8 2 8 1 8 2 8
Sample Output 3
37
update @ 2024/3/10 10:05:13