結果

問題 No.3257 +|+
ユーザー Iroha_3856
提出日時 2025-09-05 03:52:50
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,046 ms / 3,000 ms
コード長 356 bytes
コンパイル時間 381 ms
コンパイル使用メモリ 82,168 KB
実行使用メモリ 302,524 KB
最終ジャッジ日時 2025-09-05 15:04:52
合計ジャッジ時間 25,205 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict
N = int(input())
M = 200000
A = list(map(int, input().split()))

C = [[] for i in range(2*M+1)]

for i in range(N):
	for d in range(1, (A[i] + M) // (i+1) + 1):
		C[d].append(A[i] - (i+1) * d)

ans = 0
for d in range(1, (2 * M) // 3 + 1):
	cnt = defaultdict(int)
	for c in C[d]:
		ans += cnt[-c]
		cnt[c] += 1
print(ans)
0