No.3257 +|+
レベル :
/ AI推定難易度 : 1825
/ 実行時間制限 : 1ケース 3.000秒 / メモリ制限
: 512 MB / 標準ジャッジ問題
タグ : / 解いたユーザー数 46
作問者 :
Iroha_3856
/ テスター :
lif4635
champignon
tikuwa_
タグ : / 解いたユーザー数 46
作問者 :
Iroha_3856
/ テスター :
champignon
問題文最終更新日: 2025-09-05 04:43:54
English (AI translation)
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence.
Back to the original
Problem Statement
You are given a sequence of positive integers $A = (A_1, A_2, \ldots, A_N)$ of length $N$.
Find the number of pairs $(i, j)$ with $1 \leq i < j \leq N$ such that $A_i + A_j$ is divisible by $i + j$.
Input
$N$ $A_1\ A_2\ \ldots\ A_N$
All inputs satisfy the following constraints.
- $2 \leq N \leq 2 \times 10^5$
- $1 \leq A_i \leq 2 \times 10^5$
- All inputs are integers.
Output
Print the answer, followed by a newline.
Sample
Sample 1
Input
5 2 4 6 1 3
Output
5
The condition is satisfied by the $5$ pairs $(i, j) = (1, 2), (1, 3), (2, 3), (2, 5), (3, 4)$.
Sample 2
Input
2 2 1
Output
1
Sample 3
Input
10 20 2 4 15 12 6 14 14 5 16
Output
7
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。