結果

問題 No.1 道のショートカット
ユーザー nokonokonokonoko
提出日時 2015-06-28 15:38:44
言語 C#(csc)
(csc 3.9.0)
結果
TLE  
実行時間 -
コード長 1,951 bytes
コンパイル時間 4,907 ms
コンパイル使用メモリ 106,576 KB
実行使用メモリ 24,092 KB
最終ジャッジ日時 2023-09-22 12:22:38
合計ジャッジ時間 12,124 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 65 ms
21,848 KB
testcase_01 AC 66 ms
19,820 KB
testcase_02 AC 67 ms
23,936 KB
testcase_03 AC 67 ms
23,940 KB
testcase_04 AC 67 ms
21,896 KB
testcase_05 AC 68 ms
21,836 KB
testcase_06 AC 66 ms
21,868 KB
testcase_07 AC 67 ms
21,908 KB
testcase_08 AC 105 ms
22,204 KB
testcase_09 AC 76 ms
22,188 KB
testcase_10 AC 130 ms
24,092 KB
testcase_11 TLE -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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;

namespace YukiCoderNo1
{
    class Program
    {
        private static int[] townStart = new int[0];
        private static int[] townEnd = new int[0];
        private static int[] cost = new int[0];
        private static int[] time = new int[0];
        private static int roadCount = 0;
        private static int targetTown = 0;
        private static int money = 0;
        static void Main()
        {
            targetTown = int.Parse(Console.ReadLine());
            money = int.Parse(Console.ReadLine());
            roadCount = int.Parse(Console.ReadLine());
            townStart = (Console.ReadLine()).Split(' ').Select(value => int.Parse(value)).ToArray();
            townEnd = (Console.ReadLine()).Split(' ').Select(value => int.Parse(value)).ToArray();
            cost = (Console.ReadLine()).Split(' ').Select(value => int.Parse(value)).ToArray();
            time = (Console.ReadLine()).Split(' ').Select(value => int.Parse(value)).ToArray();
            List<int> timeList = GetTimeList(1, money, 0);

            if (timeList.Count == 0) { timeList.Add(-1); }
            Console.WriteLine("{0}", timeList.Min());
        }
        private static List<int> GetTimeList(int nowTown, int nowMoney, int nowTime)
        {
            List<int> result = new List<int>();
            if (nowTown == targetTown)
            {
                result.Add(nowTime);
            }
            else
            {
                for (int i = 0; i < roadCount; i++)
                {
                    if (townStart[i] == nowTown)
                    {
                        if ((nowMoney - cost[i]) >= 0)
                        {
                            result.AddRange(GetTimeList(townEnd[i], (nowMoney - cost[i]), (nowTime + time[i])));
                        }
                    }
                }
            }
            return result;
        }
    }
}
0