結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 68 ms
71,392 KB
testcase_01 AC 68 ms
71,520 KB
testcase_02 AC 69 ms
71,184 KB
testcase_03 TLE -
testcase_04 AC 115 ms
77,864 KB
testcase_05 AC 1,393 ms
83,108 KB
testcase_06 AC 176 ms
78,584 KB
testcase_07 AC 569 ms
80,508 KB
testcase_08 AC 1,905 ms
84,636 KB
testcase_09 AC 1,767 ms
84,364 KB
testcase_10 AC 1,073 ms
82,440 KB
testcase_11 AC 768 ms
81,004 KB
testcase_12 AC 782 ms
81,404 KB
testcase_13 TLE -
testcase_14 TLE -
testcase_15 TLE -
testcase_16 TLE -
testcase_17 TLE -
testcase_18 AC 96 ms
86,484 KB
testcase_19 AC 92 ms
86,364 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