結果

問題 No.2279 OR Insertion
ユーザー ああいいああいい
提出日時 2023-04-29 11:58:19
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 420 ms / 2,000 ms
コード長 514 bytes
コンパイル時間 179 ms
コンパイル使用メモリ 81,920 KB
実行使用メモリ 77,476 KB
最終ジャッジ日時 2024-04-29 07:58:56
合計ジャッジ時間 13,152 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
51,968 KB
testcase_01 AC 39 ms
52,608 KB
testcase_02 AC 113 ms
76,032 KB
testcase_03 AC 84 ms
76,312 KB
testcase_04 AC 385 ms
77,124 KB
testcase_05 AC 62 ms
67,200 KB
testcase_06 AC 195 ms
76,288 KB
testcase_07 AC 204 ms
76,544 KB
testcase_08 AC 113 ms
76,160 KB
testcase_09 AC 246 ms
76,544 KB
testcase_10 AC 361 ms
76,800 KB
testcase_11 AC 101 ms
76,032 KB
testcase_12 AC 299 ms
76,544 KB
testcase_13 AC 80 ms
76,160 KB
testcase_14 AC 88 ms
75,904 KB
testcase_15 AC 217 ms
76,672 KB
testcase_16 AC 55 ms
64,640 KB
testcase_17 AC 193 ms
76,208 KB
testcase_18 AC 278 ms
76,672 KB
testcase_19 AC 339 ms
76,672 KB
testcase_20 AC 210 ms
76,416 KB
testcase_21 AC 174 ms
76,264 KB
testcase_22 AC 40 ms
51,584 KB
testcase_23 AC 40 ms
51,584 KB
testcase_24 AC 40 ms
52,096 KB
testcase_25 AC 41 ms
51,840 KB
testcase_26 AC 40 ms
52,096 KB
testcase_27 AC 40 ms
51,584 KB
testcase_28 AC 40 ms
51,968 KB
testcase_29 AC 39 ms
51,968 KB
testcase_30 AC 40 ms
51,840 KB
testcase_31 AC 39 ms
51,584 KB
testcase_32 AC 413 ms
77,332 KB
testcase_33 AC 410 ms
77,324 KB
testcase_34 AC 414 ms
77,216 KB
testcase_35 AC 407 ms
77,476 KB
testcase_36 AC 412 ms
77,420 KB
testcase_37 AC 407 ms
77,328 KB
testcase_38 AC 402 ms
77,184 KB
testcase_39 AC 406 ms
77,316 KB
testcase_40 AC 420 ms
77,092 KB
testcase_41 AC 406 ms
77,056 KB
testcase_42 AC 400 ms
77,056 KB
testcase_43 AC 389 ms
77,188 KB
testcase_44 AC 391 ms
77,176 KB
testcase_45 AC 382 ms
77,364 KB
testcase_46 AC 382 ms
77,208 KB
testcase_47 AC 385 ms
77,300 KB
testcase_48 AC 381 ms
77,440 KB
testcase_49 AC 366 ms
77,112 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

K = pow(2,N - 1,P)
ans = 0
for i in range(1,N + 1):
    dp = [0] * (N + 2)
    U = [0] * (N + 2)
    dp[0] = 1

    for j in range(N + 1):
        if j > 0:
            U [j] += U[j-1]
            U[j] %= P
            dp[j] = U[j]
        if i + j <= N and S[-(i+j)] == "1":
            U[i + j] -= dp[j]
        U[j + 1] += dp[j]
        U[j + 1] %= P
        #print(dp[j])
    last = U[-1]
    ans += pow(2,i-1,P) * (pow(2,N -1,P) - last) % P
print(ans % P)
        
0