結果

問題 No.1325 Subsequence Score
ユーザー tsutajtsutaj
提出日時 2020-12-03 22:57:39
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 696 bytes
コンパイル時間 312 ms
コンパイル使用メモリ 32,772 KB
実行使用メモリ 58,704 KB
最終ジャッジ日時 2023-10-17 16:36:19
合計ジャッジ時間 4,885 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
9,648 KB
testcase_01 AC 2 ms
5,328 KB
testcase_02 AC 2 ms
5,372 KB
testcase_03 AC 39 ms
32,856 KB
testcase_04 AC 18 ms
17,708 KB
testcase_05 AC 81 ms
58,704 KB
testcase_06 AC 13 ms
13,284 KB
testcase_07 AC 46 ms
37,804 KB
testcase_08 AC 3 ms
5,384 KB
testcase_09 AC 5 ms
7,088 KB
testcase_10 AC 8 ms
10,016 KB
testcase_11 AC 12 ms
13,236 KB
testcase_12 AC 24 ms
21,932 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 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
using ll = long long int;
const ll MOD = 998244353;
ll dp[2010][2010], sum[2010][2010];
int main() {
    int N; scanf("%d", &N);
    dp[0][0] = 1;
    for(int i=0; i<N; i++) {
        ll V; scanf("%lld", &V);
        for(int j=0; j<=N; j++) {
            // 使わない
            (dp[i+1][j] += dp[i][j]) %= MOD;
            (sum[i+1][j] += sum[i][j]) %= MOD;
            // 使う
            (dp[i+1][j+1] += dp[i][j]) %= MOD;
            (sum[i+1][j+1] += sum[i][j]) %= MOD;
            (sum[i+1][j+1] += (j+1) * V % MOD * dp[i][j]) %= MOD;
        }
    }

    ll ans = 0;
    for(int i=0; i<=N; i++) (ans += sum[N][i]) %= MOD;
    printf("%lld\n", ans);
    return 0;
}
0