結果
| 問題 | No.2219 Re:010 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-02-17 21:48:06 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 73 ms / 2,000 ms |
| + 735µs | |
| コード長 | 299 bytes |
| 記録 | |
| コンパイル時間 | 258 ms |
| コンパイル使用メモリ | 95,600 KB |
| 実行使用メモリ | 83,584 KB |
| 最終ジャッジ日時 | 2026-08-18 15:40:40 |
| 合計ジャッジ時間 | 4,078 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 |
ソースコード
s=input()
M=998244353
key=pow(2,s.count("?")-3,M)
nex=s.count("?")+s.count("0")*2
pre=0
ans=0
for i in range(len(s)):
if s[i]=="0":
pre+=2
nex-=2
elif s[i]=="?":
nex-=1
ans+=(key*pre*nex)%M
pre+=1
else:
ans+=(key*2*pre*nex)%M
print(ans%M)