結果
| 問題 | No.3456 Common Difference is D |
| コンテスト | |
| ユーザー |
detteiuu
|
| 提出日時 | 2026-02-28 13:36:39 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 163 ms / 2,000 ms |
| + 108µs | |
| コード長 | 260 bytes |
| 記録 | |
| コンパイル時間 | 238 ms |
| コンパイル使用メモリ | 95,728 KB |
| 実行使用メモリ | 158,712 KB |
| 最終ジャッジ日時 | 2026-07-25 05:17:47 |
| 合計ジャッジ時間 | 3,961 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 20 |
ソースコード
from collections import defaultdict
N, M = map(int, input().split())
A = list(map(int, input().split()))
L = defaultdict(int)
R = defaultdict(int)
for a in A:
R[a] += 1
ans = 0
for a in A:
R[a] -= 1
ans += L[a-M]*R[a+M]
L[a] += 1
print(ans)
detteiuu