結果
| 問題 | No.2219 Re:010 | 
| コンテスト | |
| ユーザー |  titia | 
| 提出日時 | 2023-02-17 23:10:27 | 
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) | 
| 結果 | 
                                TLE
                                 
                             | 
| 実行時間 | - | 
| コード長 | 305 bytes | 
| コンパイル時間 | 515 ms | 
| コンパイル使用メモリ | 12,288 KB | 
| 実行使用メモリ | 17,952 KB | 
| 最終ジャッジ日時 | 2024-07-19 14:23:04 | 
| 合計ジャッジ時間 | 24,661 ms | 
| ジャッジサーバーID (参考情報) | judge3 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 12 TLE * 6 -- * 3 | 
ソースコード
import sys
input = sys.stdin.readline
S=input().strip()
mod=998244353
A=0
z=0
zo=0
q=1
for s in S:
    if s=="0":
        z+=1*q
        A+=zo
    elif s=="1":
        zo+=z
    else:
        A=A+A+zo
        zo=zo+zo+z
        z=z+z+1*q
        q*=2
        
    A%=mod
    z%=mod
    zo%=mod
print(A)
            
            
            
        