結果

問題 No.3257 +|+
ユーザー Iroha_3856
提出日時 2025-09-05 03:27:38
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 343 bytes
コンパイル時間 325 ms
コンパイル使用メモリ 12,160 KB
実行使用メモリ 309,876 KB
最終ジャッジ日時 2025-09-05 15:04:48
合計ジャッジ時間 21,265 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 4 TLE * 4 -- * 25
権限があれば一括ダウンロードができます

ソースコード

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