結果

問題 No.2150 Site Supporter
ユーザー 👑 kakel-sankakel-san
提出日時 2023-01-15 20:51:50
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 158 ms / 2,000 ms
コード長 899 bytes
コンパイル時間 1,421 ms
コンパイル使用メモリ 66,504 KB
実行使用メモリ 49,428 KB
最終ジャッジ日時 2023-08-28 13:04:48
合計ジャッジ時間 6,346 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 62 ms
21,844 KB
testcase_01 AC 61 ms
21,896 KB
testcase_02 AC 59 ms
19,836 KB
testcase_03 AC 62 ms
23,912 KB
testcase_04 AC 60 ms
19,880 KB
testcase_05 AC 61 ms
19,864 KB
testcase_06 AC 61 ms
21,724 KB
testcase_07 AC 61 ms
19,852 KB
testcase_08 AC 80 ms
23,828 KB
testcase_09 AC 148 ms
47,356 KB
testcase_10 AC 104 ms
32,108 KB
testcase_11 AC 141 ms
43,884 KB
testcase_12 AC 95 ms
28,052 KB
testcase_13 AC 84 ms
24,312 KB
testcase_14 AC 61 ms
21,860 KB
testcase_15 AC 62 ms
21,764 KB
testcase_16 AC 61 ms
21,716 KB
testcase_17 AC 158 ms
49,428 KB
testcase_18 AC 99 ms
29,388 KB
testcase_19 AC 78 ms
25,736 KB
testcase_20 AC 126 ms
39,068 KB
testcase_21 AC 75 ms
22,876 KB
testcase_22 AC 149 ms
45,280 KB
testcase_23 AC 62 ms
21,820 KB
testcase_24 AC 61 ms
21,772 KB
testcase_25 AC 62 ms
21,796 KB
testcase_26 AC 63 ms
23,820 KB
testcase_27 AC 120 ms
39,892 KB
testcase_28 AC 119 ms
37,420 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

using System;
using static System.Console;
using System.Linq;
using System.Collections.Generic;
class Program
{
    static int[] NList => ReadLine().Split().Select(int.Parse).ToArray();
    static string[] SList(long n) => Enumerable.Repeat(0, (int)n).Select(_ => ReadLine()).ToArray();
    public static void Main()
    {
        Solve();
    }
    static void Solve()
    {
        var c = NList;
        var (n, k, x) = (c[0], c[1], c[2]);
        var a = NList;
        var dp = new long[2][];
        for (var i = 0; i < dp.Length; ++i) dp[i] = Enumerable.Repeat(long.MaxValue / 2, n + 1).ToArray();
        dp[0][0] = 0;
        for (var i = 0; i < n; ++i)
        {
            dp[0][i + 1] = Math.Min(dp[0][i], dp[1][i]) + a[i];
            dp[1][i + 1] = Math.Min(dp[0][i] + k + x, dp[1][i] + k);
        }
        WriteLine(Math.Min(dp[0][n], dp[1][n]));
    }
}
0