結果

問題 No.2625 Bouns Ai
ユーザー 👑 kakel-sankakel-san
提出日時 2024-02-09 23:14:20
言語 C#
(.NET 8.0.203)
結果
AC  
実行時間 727 ms / 2,000 ms
コード長 1,184 bytes
コンパイル時間 5,806 ms
コンパイル使用メモリ 158,496 KB
実行使用メモリ 337,764 KB
最終ジャッジ日時 2024-02-09 23:14:46
合計ジャッジ時間 21,013 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
34,596 KB
testcase_01 AC 69 ms
33,700 KB
testcase_02 AC 110 ms
40,228 KB
testcase_03 AC 532 ms
190,244 KB
testcase_04 AC 489 ms
190,244 KB
testcase_05 AC 549 ms
190,244 KB
testcase_06 AC 528 ms
190,244 KB
testcase_07 AC 550 ms
190,244 KB
testcase_08 AC 532 ms
190,244 KB
testcase_09 AC 563 ms
190,244 KB
testcase_10 AC 705 ms
190,244 KB
testcase_11 AC 75 ms
35,236 KB
testcase_12 AC 634 ms
190,244 KB
testcase_13 AC 700 ms
190,244 KB
testcase_14 AC 724 ms
190,244 KB
testcase_15 AC 724 ms
190,244 KB
testcase_16 AC 707 ms
190,244 KB
testcase_17 AC 727 ms
190,244 KB
testcase_18 AC 638 ms
190,244 KB
testcase_19 AC 681 ms
190,244 KB
testcase_20 AC 638 ms
190,244 KB
testcase_21 AC 698 ms
190,244 KB
testcase_22 AC 666 ms
190,244 KB
testcase_23 AC 698 ms
190,244 KB
testcase_24 AC 626 ms
190,244 KB
testcase_25 AC 670 ms
337,764 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (82 ms)。
MSBuild のバージョン 17.7.3+8ec440e68 (.NET)
  main -> /home/judge/data/code/bin/Release/net7.0/main.dll
  main -> /home/judge/data/code/bin/Release/net7.0/publish/

ソースコード

diff #

using System;
using static System.Console;
using System.Linq;
using System.Collections.Generic;

class Program
{
    static int NN => int.Parse(ReadLine());
    static int[] NList => ReadLine().Split().Select(int.Parse).ToArray();
    public static void Main()
    {
        Solve();
    }
    static void Solve()
    {
        var n = NN;
        var a = NList;
        var mod = 998_244_353;
        var dp = new long[n][];
        for (var i = 0; i < dp.Length; ++i)
        {
            dp[i] = new long[100001];
            if (i == 0) for (var j = a[i]; j < dp[i].Length; ++j) dp[i][j] = 1;
            else
            {
                for (var j = a[i]; j < dp[i].Length; ++j)
                {
                    var min = a[i - 1];
                    var max = Math.Min(j, Math.Max(0, j - a[i] + a[i - 1]));
                    if (min == 0) dp[i][j] = dp[i - 1][max];
                    else dp[i][j] = (dp[i - 1][max] - dp[i - 1][min - 1] + mod) % mod;
                }
            }
            for (var j = 1; j < dp[i].Length; ++j) dp[i][j] = (dp[i][j] + dp[i][j - 1]) % mod;
        }
        WriteLine(dp[^1][^1]);
    }
}
0