結果

問題 No.2433 Min Increasing Sequence
ユーザー minimumminimum
提出日時 2023-08-18 22:18:09
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 146 ms / 2,000 ms
コード長 328 bytes
コンパイル時間 2,180 ms
コンパイル使用メモリ 86,692 KB
実行使用メモリ 104,248 KB
最終ジャッジ日時 2023-08-18 22:18:18
合計ジャッジ時間 6,396 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 65 ms
71,152 KB
testcase_01 AC 66 ms
71,456 KB
testcase_02 AC 68 ms
71,244 KB
testcase_03 AC 69 ms
71,480 KB
testcase_04 AC 130 ms
100,412 KB
testcase_05 AC 94 ms
91,548 KB
testcase_06 AC 132 ms
101,732 KB
testcase_07 AC 97 ms
93,792 KB
testcase_08 AC 118 ms
100,276 KB
testcase_09 AC 134 ms
98,860 KB
testcase_10 AC 90 ms
86,216 KB
testcase_11 AC 101 ms
93,280 KB
testcase_12 AC 84 ms
84,880 KB
testcase_13 AC 84 ms
82,688 KB
testcase_14 AC 103 ms
96,316 KB
testcase_15 AC 84 ms
82,720 KB
testcase_16 AC 87 ms
86,168 KB
testcase_17 AC 82 ms
82,444 KB
testcase_18 AC 128 ms
101,660 KB
testcase_19 AC 146 ms
100,332 KB
testcase_20 AC 74 ms
76,540 KB
testcase_21 AC 111 ms
104,248 KB
testcase_22 AC 124 ms
101,564 KB
testcase_23 AC 110 ms
101,948 KB
testcase_24 AC 124 ms
99,952 KB
testcase_25 AC 122 ms
99,620 KB
testcase_26 AC 109 ms
98,720 KB
testcase_27 AC 113 ms
104,220 KB
testcase_28 AC 110 ms
101,872 KB
testcase_29 AC 100 ms
79,456 KB
testcase_30 AC 79 ms
79,288 KB
testcase_31 AC 77 ms
77,636 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