結果

問題 No.2279 OR Insertion
ユーザー ああいいああいい
提出日時 2023-04-29 11:56:58
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 477 bytes
コンパイル時間 163 ms
コンパイル使用メモリ 82,436 KB
実行使用メモリ 270,560 KB
最終ジャッジ日時 2024-04-29 07:58:30
合計ジャッジ時間 23,926 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
60,240 KB
testcase_01 AC 40 ms
52,556 KB
testcase_02 AC 253 ms
81,872 KB
testcase_03 AC 143 ms
76,928 KB
testcase_04 TLE -
testcase_05 AC 88 ms
76,292 KB
testcase_06 AC 803 ms
129,128 KB
testcase_07 AC 898 ms
142,352 KB
testcase_08 AC 286 ms
81,872 KB
testcase_09 AC 1,220 ms
195,008 KB
testcase_10 TLE -
testcase_11 AC 236 ms
79,760 KB
testcase_12 AC 1,695 ms
267,332 KB
testcase_13 AC 128 ms
77,052 KB
testcase_14 AC 145 ms
77,044 KB
testcase_15 AC 980 ms
156,392 KB
testcase_16 AC 81 ms
76,004 KB
testcase_17 AC 818 ms
128,000 KB
testcase_18 AC 1,537 ms
241,664 KB
testcase_19 TLE -
testcase_20 AC 958 ms
144,660 KB
testcase_21 AC 656 ms
109,472 KB
testcase_22 AC 41 ms
52,608 KB
testcase_23 AC 40 ms
52,560 KB
testcase_24 AC 40 ms
53,048 KB
testcase_25 AC 39 ms
51,952 KB
testcase_26 AC 40 ms
52,672 KB
testcase_27 AC 43 ms
52,748 KB
testcase_28 AC 39 ms
52,880 KB
testcase_29 AC 40 ms
52,692 KB
testcase_30 AC 39 ms
53,164 KB
testcase_31 AC 39 ms
52,888 KB
testcase_32 TLE -
testcase_33 TLE -
testcase_34 TLE -
testcase_35 TLE -
testcase_36 TLE -
testcase_37 TLE -
testcase_38 TLE -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
testcase_48 -- -
testcase_49 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

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]
            dp[j] = U[j]
        if i + j <= N and S[-(i+j)] == "1":
            U[i + j] -= dp[j]
        if j < N + 1:
            U[j + 1] += dp[j]
        #print(dp[j])
    last = U[-1]
    ans += pow(2,i-1,P) * (pow(2,N -1,P) - last) % P
print(ans % P)
        
0