結果

問題 No.2219 Re:010
ユーザー hiryuNhiryuN
提出日時 2023-02-17 21:48:06
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 86 ms / 2,000 ms
コード長 299 bytes
コンパイル時間 1,005 ms
コンパイル使用メモリ 86,472 KB
実行使用メモリ 76,252 KB
最終ジャッジ日時 2023-09-26 19:04:14
合計ジャッジ時間 4,562 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
70,996 KB
testcase_01 AC 71 ms
71,008 KB
testcase_02 AC 71 ms
71,092 KB
testcase_03 AC 86 ms
76,164 KB
testcase_04 AC 78 ms
75,600 KB
testcase_05 AC 79 ms
75,536 KB
testcase_06 AC 77 ms
75,880 KB
testcase_07 AC 78 ms
75,584 KB
testcase_08 AC 82 ms
75,776 KB
testcase_09 AC 84 ms
75,880 KB
testcase_10 AC 79 ms
75,588 KB
testcase_11 AC 79 ms
75,632 KB
testcase_12 AC 80 ms
75,524 KB
testcase_13 AC 82 ms
76,180 KB
testcase_14 AC 83 ms
76,076 KB
testcase_15 AC 83 ms
76,060 KB
testcase_16 AC 85 ms
75,848 KB
testcase_17 AC 82 ms
76,252 KB
testcase_18 AC 75 ms
75,980 KB
testcase_19 AC 77 ms
75,784 KB
testcase_20 AC 80 ms
75,860 KB
testcase_21 AC 68 ms
71,180 KB
testcase_22 AC 70 ms
70,956 KB
testcase_23 AC 70 ms
70,908 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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)
0