結果

問題 No.2219 Re:010
ユーザー ikomaikoma
提出日時 2023-02-17 23:42:00
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 353 bytes
コンパイル時間 363 ms
コンパイル使用メモリ 87,088 KB
実行使用メモリ 86,676 KB
最終ジャッジ日時 2023-09-26 21:02:30
合計ジャッジ時間 30,087 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
75,700 KB
testcase_01 AC 73 ms
71,592 KB
testcase_02 AC 69 ms
71,324 KB
testcase_03 TLE -
testcase_04 AC 111 ms
78,088 KB
testcase_05 AC 1,361 ms
83,308 KB
testcase_06 AC 169 ms
78,780 KB
testcase_07 AC 552 ms
80,484 KB
testcase_08 AC 1,871 ms
84,740 KB
testcase_09 AC 1,757 ms
84,364 KB
testcase_10 AC 1,065 ms
82,396 KB
testcase_11 AC 754 ms
81,540 KB
testcase_12 AC 802 ms
81,440 KB
testcase_13 TLE -
testcase_14 TLE -
testcase_15 TLE -
testcase_16 TLE -
testcase_17 TLE -
testcase_18 AC 97 ms
86,600 KB
testcase_19 AC 95 ms
86,536 KB
testcase_20 TLE -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
MOD=998244353
S=list(input().strip())
dp = [0]*3
x=1
for s in S:
    if s=="0":
        dp[2]+=dp[1]
        dp[0]+=x
    elif s=="1":
        dp[1]+=dp[0]
    else:
        dp[2]=dp[2]*2+dp[1]
        dp[1]=dp[1]*2+dp[0]
        dp[0]=dp[0]*2+x
        x*=2
    for i in range(3):
        dp[i]%=MOD

print(dp[-1])
0