結果

問題 No.3257 +|+
ユーザー Iroha_3856
提出日時 2025-09-05 03:30:26
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,102 ms / 3,000 ms
コード長 343 bytes
コンパイル時間 358 ms
コンパイル使用メモリ 82,552 KB
実行使用メモリ 302,776 KB
最終ジャッジ日時 2025-09-05 15:04:05
合計ジャッジ時間 26,885 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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, M+1):
	cnt = defaultdict(int)
	for c in C[d]:
		ans += cnt[-c]
		cnt[c] += 1
print(ans)
0