結果

問題 No.1111 コード進行
ユーザー ngtkanangtkana
提出日時 2020-03-11 00:03:57
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 1,245 bytes
コンパイル時間 2,158 ms
コンパイル使用メモリ 111,548 KB
実行使用メモリ 47,540 KB
最終ジャッジ日時 2024-04-27 19:00:31
合計ジャッジ時間 5,514 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 26 ms
25,268 KB
testcase_01 AC 25 ms
25,316 KB
testcase_02 AC 24 ms
25,192 KB
testcase_03 AC 28 ms
27,228 KB
testcase_04 AC 26 ms
25,188 KB
testcase_05 AC 25 ms
25,396 KB
testcase_06 AC 29 ms
26,756 KB
testcase_07 AC 28 ms
28,252 KB
testcase_08 AC 26 ms
25,000 KB
testcase_09 AC 27 ms
27,644 KB
testcase_10 AC 28 ms
27,052 KB
testcase_11 AC 26 ms
25,384 KB
testcase_12 AC 29 ms
28,312 KB
testcase_13 AC 25 ms
25,928 KB
testcase_14 AC 33 ms
25,140 KB
testcase_15 AC 25 ms
25,148 KB
testcase_16 AC 31 ms
28,896 KB
testcase_17 AC 26 ms
27,104 KB
testcase_18 AC 26 ms
27,184 KB
testcase_19 AC 24 ms
27,184 KB
testcase_20 AC 25 ms
23,216 KB
testcase_21 AC 26 ms
25,444 KB
testcase_22 AC 30 ms
28,460 KB
testcase_23 AC 26 ms
25,644 KB
testcase_24 AC 26 ms
23,864 KB
testcase_25 AC 35 ms
30,228 KB
testcase_26 WA -
testcase_27 AC 25 ms
25,136 KB
testcase_28 AC 60 ms
44,032 KB
testcase_29 AC 45 ms
41,180 KB
testcase_30 WA -
testcase_31 AC 30 ms
31,804 KB
testcase_32 WA -
testcase_33 WA -
testcase_34 AC 45 ms
43,236 KB
testcase_35 AC 57 ms
43,940 KB
testcase_36 AC 153 ms
45,808 KB
testcase_37 AC 58 ms
35,256 KB
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 AC 74 ms
43,812 KB
testcase_42 AC 82 ms
45,292 KB
testcase_43 WA -
testcase_44 AC 42 ms
35,556 KB
testcase_45 AC 69 ms
43,948 KB
testcase_46 WA -
testcase_47 AC 280 ms
31,720 KB
testcase_48 AC 26 ms
25,448 KB
testcase_49 AC 26 ms
25,312 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Linq;

static class NagataKanaIsAGenius {
    public static void Main() {
        int[]qmk=Console.ReadLine().Split().Select(int.Parse).ToArray();
        int q=qmk[0];
        int m=qmk[1];
        int k=qmk[2];
        int n=0;
        (int,int,int)[]prog=Enumerable.Range(0,m).Select(_=>{
            int[]uvw=Console.ReadLine().Split().Select(int.Parse).ToArray();
            int u=uvw[0]-1;
            int v=uvw[1]-1;
            int w=uvw[2];
            if(n<u)n=u;
            if(n<v)n=v;
            return (u,v,w);
        }).ToArray();
        n++;
        int[]dp=new int[(k+1)*n];
        for(int i=0;i<n;i++)dp[i]=1;
        for(int i=0;i<q-1;i++){
            int[]new_dp=new int[(k+1)*n];
            for(int j=k;j>=0;j--){
                foreach((int u,int v,int w)in prog){
                    if(w<=j){
                        AddAssign(ref new_dp[j*n+u],dp[(j-w)*n+v]);
                    }
                }
            }
            dp=new_dp;
        }
        int ans=0;
        for(int i=0;i<n;i++){
            AddAssign(ref ans,dp[k*n+i]);
        }
        Console.WriteLine(ans);
    }
    static int Mod=100000007;
    static void AddAssign(ref int x,int y){x+=y;if(Mod<=x)x-=Mod;}
}
0