結果
| 問題 | No.3456 Common Difference is D |
| コンテスト | |
| ユーザー |
detteiuu
|
| 提出日時 | 2026-02-28 13:36:39 |
| 言語 | PyPy3 (8.0.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 114 ms / 2,000 ms |
| + 28µs | |
| コード長 | 260 bytes |
| 記録 | |
| コンパイル時間 | 1,942 ms |
| コンパイル使用メモリ | 64,044 KB |
| 実行使用メモリ | 97,624 KB |
| 最終ジャッジ日時 | 2026-11-02 02:07:46 |
| 合計ジャッジ時間 | 3,257 ms |
|
ジャッジサーバーID (参考情報) |
judge7_0 / judge4_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 22 |
ソースコード
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