結果

問題 No.2279 OR Insertion
ユーザー 👑 p-adicp-adic
提出日時 2023-07-16 16:13:06
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 653 ms / 2,000 ms
コード長 313 bytes
コンパイル時間 265 ms
コンパイル使用メモリ 81,684 KB
実行使用メモリ 201,400 KB
最終ジャッジ日時 2023-10-17 14:59:01
合計ジャッジ時間 18,262 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
53,468 KB
testcase_01 AC 35 ms
53,468 KB
testcase_02 AC 117 ms
90,516 KB
testcase_03 AC 86 ms
82,148 KB
testcase_04 AC 567 ms
189,212 KB
testcase_05 AC 60 ms
70,500 KB
testcase_06 AC 238 ms
120,716 KB
testcase_07 AC 256 ms
125,308 KB
testcase_08 AC 122 ms
91,200 KB
testcase_09 AC 330 ms
140,816 KB
testcase_10 AC 542 ms
185,988 KB
testcase_11 AC 108 ms
88,072 KB
testcase_12 AC 430 ms
161,976 KB
testcase_13 AC 78 ms
80,252 KB
testcase_14 AC 85 ms
81,772 KB
testcase_15 AC 276 ms
129,704 KB
testcase_16 AC 52 ms
66,312 KB
testcase_17 AC 238 ms
119,748 KB
testcase_18 AC 383 ms
151,056 KB
testcase_19 AC 483 ms
174,636 KB
testcase_20 AC 256 ms
125,708 KB
testcase_21 AC 204 ms
112,140 KB
testcase_22 AC 36 ms
53,468 KB
testcase_23 AC 34 ms
53,468 KB
testcase_24 AC 36 ms
53,468 KB
testcase_25 AC 35 ms
53,468 KB
testcase_26 AC 35 ms
53,468 KB
testcase_27 AC 36 ms
53,468 KB
testcase_28 AC 35 ms
53,468 KB
testcase_29 AC 35 ms
53,468 KB
testcase_30 AC 35 ms
53,468 KB
testcase_31 AC 35 ms
53,468 KB
testcase_32 AC 636 ms
201,252 KB
testcase_33 AC 632 ms
201,248 KB
testcase_34 AC 626 ms
201,244 KB
testcase_35 AC 635 ms
201,248 KB
testcase_36 AC 625 ms
201,308 KB
testcase_37 AC 634 ms
201,248 KB
testcase_38 AC 623 ms
201,400 KB
testcase_39 AC 653 ms
201,252 KB
testcase_40 AC 622 ms
201,312 KB
testcase_41 AC 623 ms
201,316 KB
testcase_42 AC 599 ms
201,168 KB
testcase_43 AC 607 ms
201,164 KB
testcase_44 AC 615 ms
201,244 KB
testcase_45 AC 631 ms
201,104 KB
testcase_46 AC 636 ms
201,112 KB
testcase_47 AC 631 ms
201,104 KB
testcase_48 AC 585 ms
201,080 KB
testcase_49 AC 604 ms
201,020 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

I,R=input,range
N=int(I())
A=[[0]*N for i in R(N+1)]
B=[0]*N
S=I()
P=998244353
p=[pow(2,i,P)for i in R(N)]
for i in R(1,N+1):
	s=S[N-i]>"0"
	for j in R(i):A[i][j]=B[j]=(B[j]+(S[N-i]>"0" and j>0)*(p[max(0,i-j-2)]-A[i-j-1][j])+[A[i-1][j],p[max(0,i-2)]][1>j and S[N-i]>"0"])%P
print(sum(p[j]*A[N][j]for j in R(N))%P)
0