結果
問題 |
No.2374 ASKT Subsequences
|
ユーザー |
![]() |
提出日時 | 2023-06-16 17:59:35 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 441 bytes |
コンパイル時間 | 179 ms |
コンパイル使用メモリ | 81,984 KB |
実行使用メモリ | 216,700 KB |
最終ジャッジ日時 | 2024-06-29 22:35:39 |
合計ジャッジ時間 | 24,856 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 23 WA * 2 TLE * 3 |
ソースコード
from collections import defaultdict n = int(input()) a = list(map(int, input().split(' '))) ans = 0 for d in range(1, 1000): dp = [[0 for j in range(4)] for i in range(n)] mp = defaultdict(int) for i in range(n): mp[(a[i], 0)] += 1 mp[(a[i], 1)] += mp[(a[i] - 10 - d, 0)] mp[(a[i], 2)] += mp[(a[i] + d, 1)] ans += mp[(a[i] - d - 1, 2)] mp[(a[i], 3)] += mp[(a[i] - d - 1, 2)] print(ans)