#C. C - Swappable

    传统题 1000ms 256MiB

C - Swappable

该比赛已结束,您无法在比赛模式下递交该题目。您可以点击“在题库中打开”以普通模式查看和递交本题。

C - Swappable

Score : $300$ points

Problem Statement

Given an array of $N$ integers $A=(A_1,A_2,...,A_N)$, find the number of pairs $(i,j)$ of integers satisfying all of the following conditions:

  • $1 \le i < j \le N$
  • $A_i \neq A_j$

Constraints

  • All values in input are integers.
  • $2 \le N \le 3 \times 10^5$
  • $1 \le A_i \le 10^9$

Input

Input is given from Standard Input in the following format:

NN

A1A_1 A2A_2 \dots ANA_N

Output

Print the answer as an integer.


3
1 7 1
2

In this input, we have $A=(1,7,1)$.

  • For the pair $(1,2)$, $A_1 \neq A_2$.
  • For the pair $(1,3)$, $A_1 = A_3$.
  • For the pair $(2,3)$, $A_2 \neq A_3$.

10
1 10 100 1000 10000 100000 1000000 10000000 100000000 1000000000
45

20
7 8 1 1 4 9 9 6 8 2 4 1 1 9 5 5 5 3 6 4
173

2025寒假ATC码力训练营第十一次练习

未参加
状态
已结束
规则
IOI
题目
6
开始于
2025-2-3 13:00
结束于
2025-2-3 14:30
持续时间
1.5 小时
主持人
参赛人数
5