結果

問題 No.2374 ASKT Subsequences
ユーザー hibit_at
提出日時 2023-06-16 22:47:42
言語 PyPy3
(7.3.15)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 518 bytes
コンパイル時間 137 ms
コンパイル使用メモリ 82,308 KB
実行使用メモリ 83,692 KB
最終ジャッジ日時 2024-06-29 22:37:48
合計ジャッジ時間 6,774 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 27 TLE * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict

n = int(input())
a = list(map(int, input().split(' ')))
m = max(a)
ans = 0
for i in range(n):
    buf = [0] * (m+2)
    left_buf = defaultdict(int)
    for j in range(i, n):
        buf[a[j]] += 1
    for j in range(i, n):
        if a[j] == a[i] + 10:
            for key, val in left_buf.items():
                estimate = key - a[i] - 10
                if estimate > 0:
                    ans += val * buf[key+1]
        buf[a[j]] -= 1
        left_buf[a[j]] += 1
print(ans)
0