結果
問題 | No.2524 Stripes |
ユーザー | Shirotsume |
提出日時 | 2023-09-27 13:03:11 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 567 bytes |
コンパイル時間 | 318 ms |
コンパイル使用メモリ | 86,760 KB |
実行使用メモリ | 715,952 KB |
最終ジャッジ日時 | 2023-09-27 13:03:22 |
合計ジャッジ時間 | 8,643 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 65 ms
71,340 KB |
testcase_01 | AC | 60 ms
71,368 KB |
testcase_02 | AC | 60 ms
71,068 KB |
testcase_03 | WA | - |
testcase_04 | MLE | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | MLE | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | AC | 61 ms
71,344 KB |
testcase_19 | AC | 75 ms
71,164 KB |
testcase_20 | AC | 59 ms
71,396 KB |
testcase_21 | AC | 62 ms
71,080 KB |
testcase_22 | AC | 61 ms
71,092 KB |
testcase_23 | AC | 63 ms
71,088 KB |
testcase_24 | AC | 63 ms
70,932 KB |
testcase_25 | AC | 64 ms
71,300 KB |
testcase_26 | AC | 62 ms
71,400 KB |
testcase_27 | AC | 62 ms
71,036 KB |
ソースコード
# 愚直 import sys input = sys.stdin.readline MOD = 998244353 n = int(input()) if n >= 10000: exit() 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]))