結果

問題 No.2433 Min Increasing Sequence
ユーザー minimumminimum
提出日時 2023-08-18 22:18:09
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 108 ms / 2,000 ms
コード長 328 bytes
コンパイル時間 496 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 107,648 KB
最終ジャッジ日時 2024-05-06 04:29:00
合計ジャッジ時間 4,700 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
51,712 KB
testcase_01 AC 38 ms
51,840 KB
testcase_02 AC 37 ms
51,968 KB
testcase_03 AC 37 ms
51,712 KB
testcase_04 AC 103 ms
102,016 KB
testcase_05 AC 77 ms
90,240 KB
testcase_06 AC 88 ms
101,248 KB
testcase_07 AC 78 ms
92,288 KB
testcase_08 AC 96 ms
104,576 KB
testcase_09 AC 84 ms
97,920 KB
testcase_10 AC 67 ms
81,024 KB
testcase_11 AC 84 ms
92,160 KB
testcase_12 AC 67 ms
79,104 KB
testcase_13 AC 64 ms
74,624 KB
testcase_14 AC 90 ms
94,976 KB
testcase_15 AC 66 ms
75,264 KB
testcase_16 AC 71 ms
80,768 KB
testcase_17 AC 63 ms
74,624 KB
testcase_18 AC 106 ms
107,392 KB
testcase_19 AC 105 ms
107,136 KB
testcase_20 AC 48 ms
62,464 KB
testcase_21 AC 95 ms
104,192 KB
testcase_22 AC 108 ms
107,648 KB
testcase_23 AC 92 ms
101,120 KB
testcase_24 AC 106 ms
107,264 KB
testcase_25 AC 103 ms
103,936 KB
testcase_26 AC 91 ms
97,280 KB
testcase_27 AC 102 ms
103,680 KB
testcase_28 AC 92 ms
100,608 KB
testcase_29 AC 55 ms
68,736 KB
testcase_30 AC 59 ms
68,352 KB
testcase_31 AC 53 ms
66,048 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

dp = [0, 1]
m = A[0]
for i in range(1, N):
    ndp = [0, 0]
    ndp[0] = dp[0] + dp[1]
    ndp[1] = dp[1]
    if m >= A[i]:
        m = A[i]
        ndp[1] += ndp[0]
        ndp[0] = 0
    dp = ndp
    dp[0] %= MOD
    dp[1] %= MOD

print(dp[1])
0