#abc346g. G - Alone
G - Alone
Score: points
问题陈述
给定一个整数序列 。
找出满足以下条件的整数对 的数量:
- 在 中恰好有一个数字出现一次。更准确地说,存在一个整数 使得恰好有一个整数 满足 且 。
以上为大语言模型 kimi 翻译,仅供参考。
Problem Statement
You are given an integer sequence .
Find the number of pairs of integers that satisfy the following conditions:
- There is a number that appears exactly once among . More precisely, there is an integer such that exactly one integer satisfies and .
Constraints
- All input values are integers.
Input
The input is given from Standard Input in the following format:
Output
Print the answer.
Sample Input 1
5
2 2 1 2 1
Sample Output 1
12
pairs of integers satisfy the conditions: $(L, R) = (1, 1), (1, 3), (1, 4), (2, 2), (2, 3), (2, 4), (3, 3), (3, 4), (3, 5), (4, 4), (4, 5), (5, 5)$.
Sample Input 2
4
4 4 4 4
Sample Output 2
4
Sample Input 3
10
1 2 1 4 3 3 3 2 2 4
Sample Output 3
47
update @ 2024/5/16 17:18:29