結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
59,488 KB
testcase_01 AC 42 ms
52,560 KB
testcase_02 AC 38 ms
52,196 KB
testcase_03 AC 37 ms
53,436 KB
testcase_04 AC 38 ms
52,200 KB
testcase_05 AC 38 ms
52,596 KB
testcase_06 AC 38 ms
53,156 KB
testcase_07 AC 37 ms
52,896 KB
testcase_08 AC 38 ms
52,960 KB
testcase_09 AC 38 ms
53,532 KB
testcase_10 AC 44 ms
60,244 KB
testcase_11 AC 52 ms
65,568 KB
testcase_12 AC 51 ms
62,876 KB
testcase_13 AC 46 ms
61,428 KB
testcase_14 AC 84 ms
76,192 KB
testcase_15 AC 64 ms
72,732 KB
testcase_16 AC 65 ms
70,788 KB
testcase_17 AC 83 ms
76,364 KB
testcase_18 AC 91 ms
75,968 KB
testcase_19 AC 98 ms
76,260 KB
testcase_20 AC 99 ms
76,312 KB
testcase_21 AC 115 ms
76,316 KB
testcase_22 AC 91 ms
76,196 KB
testcase_23 AC 80 ms
75,552 KB
testcase_24 AC 90 ms
75,972 KB
testcase_25 TLE -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

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