結果

問題 No.2055 12x34...
ユーザー gr1msl3ygr1msl3y
提出日時 2022-08-24 23:13:15
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 120 ms / 2,000 ms
コード長 340 bytes
コンパイル時間 289 ms
コンパイル使用メモリ 82,424 KB
実行使用メモリ 127,104 KB
最終ジャッジ日時 2024-04-20 12:01:29
合計ジャッジ時間 6,263 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
52,224 KB
testcase_01 AC 34 ms
51,584 KB
testcase_02 AC 51 ms
70,272 KB
testcase_03 AC 60 ms
83,968 KB
testcase_04 AC 69 ms
94,464 KB
testcase_05 AC 72 ms
98,304 KB
testcase_06 AC 69 ms
93,952 KB
testcase_07 AC 65 ms
86,656 KB
testcase_08 AC 57 ms
78,848 KB
testcase_09 AC 77 ms
100,604 KB
testcase_10 AC 81 ms
103,972 KB
testcase_11 AC 53 ms
76,672 KB
testcase_12 AC 82 ms
103,552 KB
testcase_13 AC 117 ms
127,104 KB
testcase_14 AC 67 ms
88,320 KB
testcase_15 AC 66 ms
88,064 KB
testcase_16 AC 116 ms
105,944 KB
testcase_17 AC 65 ms
87,936 KB
testcase_18 AC 89 ms
100,992 KB
testcase_19 AC 50 ms
71,808 KB
testcase_20 AC 46 ms
65,280 KB
testcase_21 AC 50 ms
72,224 KB
testcase_22 AC 110 ms
109,280 KB
testcase_23 AC 106 ms
108,672 KB
testcase_24 AC 119 ms
119,080 KB
testcase_25 AC 111 ms
112,692 KB
testcase_26 AC 113 ms
118,772 KB
testcase_27 AC 120 ms
118,756 KB
testcase_28 AC 116 ms
120,320 KB
testcase_29 AC 120 ms
115,072 KB
testcase_30 AC 114 ms
118,836 KB
testcase_31 AC 115 ms
120,448 KB
testcase_32 AC 115 ms
120,192 KB
testcase_33 AC 89 ms
104,876 KB
testcase_34 AC 85 ms
105,216 KB
testcase_35 AC 90 ms
104,832 KB
testcase_36 AC 86 ms
104,960 KB
testcase_37 AC 85 ms
104,880 KB
testcase_38 AC 88 ms
104,892 KB
testcase_39 AC 83 ms
105,088 KB
testcase_40 AC 85 ms
105,048 KB
testcase_41 AC 84 ms
104,832 KB
testcase_42 AC 84 ms
105,104 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

dp = {}
for a in A:
    if a in dp:
        dp[a] = (dp[a]+1) % MOD
    else:
        dp[a] = 1
    # if a+1 in dp:
    #     dp[a]=(dp[a+1]+dp[a])%MOD
    if a-1 in dp:
        dp[a] = (dp[a-1]+dp[a]) % MOD

ans = -N
for k in dp:
    ans = (ans+dp[k]) % MOD
print(ans)
0