結果

問題 No.1111 コード進行
ユーザー bluemeganebluemegane
提出日時 2021-05-03 10:36:43
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 1,732 bytes
コンパイル時間 2,611 ms
コンパイル使用メモリ 66,028 KB
実行使用メモリ 71,984 KB
最終ジャッジ日時 2023-09-29 04:58:12
合計ジャッジ時間 13,884 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
22,776 KB
testcase_01 AC 66 ms
22,628 KB
testcase_02 AC 67 ms
22,684 KB
testcase_03 AC 67 ms
22,524 KB
testcase_04 AC 69 ms
24,680 KB
testcase_05 AC 71 ms
24,636 KB
testcase_06 AC 84 ms
24,916 KB
testcase_07 AC 83 ms
24,908 KB
testcase_08 AC 74 ms
22,724 KB
testcase_09 AC 77 ms
22,620 KB
testcase_10 AC 87 ms
22,836 KB
testcase_11 AC 71 ms
20,712 KB
testcase_12 AC 85 ms
22,680 KB
testcase_13 AC 77 ms
24,612 KB
testcase_14 AC 97 ms
24,904 KB
testcase_15 AC 70 ms
22,672 KB
testcase_16 AC 88 ms
23,232 KB
testcase_17 AC 87 ms
22,640 KB
testcase_18 AC 69 ms
24,728 KB
testcase_19 AC 69 ms
24,704 KB
testcase_20 AC 73 ms
22,980 KB
testcase_21 AC 64 ms
22,700 KB
testcase_22 AC 95 ms
25,444 KB
testcase_23 AC 79 ms
22,684 KB
testcase_24 AC 78 ms
24,584 KB
testcase_25 AC 103 ms
24,364 KB
testcase_26 WA -
testcase_27 AC 71 ms
22,652 KB
testcase_28 AC 399 ms
24,768 KB
testcase_29 AC 222 ms
32,048 KB
testcase_30 WA -
testcase_31 AC 103 ms
22,652 KB
testcase_32 WA -
testcase_33 WA -
testcase_34 AC 309 ms
24,304 KB
testcase_35 AC 379 ms
26,808 KB
testcase_36 AC 667 ms
71,984 KB
testcase_37 AC 217 ms
36,324 KB
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 AC 470 ms
40,752 KB
testcase_42 AC 336 ms
45,252 KB
testcase_43 WA -
testcase_44 AC 166 ms
34,468 KB
testcase_45 AC 358 ms
49,264 KB
testcase_46 WA -
testcase_47 AC 1,286 ms
34,336 KB
testcase_48 AC 74 ms
22,560 KB
testcase_49 AC 73 ms
22,604 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

using System.Collections.Generic;
using System.Linq;
using System;

public class P
{
    public int q { get; set; }
    public int c { get; set; }
}

public class Hello
{
    public static int n, m, k;
    static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        n = int.Parse(line[0]);
        m = int.Parse(line[1]);
        k = int.Parse(line[2]);
        var ps = new List<P>[301];
        for (int i = 0; i < 301; i++) ps[i] = new List<P>();
        var hs = new HashSet<int>();
        for (int i = 0; i < m; i++)
        {
            line = Console.ReadLine().Trim().Split(' ');
            var p = int.Parse(line[0]);
            var q = int.Parse(line[1]);
            var c = int.Parse(line[2]);
            if (c <= k)
            {
                ps[p].Add(new P { q = q, c = c });
                hs.Add(p);
            }
        }
        var plist = hs.ToArray();
        Array.Sort(plist);
        getAns(ps, plist);
    }
    static void getAns(List<P>[] ps, int[] plist)
    {
        var dp = new int[n, 301, k + 1];
        foreach (var x in plist)
            foreach (var y in ps[x])
                dp[1, y.q, y.c]++;
        for (int i = 0; i < n - 1; i++)
        {
            for (int j = 1; j <= 300; j++)
            {
                for (int L = 0; L <= k; L++)
                {
                    foreach (var x in ps[j])
                    {
                        var ww = L + x.c;
                        if (ww <= k) dp[i + 1, x.q, ww] += dp[i, j, L];
                    }
                }
            }
        }
        var ans = 0;
        for (int i = 1; i <= 300; i++)
            ans += dp[n - 1, i, k];
        Console.WriteLine(ans);
    }
}
0