結果

問題 No.2374 ASKT Subsequences
コンテスト
ユーザー hibit_at
提出日時 2023-06-16 22:47:42
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 1,782 ms / 2,000 ms
コード長 518 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 222 ms
コンパイル使用メモリ 85,128 KB
実行使用メモリ 82,768 KB
最終ジャッジ日時 2026-03-19 13:45:38
合計ジャッジ時間 4,706 ms
ジャッジサーバーID
(参考情報)
judge2_1 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 28
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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