結果

問題 No.1 道のショートカット
ユーザー mbanmban
提出日時 2016-10-31 12:17:44
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 1,834 bytes
コンパイル時間 4,255 ms
コンパイル使用メモリ 106,784 KB
実行使用メモリ 26,128 KB
最終ジャッジ日時 2023-09-22 12:50:09
合計ジャッジ時間 8,526 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 59 ms
21,716 KB
testcase_01 AC 59 ms
23,776 KB
testcase_02 AC 60 ms
23,688 KB
testcase_03 AC 61 ms
21,596 KB
testcase_04 AC 59 ms
21,712 KB
testcase_05 AC 60 ms
23,876 KB
testcase_06 AC 60 ms
21,660 KB
testcase_07 AC 59 ms
21,568 KB
testcase_08 WA -
testcase_09 AC 68 ms
25,824 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 61 ms
23,684 KB
testcase_16 WA -
testcase_17 AC 60 ms
21,564 KB
testcase_18 AC 60 ms
21,712 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 68 ms
21,860 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 64 ms
21,712 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 AC 60 ms
21,564 KB
testcase_39 AC 68 ms
21,804 KB
testcase_40 AC 67 ms
23,852 KB
testcase_41 WA -
testcase_42 AC 60 ms
21,720 KB
testcase_43 AC 60 ms
21,676 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.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

class Magatro
{
    static int N, C, V;
    static int[] S, T, Y, M;
    static void Main()
    {
        Read();
        int[,] dp = new int[N+1, C + 1];
        for(int i = 0; i < N + 1; i++)
        {
            for(int j = 0; j < C + 1; j++)
            {
                dp[i, j] = -1;
            }
        }
        dp[1, 0] = 0;
       for(int i = 1; i <= N; i++)
        {
            for(int j = 0; j < V; j++)
            {
                if (S[j] == i)
                {
                    for(int q = 0; q <= C; q++)
                    {
                        if (dp[i, q] != -1)
                        {
                            if (q + Y[j] <= C)
                            {
                                dp[T[j], q + Y[j]] = dp[i, q] + M[j];
                            }
                        }
                    }
                }
            }
        }
        int min = int.MaxValue;
        bool a = true ;
        for(int i = 0; i <= C; i++)
        {
            if (dp[N, i] != -1)
            {
                min = Math.Min(min, dp[N, i]);
                a = false;
            }
        }
        if (a)
        {
            min = -1;
        }
        Console.WriteLine(min);
    }
    static void Read()
    {
        N = int.Parse(Console.ReadLine());
        C = int.Parse(Console.ReadLine());
        V = int.Parse(Console.ReadLine());
        S = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
        T = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
        Y = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
        M = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
    }
}


0