結果

問題 No.1111 コード進行
ユーザー ngtkanangtkana
提出日時 2020-03-11 00:05:07
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 1,389 bytes
コンパイル時間 2,263 ms
コンパイル使用メモリ 113,272 KB
実行使用メモリ 46,128 KB
最終ジャッジ日時 2024-04-27 19:00:37
合計ジャッジ時間 5,300 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
23,480 KB
testcase_01 AC 30 ms
25,132 KB
testcase_02 AC 30 ms
23,088 KB
testcase_03 AC 30 ms
25,296 KB
testcase_04 AC 31 ms
25,056 KB
testcase_05 AC 31 ms
27,400 KB
testcase_06 AC 33 ms
26,416 KB
testcase_07 AC 34 ms
26,588 KB
testcase_08 AC 32 ms
23,224 KB
testcase_09 AC 32 ms
23,860 KB
testcase_10 AC 33 ms
27,184 KB
testcase_11 AC 32 ms
25,260 KB
testcase_12 AC 34 ms
26,336 KB
testcase_13 AC 32 ms
27,948 KB
testcase_14 AC 38 ms
27,228 KB
testcase_15 AC 31 ms
25,152 KB
testcase_16 AC 36 ms
26,720 KB
testcase_17 AC 32 ms
25,524 KB
testcase_18 AC 31 ms
27,184 KB
testcase_19 AC 31 ms
25,148 KB
testcase_20 AC 31 ms
25,264 KB
testcase_21 AC 31 ms
27,468 KB
testcase_22 AC 34 ms
28,508 KB
testcase_23 AC 32 ms
25,776 KB
testcase_24 AC 32 ms
25,948 KB
testcase_25 AC 41 ms
28,380 KB
testcase_26 WA -
testcase_27 AC 31 ms
27,056 KB
testcase_28 AC 71 ms
44,040 KB
testcase_29 AC 51 ms
43,228 KB
testcase_30 WA -
testcase_31 AC 36 ms
29,912 KB
testcase_32 WA -
testcase_33 WA -
testcase_34 AC 54 ms
45,284 KB
testcase_35 AC 71 ms
43,948 KB
testcase_36 AC 141 ms
45,828 KB
testcase_37 AC 60 ms
37,296 KB
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 AC 86 ms
46,128 KB
testcase_42 AC 82 ms
43,244 KB
testcase_43 WA -
testcase_44 AC 46 ms
35,528 KB
testcase_45 AC 79 ms
45,724 KB
testcase_46 WA -
testcase_47 AC 227 ms
33,472 KB
testcase_48 AC 32 ms
27,208 KB
testcase_49 AC 32 ms
27,220 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;
        Tuple<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 new Tuple<int,int,int>(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(Tuple<int,int,int>uvw in prog){
                    int u=uvw.Item1;
                    int v=uvw.Item2;
                    int w=uvw.Item3;
                    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