結果

問題 No.2524 Stripes
ユーザー GOTKAKOGOTKAKO
提出日時 2023-10-27 23:35:34
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 718 bytes
コンパイル時間 2,296 ms
コンパイル使用メモリ 204,512 KB
実行使用メモリ 8,744 KB
最終ジャッジ日時 2023-10-27 23:36:11
合計ジャッジ時間 36,810 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,372 KB
testcase_01 AC 2 ms
4,372 KB
testcase_02 AC 2 ms
4,372 KB
testcase_03 AC 3,374 ms
4,372 KB
testcase_04 AC 12 ms
4,372 KB
testcase_05 AC 1,008 ms
4,372 KB
testcase_06 AC 3,310 ms
4,372 KB
testcase_07 TLE -
testcase_08 TLE -
testcase_09 AC 332 ms
4,372 KB
testcase_10 AC 2,425 ms
4,372 KB
testcase_11 AC 10 ms
4,372 KB
testcase_12 AC 230 ms
4,372 KB
testcase_13 TLE -
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 #

#include <bits/stdc++.h>
using namespace std;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int N; cin >> N;
    string s; cin >> s;
    long long mod = 998244353;
    vector<long long> dp1(N+1),dp2(N+1);
    dp1.at(0) = 1,dp2.at(0) = 1;
    for(int i=0; i<N; i++){
        for(int k=0; k<N; k++){
            if(s.at(i) == 'R'){
                if(dp1.at(k) == 0) break;
                dp2.at(k+1) = (dp2.at(k+1)+dp1.at(k))%mod;
            }
            else{
                if(dp2.at(k) == 0) break;
                dp1.at(k+1) = (dp1.at(k+1)+dp2.at(k))%mod;
            }
        }
    }
    
    for(int i=1; i<=N; i++){
        cout << (dp1.at(i)+dp2.at(i))%mod << endl;
    }
}
0