結果

問題 No.1 道のショートカット
ユーザー nokonokonokonoko
提出日時 2015-06-28 15:30:52
言語 C#(csc)
(csc 3.9.0)
結果
RE  
実行時間 -
コード長 1,892 bytes
コンパイル時間 2,238 ms
コンパイル使用メモリ 107,992 KB
実行使用メモリ 24,240 KB
最終ジャッジ日時 2023-09-22 12:23:31
合計ジャッジ時間 9,887 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 63 ms
21,828 KB
testcase_01 AC 64 ms
22,000 KB
testcase_02 AC 64 ms
21,884 KB
testcase_03 RE -
testcase_04 AC 64 ms
22,052 KB
testcase_05 AC 64 ms
23,868 KB
testcase_06 RE -
testcase_07 AC 62 ms
21,828 KB
testcase_08 AC 101 ms
24,240 KB
testcase_09 AC 74 ms
22,116 KB
testcase_10 AC 129 ms
24,080 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);

            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