結果

問題 No.2279 OR Insertion
ユーザー miscalcmiscalc
提出日時 2023-04-21 11:26:49
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 333 bytes
コンパイル時間 238 ms
コンパイル使用メモリ 82,384 KB
実行使用メモリ 277,068 KB
最終ジャッジ日時 2024-04-24 01:10:21
合計ジャッジ時間 23,050 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
57,728 KB
testcase_01 AC 39 ms
52,224 KB
testcase_02 AC 236 ms
79,360 KB
testcase_03 AC 134 ms
76,628 KB
testcase_04 TLE -
testcase_05 AC 79 ms
76,032 KB
testcase_06 AC 785 ms
111,640 KB
testcase_07 AC 872 ms
120,124 KB
testcase_08 AC 250 ms
79,616 KB
testcase_09 AC 1,240 ms
157,508 KB
testcase_10 TLE -
testcase_11 AC 205 ms
77,952 KB
testcase_12 AC 1,814 ms
231,296 KB
testcase_13 AC 112 ms
76,416 KB
testcase_14 AC 125 ms
76,672 KB
testcase_15 AC 972 ms
129,024 KB
testcase_16 AC 64 ms
74,240 KB
testcase_17 AC 759 ms
110,080 KB
testcase_18 AC 1,513 ms
189,568 KB
testcase_19 TLE -
testcase_20 AC 890 ms
121,020 KB
testcase_21 AC 607 ms
98,048 KB
testcase_22 AC 39 ms
51,968 KB
testcase_23 AC 38 ms
51,968 KB
testcase_24 AC 39 ms
51,968 KB
testcase_25 AC 38 ms
51,840 KB
testcase_26 AC 39 ms
52,352 KB
testcase_27 AC 38 ms
51,712 KB
testcase_28 AC 38 ms
51,456 KB
testcase_29 AC 38 ms
51,840 KB
testcase_30 AC 40 ms
51,840 KB
testcase_31 AC 38 ms
51,840 KB
testcase_32 TLE -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
testcase_48 -- -
testcase_49 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

MOD = 998244353

n = int(input())
s = input()

ans = 0
dp = [0] * (n + 1)
for k in range(n):
  dp[0] = 1
  for i in range(n):
    if i - k < 0 or s[i - k] == '0':
      dp[i + 1] = 2 * dp[i]
    else:
      dp[i + 1] = 2 * dp[i] - dp[i - k]
  ans += (pow(2, n - 1, MOD) - (dp[n] - dp[n - 1])) * pow(2, k, MOD)
  ans %= MOD
print(ans)
0