結果

問題 No.2374 ASKT Subsequences
ユーザー hibit_athibit_at
提出日時 2023-06-16 22:47:42
言語 PyPy3
(7.3.15)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 518 bytes
コンパイル時間 355 ms
コンパイル使用メモリ 87,220 KB
実行使用メモリ 80,092 KB
最終ジャッジ日時 2023-09-12 09:57:34
合計ジャッジ時間 8,683 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 91 ms
76,136 KB
testcase_01 AC 92 ms
71,596 KB
testcase_02 AC 90 ms
71,764 KB
testcase_03 AC 91 ms
71,864 KB
testcase_04 AC 91 ms
71,640 KB
testcase_05 AC 91 ms
71,740 KB
testcase_06 AC 93 ms
71,636 KB
testcase_07 AC 99 ms
77,224 KB
testcase_08 AC 92 ms
71,744 KB
testcase_09 AC 92 ms
71,908 KB
testcase_10 AC 106 ms
77,752 KB
testcase_11 AC 117 ms
78,080 KB
testcase_12 AC 107 ms
77,988 KB
testcase_13 AC 102 ms
77,764 KB
testcase_14 AC 122 ms
77,844 KB
testcase_15 AC 123 ms
77,880 KB
testcase_16 AC 114 ms
78,000 KB
testcase_17 AC 133 ms
78,196 KB
testcase_18 AC 154 ms
78,176 KB
testcase_19 AC 146 ms
78,144 KB
testcase_20 AC 198 ms
78,880 KB
testcase_21 AC 218 ms
79,292 KB
testcase_22 AC 181 ms
78,832 KB
testcase_23 AC 160 ms
78,348 KB
testcase_24 AC 156 ms
78,160 KB
testcase_25 AC 132 ms
78,396 KB
testcase_26 AC 283 ms
79,640 KB
testcase_27 AC 195 ms
78,608 KB
testcase_28 AC 198 ms
78,648 KB
testcase_29 AC 254 ms
80,092 KB
testcase_30 TLE -
権限があれば一括ダウンロードができます

ソースコード

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