結果
問題 | No.2374 ASKT Subsequences |
ユーザー | tamato |
提出日時 | 2023-07-07 22:22:02 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 724 bytes |
コンパイル時間 | 483 ms |
コンパイル使用メモリ | 86,952 KB |
実行使用メモリ | 77,956 KB |
最終ジャッジ日時 | 2023-09-28 23:47:09 |
合計ジャッジ時間 | 5,316 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 75 ms
71,104 KB |
testcase_01 | AC | 78 ms
71,116 KB |
testcase_02 | AC | 75 ms
71,200 KB |
testcase_03 | AC | 76 ms
71,196 KB |
testcase_04 | WA | - |
testcase_05 | AC | 77 ms
71,484 KB |
testcase_06 | AC | 75 ms
71,324 KB |
testcase_07 | WA | - |
testcase_08 | AC | 76 ms
71,200 KB |
testcase_09 | WA | - |
testcase_10 | AC | 93 ms
76,004 KB |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | AC | 107 ms
76,936 KB |
testcase_26 | WA | - |
testcase_27 | AC | 161 ms
77,760 KB |
testcase_28 | WA | - |
testcase_29 | WA | - |
testcase_30 | WA | - |
ソースコード
import sys input = sys.stdin.readline mod = 998244353 N = int(input()) A = list(map(int, input().split())) ans = 0 for i in range(N): prev = [0] * 2001 X = [0] * 2001 S = [0] * 2001 B = [0] * N for j in range(i+1, N): if A[j] == A[i] + 10: B[j] = B[j - 1] + 1 else: B[j] = B[j - 1] if A[j] > A[i] + 11: b = B[prev[A[j] - 1]] prev[A[j] - 1] = B[j] S[A[j] - 1] += X[A[j] - 1] * (B[j] - b) ans += S[A[j] - 1] S[A[j] - 1] = 0 if A[j] > A[i] + 10: b = B[prev[A[j]]] prev[A[j]] = B[j] S[A[j]] += X[A[j]] * (B[j] - b) X[A[j]] += 1 print(ans)