結果

問題 No.2374 ASKT Subsequences
ユーザー minimumminimum
提出日時 2023-07-07 22:01:57
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 220 ms / 2,000 ms
コード長 489 bytes
コンパイル時間 330 ms
コンパイル使用メモリ 87,252 KB
実行使用メモリ 109,080 KB
最終ジャッジ日時 2023-09-28 23:16:48
合計ジャッジ時間 5,530 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 92 ms
91,992 KB
testcase_01 AC 90 ms
91,912 KB
testcase_02 AC 91 ms
92,108 KB
testcase_03 AC 90 ms
91,864 KB
testcase_04 AC 90 ms
91,928 KB
testcase_05 AC 90 ms
91,944 KB
testcase_06 AC 91 ms
92,116 KB
testcase_07 AC 91 ms
91,988 KB
testcase_08 AC 95 ms
91,860 KB
testcase_09 AC 92 ms
91,932 KB
testcase_10 AC 100 ms
92,752 KB
testcase_11 AC 121 ms
108,636 KB
testcase_12 AC 104 ms
92,788 KB
testcase_13 AC 99 ms
92,660 KB
testcase_14 AC 122 ms
108,464 KB
testcase_15 AC 123 ms
108,572 KB
testcase_16 AC 124 ms
108,576 KB
testcase_17 AC 129 ms
108,744 KB
testcase_18 AC 139 ms
108,668 KB
testcase_19 AC 134 ms
108,580 KB
testcase_20 AC 170 ms
109,080 KB
testcase_21 AC 181 ms
108,776 KB
testcase_22 AC 161 ms
108,992 KB
testcase_23 AC 138 ms
108,584 KB
testcase_24 AC 140 ms
108,528 KB
testcase_25 AC 135 ms
108,972 KB
testcase_26 AC 220 ms
109,040 KB
testcase_27 AC 164 ms
108,996 KB
testcase_28 AC 156 ms
109,044 KB
testcase_29 AC 177 ms
108,788 KB
testcase_30 AC 155 ms
109,032 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

cnt = [[0] * M for _ in range(M)]

ans = 0
for i in range(N):
    for j in range(i + 1, N):
        a3 = A[i]
        a4 = A[j]
        k = a4 - a3 - 1
        if k <= 0:
            continue
        a2 = a3 + k
        a1 = a2 - (k + 10)
        if 1 <= a1 < M and 1 <= a2 < M:
            ans += cnt[a1][a2]
        # print(ans)
    for j in range(i):
        a1 = A[j]
        a2 = A[i]
        cnt[a1][a2] += 1

print(ans)
0