結果

問題 No.2524 Stripes
ユーザー MasKoaTSMasKoaTS
提出日時 2023-09-27 11:27:10
言語 PyPy3
(7.3.15)
結果
MLE  
実行時間 -
コード長 544 bytes
コンパイル時間 1,137 ms
コンパイル使用メモリ 86,928 KB
実行使用メモリ 836,064 KB
最終ジャッジ日時 2023-09-27 11:27:18
合計ジャッジ時間 5,751 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,120 KB
testcase_01 AC 72 ms
71,224 KB
testcase_02 AC 74 ms
71,120 KB
testcase_03 MLE -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

# 愚直

import sys
input = sys.stdin.readline
MOD = 998244353

n = int(input())
s = [int(c == 'R') for c in input()[:-1]]

dp = [[[0] * 2 for _ in [0] * (n + 1)] for _ in [0] * n]
for i in range(n):
    dp[i][0][0] = dp[i][0][1] = 1
dp[0][1][s[0]] = 1
for i in range(1, n):
    for j in range(1, n + 1):
        for k in range(2):
            dp[i][j][k] += dp[i - 1][j][k]
            if(s[i] == k):
                dp[i][j][k] += dp[i - 1][j - 1][k ^ 1]
            dp[i][j][k] %= MOD
for j in range(1, n + 1):
    print(sum(dp[n - 1][j]))
0