結果
| 問題 | No.3456 Common Difference is D |
| コンテスト | |
| ユーザー |
detteiuu
|
| 提出日時 | 2026-02-28 13:36:39 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 189 ms / 2,000 ms |
| コード長 | 260 bytes |
| 記録 | |
| コンパイル時間 | 153 ms |
| コンパイル使用メモリ | 78,036 KB |
| 実行使用メモリ | 137,060 KB |
| 最終ジャッジ日時 | 2026-02-28 13:36:43 |
| 合計ジャッジ時間 | 3,383 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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