結果

問題 No.2279 OR Insertion
ユーザー jianglyjiangly
提出日時 2023-04-21 21:46:18
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 338 ms / 2,000 ms
コード長 408 bytes
コンパイル時間 152 ms
コンパイル使用メモリ 82,560 KB
実行使用メモリ 77,312 KB
最終ジャッジ日時 2024-04-24 07:56:17
合計ジャッジ時間 10,350 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
51,712 KB
testcase_01 AC 42 ms
52,480 KB
testcase_02 AC 103 ms
75,904 KB
testcase_03 AC 72 ms
76,032 KB
testcase_04 AC 311 ms
76,800 KB
testcase_05 AC 55 ms
65,024 KB
testcase_06 AC 157 ms
75,904 KB
testcase_07 AC 166 ms
76,288 KB
testcase_08 AC 96 ms
76,288 KB
testcase_09 AC 212 ms
76,544 KB
testcase_10 AC 288 ms
76,928 KB
testcase_11 AC 85 ms
75,904 KB
testcase_12 AC 241 ms
76,544 KB
testcase_13 AC 64 ms
71,936 KB
testcase_14 AC 69 ms
73,728 KB
testcase_15 AC 177 ms
76,160 KB
testcase_16 AC 54 ms
63,104 KB
testcase_17 AC 156 ms
76,288 KB
testcase_18 AC 226 ms
76,160 KB
testcase_19 AC 282 ms
77,056 KB
testcase_20 AC 172 ms
76,032 KB
testcase_21 AC 138 ms
76,288 KB
testcase_22 AC 37 ms
51,712 KB
testcase_23 AC 38 ms
51,840 KB
testcase_24 AC 36 ms
52,224 KB
testcase_25 AC 37 ms
51,584 KB
testcase_26 AC 37 ms
51,584 KB
testcase_27 AC 37 ms
51,712 KB
testcase_28 AC 38 ms
51,712 KB
testcase_29 AC 37 ms
52,096 KB
testcase_30 AC 36 ms
52,096 KB
testcase_31 AC 37 ms
51,456 KB
testcase_32 AC 328 ms
77,184 KB
testcase_33 AC 335 ms
76,928 KB
testcase_34 AC 313 ms
77,056 KB
testcase_35 AC 334 ms
77,312 KB
testcase_36 AC 319 ms
76,928 KB
testcase_37 AC 313 ms
76,800 KB
testcase_38 AC 319 ms
76,800 KB
testcase_39 AC 322 ms
77,184 KB
testcase_40 AC 308 ms
77,184 KB
testcase_41 AC 338 ms
77,056 KB
testcase_42 AC 330 ms
76,928 KB
testcase_43 AC 310 ms
76,928 KB
testcase_44 AC 314 ms
77,184 KB
testcase_45 AC 258 ms
77,184 KB
testcase_46 AC 251 ms
77,056 KB
testcase_47 AC 249 ms
77,312 KB
testcase_48 AC 302 ms
77,056 KB
testcase_49 AC 240 ms
76,928 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
S = input()
P = 998244353

pw = 1
ans = 0
tot = pow(2, N-1, P)
for k in range(N) :
    dp = [0] * (N+1)
    s = [0] * (N+1)
    dp[0] = 1
    for i in range(N) :
        s[i+1] = (s[i] + dp[i]) % P
        dp[i+1] = s[i+1]
        if i - k >= 0 and S[i-k] == '1' :
            dp[i+1] = (dp[i+1] - s[i-k+1] + P) % P
    ans = (ans + (tot - dp[N] + P) * pw) % P
    pw = 2 * pw % P
print(ans)
0