結果

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

ソースコード

diff #

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