QOJ.ac

QOJ

Süre Sınırı: 3.5 s Bellek Sınırı: 256 MB Toplam puan: 100

#11553. 約数

İstatistikler

$n$ 個の整数からなる列 $a_1, a_2, \ldots, a_n$ が与えられます。$i, j \in \{1, \ldots, n\}$、$i \ne j$ を満たし、$a_i$ が $a_j$ の約数であるような順序対 $(i, j)$ の個数を求めてください。

入力

入力の 1 行目には整数 $n$($1 \le n \le 2\,000\,000$)が与えられます。2 行目には $n$ 個の整数からなる列 $a_1, a_2, \ldots, a_n$($1 \le a_i \le 2\,000\,000$)が与えられます。

出力

出力の最初の、かつ唯一の行に、求める順序対の個数を表す整数を出力してください。

入出力例

入力 1

5
2 4 5 2 6

出力 1

6

注記

指定された性質を満たす順序対は、$(1, 2)$、$(1, 4)$、$(1, 5)$、$(4, 1)$、$(4, 2)$、$(4, 5)$ の 6 個です。

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.