結果

問題 No.2093 Shio Ramen
ユーザー 👑 kakel-sankakel-san
提出日時 2022-10-07 21:33:06
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 73 ms / 2,000 ms
コード長 906 bytes
コンパイル時間 1,367 ms
コンパイル使用メモリ 66,196 KB
実行使用メモリ 24,008 KB
最終ジャッジ日時 2023-09-03 00:30:56
合計ジャッジ時間 4,914 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 65 ms
21,836 KB
testcase_01 AC 65 ms
21,908 KB
testcase_02 AC 65 ms
23,828 KB
testcase_03 AC 64 ms
21,884 KB
testcase_04 AC 64 ms
21,800 KB
testcase_05 AC 65 ms
21,988 KB
testcase_06 AC 65 ms
22,016 KB
testcase_07 AC 65 ms
21,936 KB
testcase_08 AC 65 ms
23,860 KB
testcase_09 AC 67 ms
21,948 KB
testcase_10 AC 69 ms
21,940 KB
testcase_11 AC 65 ms
21,788 KB
testcase_12 AC 66 ms
21,868 KB
testcase_13 AC 66 ms
23,940 KB
testcase_14 AC 67 ms
23,920 KB
testcase_15 AC 68 ms
21,996 KB
testcase_16 AC 67 ms
21,908 KB
testcase_17 AC 68 ms
23,860 KB
testcase_18 AC 71 ms
22,040 KB
testcase_19 AC 71 ms
23,876 KB
testcase_20 AC 67 ms
21,924 KB
testcase_21 AC 68 ms
21,940 KB
testcase_22 AC 68 ms
21,740 KB
testcase_23 AC 70 ms
21,780 KB
testcase_24 AC 70 ms
21,924 KB
testcase_25 AC 70 ms
21,708 KB
testcase_26 AC 70 ms
21,872 KB
testcase_27 AC 71 ms
23,932 KB
testcase_28 AC 73 ms
24,008 KB
testcase_29 AC 72 ms
21,948 KB
testcase_30 AC 70 ms
24,000 KB
権限があれば一括ダウンロードができます

ソースコード

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();
    static int[][] NArr(int n) => Enumerable.Repeat(0, n).Select(_ => NList).ToArray();
    static void Main()
    {
        Solve();
    }
    static void Solve()
    {
        var c = NList;
        var (n, x) = (c[0], c[1]);
        var map = NArr(n);
        var dp = new int[x + 1];
        for (var i = 0; i < n; ++i)
        {
            for (var j = x; j >= 0; --j)
            {
                if (j > 0 && dp[j] == 0) continue;
                if (j + map[i][0] >= dp.Length) continue;
                dp[j + map[i][0]] = Math.Max(dp[j + map[i][0]], dp[j] + map[i][1]);
            }
        }
        WriteLine(dp.Max());
    }
}
0