結果

問題 No.2926 Botaoshi
ユーザー achapiachapi
提出日時 2024-10-12 15:36:55
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 21 ms / 2,000 ms
コード長 589 bytes
コンパイル時間 4,012 ms
コンパイル使用メモリ 267,584 KB
実行使用メモリ 14,372 KB
最終ジャッジ日時 2024-10-12 15:37:01
合計ジャッジ時間 5,596 ms
ジャッジサーバーID
(参考情報)
judge / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 2 ms
6,820 KB
testcase_02 AC 2 ms
6,820 KB
testcase_03 AC 2 ms
6,816 KB
testcase_04 AC 2 ms
6,820 KB
testcase_05 AC 2 ms
6,816 KB
testcase_06 AC 1 ms
6,816 KB
testcase_07 AC 2 ms
6,816 KB
testcase_08 AC 2 ms
6,816 KB
testcase_09 AC 2 ms
6,820 KB
testcase_10 AC 2 ms
6,820 KB
testcase_11 AC 2 ms
6,820 KB
testcase_12 AC 21 ms
14,328 KB
testcase_13 AC 20 ms
14,116 KB
testcase_14 AC 20 ms
14,120 KB
testcase_15 AC 1 ms
6,820 KB
testcase_16 AC 18 ms
11,008 KB
testcase_17 AC 20 ms
12,948 KB
testcase_18 AC 5 ms
6,816 KB
testcase_19 AC 15 ms
9,600 KB
testcase_20 AC 7 ms
6,820 KB
testcase_21 AC 11 ms
8,320 KB
testcase_22 AC 12 ms
9,308 KB
testcase_23 AC 4 ms
6,820 KB
testcase_24 AC 14 ms
10,240 KB
testcase_25 AC 6 ms
6,816 KB
testcase_26 AC 17 ms
11,848 KB
testcase_27 AC 12 ms
8,448 KB
testcase_28 AC 3 ms
6,820 KB
testcase_29 AC 3 ms
6,816 KB
testcase_30 AC 7 ms
6,816 KB
testcase_31 AC 5 ms
6,820 KB
testcase_32 AC 9 ms
6,912 KB
testcase_33 AC 16 ms
11,068 KB
testcase_34 AC 14 ms
10,028 KB
testcase_35 AC 2 ms
6,820 KB
testcase_36 AC 20 ms
14,332 KB
testcase_37 AC 21 ms
14,300 KB
testcase_38 AC 20 ms
14,364 KB
testcase_39 AC 20 ms
14,308 KB
testcase_40 AC 19 ms
14,372 KB
testcase_41 AC 21 ms
14,324 KB
testcase_42 AC 21 ms
14,332 KB
testcase_43 AC 21 ms
14,332 KB
testcase_44 AC 20 ms
14,040 KB
testcase_45 AC 21 ms
13,848 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using mint = atcoder::modint998244353;
using namespace std;
int main(){
	int N;
	cin >> N;
	string  S;
	cin >> S;
	vector<vector<mint>> dp(N + 1, vector<mint>(3));
	dp[0][1] = 1;
	for (int i = 0; i < N; i++){
		if (S[i] == 'L' or S[i] == '.'){
			dp[i + 1][0] = dp[i][0] + dp[i][1];
		}
		if (S[i] == 'U' or S[i] == '.'){
			dp[i + 1][1] = dp[i][0] + dp[i][1] + dp[i][2];
		}
		if (S[i] == 'R' or S[i] == '.'){
			dp[i + 1][2] = dp[i][0] + dp[i][1] + dp[i][2];
		}
	}
	cout << accumulate(dp[N].begin(), dp[N].end(), mint(0)).val() << endl;
}
0