結果

問題 No.2219 Re:010
ユーザー behoma8behoma8
提出日時 2023-03-07 17:31:07
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 458 bytes
コンパイル時間 912 ms
コンパイル使用メモリ 11,928 KB
実行使用メモリ 20,348 KB
最終ジャッジ日時 2023-10-18 05:33:35
合計ジャッジ時間 25,706 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
20,348 KB
testcase_01 AC 29 ms
9,988 KB
testcase_02 AC 30 ms
9,988 KB
testcase_03 AC 1,764 ms
10,196 KB
testcase_04 AC 72 ms
10,032 KB
testcase_05 AC 1,124 ms
10,232 KB
testcase_06 AC 130 ms
10,064 KB
testcase_07 AC 462 ms
10,156 KB
testcase_08 AC 1,549 ms
10,360 KB
testcase_09 AC 1,448 ms
10,176 KB
testcase_10 AC 884 ms
10,228 KB
testcase_11 AC 636 ms
10,192 KB
testcase_12 AC 654 ms
10,192 KB
testcase_13 TLE -
testcase_14 TLE -
testcase_15 TLE -
testcase_16 TLE -
testcase_17 TLE -
testcase_18 AC 151 ms
10,360 KB
testcase_19 AC 140 ms
10,360 KB
testcase_20 TLE -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

S = input()
MOD = 998244353
p = 1
N = len(S)
d0, d1, d2 = 0, 0, 0
e0, e1, e2 = 0, 0, 0
for i in range(N):
    if S[i] == '0':
        e0 = ( d0 + p ) % MOD
        e1 = d1
        e2 = ( d2 + d1 ) % MOD
    elif S[i] == '1':
        e0 = d0
        e1 = ( d1 + d0 ) % MOD
        e2 = d2
    else:
        e0 = ( 2 * d0 + p ) % MOD
        e1 = ( 2 * d1 + d0 ) % MOD
        e2 = ( 2 * d2 + d1 ) % MOD
        p *= 2
    d0, d1, d2 = e0, e1, e2

print( d2 )
0