結果
問題 |
No.2374 ASKT Subsequences
|
ユーザー |
![]() |
提出日時 | 2023-07-07 22:39:42 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 378 bytes |
コンパイル時間 | 225 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 11,264 KB |
最終ジャッジ日時 | 2024-07-21 18:55:38 |
合計ジャッジ時間 | 22,369 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 6 WA * 17 TLE * 5 |
ソースコード
from collections import defaultdict N = int(input()) A = list(map(int,input().split())) D = defaultdict(int) ans = 0 for i in range(1,N-2): D[A[i-1]] += 1 dd = defaultdict(int) for j in range(i+1,N): dd[A[j]] += 1 for j in range(i+1,N-1): dd[A[j]] -= 1 b = A[i] c = A[j] k = b - c a = b - k - 10 d = c + k + 1 ans += D[a]*dd[d] print(ans)