結果

問題 No.2374 ASKT Subsequences
ユーザー 2000 Ekiben2000 Ekiben
提出日時 2023-07-07 22:21:59
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 798 bytes
コンパイル時間 270 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 80,512 KB
最終ジャッジ日時 2024-07-21 18:29:04
合計ジャッジ時間 5,770 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
57,600 KB
testcase_01 AC 38 ms
52,352 KB
testcase_02 AC 37 ms
51,840 KB
testcase_03 AC 39 ms
51,840 KB
testcase_04 AC 38 ms
52,096 KB
testcase_05 AC 38 ms
52,352 KB
testcase_06 AC 39 ms
52,096 KB
testcase_07 AC 38 ms
52,096 KB
testcase_08 AC 42 ms
52,224 KB
testcase_09 AC 38 ms
52,352 KB
testcase_10 AC 45 ms
59,008 KB
testcase_11 AC 53 ms
64,640 KB
testcase_12 AC 51 ms
62,208 KB
testcase_13 AC 47 ms
60,672 KB
testcase_14 AC 85 ms
76,252 KB
testcase_15 AC 66 ms
71,936 KB
testcase_16 AC 66 ms
70,528 KB
testcase_17 AC 84 ms
75,868 KB
testcase_18 AC 89 ms
75,904 KB
testcase_19 AC 98 ms
75,832 KB
testcase_20 AC 102 ms
76,248 KB
testcase_21 AC 117 ms
76,288 KB
testcase_22 AC 98 ms
76,160 KB
testcase_23 AC 82 ms
75,520 KB
testcase_24 AC 94 ms
75,800 KB
testcase_25 TLE -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import pypyjit
pypyjit.set_param('max_unroll_recursion=-1')
def count_asakatsu_subsequences(N, A):
    cnt = 0
    indices = {}
    for i, a in enumerate(A):
        if a not in indices:
            indices[a] = []
        indices[a].append(i)
    for i in range(N - 3):
        for j in range(i + 1, N - 2):
            k = A[j] - A[i] - 10
            if k > 0:
                m_values = indices.get(A[j] - k, [])
                for m in m_values:
                    if m > j:
                        n_values = indices.get(A[m] + k + 1, [])
                        for n in n_values:
                            if n > m:
                                cnt += 1
    return cnt

N = int(input())
A = list(map(int, input().split()))


result = count_asakatsu_subsequences(N, A)


print(result)
0