結果

問題 No.2219 Re:010
ユーザー 👑 p-adicp-adic
提出日時 2023-06-01 10:54:31
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 376 ms / 2,000 ms
コード長 224 bytes
コンパイル時間 89 ms
コンパイル使用メモリ 10,700 KB
実行使用メモリ 8,452 KB
最終ジャッジ日時 2023-08-28 01:56:19
合計ジャッジ時間 5,213 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,752 KB
testcase_01 AC 17 ms
7,852 KB
testcase_02 AC 17 ms
7,752 KB
testcase_03 AC 256 ms
8,244 KB
testcase_04 AC 45 ms
7,812 KB
testcase_05 AC 214 ms
8,216 KB
testcase_06 AC 67 ms
8,060 KB
testcase_07 AC 130 ms
8,128 KB
testcase_08 AC 245 ms
8,332 KB
testcase_09 AC 237 ms
8,284 KB
testcase_10 AC 186 ms
8,208 KB
testcase_11 AC 156 ms
8,136 KB
testcase_12 AC 155 ms
8,188 KB
testcase_13 AC 295 ms
8,320 KB
testcase_14 AC 295 ms
8,300 KB
testcase_15 AC 303 ms
8,364 KB
testcase_16 AC 292 ms
8,316 KB
testcase_17 AC 301 ms
8,264 KB
testcase_18 AC 108 ms
8,416 KB
testcase_19 AC 294 ms
8,452 KB
testcase_20 AC 376 ms
8,372 KB
testcase_21 AC 14 ms
7,896 KB
testcase_22 AC 14 ms
7,808 KB
testcase_23 AC 15 ms
7,812 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

S=input()
P=998244353
Q=(P+1)//2
Z=H=z=h=a=0
for s in S:
	Z+=s<'1'
	H+=s>'1'
p=1
R=q=pow(2,H,P)
for s in S:
	b=s>'1'
	if s<'1':z+=1
	else:a,h,p,q=a+(z+h*Q)*R*[1,Q][b]*((Z-z)+(H-h-b)*Q)%P,h+b,p*(1+b)%P,q*[1,Q][b]%P
print(a%P)
0