传统题 1000ms 256MiB

D - Index Trio

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

D - Index Trio

Score : $400$ points

Problem Statement

You are given an integer sequence $A = (A_1, \dots, A_N)$ of length $N$.

Find the number of triplets of integers $(i, j, k)$ satisfying all of the conditions below.

  • $1 \leq i, j, k \leq N$
  • $\frac{A_i}{A_j} = A_k$

Constraints

  • $1 \leq N \leq 2 \times 10^5$
  • $1 \leq A_i \leq 2 \times 10^5 \, (1 \leq i \leq N)$
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

NN

A1A_1 \ldots ANA_N

Output

Print the answer.


3
6 2 3
2

$(i, j, k) = (1, 2, 3), (1, 3, 2)$ satisfy the conditions.


1
2
0

10
1 3 2 4 6 8 2 2 3 7
62

2024暑假入门组刷题营第三期(十一)

未参加
状态
已结束
规则
IOI
题目
8
开始于
2024-7-19 13:00
结束于
2024-7-19 15:00
持续时间
2 小时
主持人
参赛人数
9