結果

問題 No.135 とりあえず1次元の問題
ユーザー 14番14番
提出日時 2016-04-18 03:20:26
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 131 ms / 5,000 ms
コード長 2,833 bytes
コンパイル時間 2,332 ms
コンパイル使用メモリ 108,396 KB
実行使用メモリ 33,204 KB
最終ジャッジ日時 2023-09-02 00:23:39
合計ジャッジ時間 5,429 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 130 ms
31,096 KB
testcase_01 AC 65 ms
24,556 KB
testcase_02 AC 64 ms
22,628 KB
testcase_03 AC 63 ms
22,560 KB
testcase_04 AC 65 ms
22,608 KB
testcase_05 AC 65 ms
22,612 KB
testcase_06 AC 64 ms
22,548 KB
testcase_07 AC 65 ms
22,472 KB
testcase_08 AC 64 ms
22,620 KB
testcase_09 AC 64 ms
24,624 KB
testcase_10 AC 64 ms
22,488 KB
testcase_11 AC 63 ms
22,488 KB
testcase_12 AC 70 ms
22,600 KB
testcase_13 AC 63 ms
24,648 KB
testcase_14 AC 71 ms
22,660 KB
testcase_15 AC 71 ms
24,844 KB
testcase_16 AC 71 ms
22,740 KB
testcase_17 AC 71 ms
24,680 KB
testcase_18 AC 71 ms
24,708 KB
testcase_19 AC 72 ms
22,620 KB
testcase_20 AC 70 ms
22,728 KB
testcase_21 AC 103 ms
29,992 KB
testcase_22 AC 131 ms
33,204 KB
evil01.txt AC 127 ms
33,156 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.Text;
using System.Linq;
 
class Program
{
    public void Proc()
    {
        Reader.IsDebug = false;
        int cnt = int.Parse(Reader.ReadLine());
        int[] inpt = Reader.GetInt();
        HashSet<int> tmp = new HashSet<int>(inpt);
        List<int> sorted = new List<int>(tmp);
        sorted.Sort();
        int min = 0;
        if(sorted.Count >= 2) {
            min = int.MaxValue;
            for(int i=1; i<sorted.Count; i++) {
                if(sorted[i] - sorted[i-1] < min) {
                    min = sorted[i] - sorted[i-1];
                }
            }
        }
        Console.WriteLine(min);

    }
    
    private double GetDeliverCost(int fromPos, int toPos, double nimotsu) {
        int x1 = this.TargetList[fromPos].X;
        int y1 = this.TargetList[fromPos].Y;
        int x2 = this.TargetList[toPos].X;
        int y2 = this.TargetList[toPos].Y;
        double ans = GetMoveCost(x1, y1, x2, y2, nimotsu);
        ans += this.TargetList[toPos].Nimotsu;
        return ans;
    }
    
    private double GetMoveCost(int x1, int y1, int x2, int y2, double nimotsu) {
        double ans = (Math.Abs(x1-x2) + Math.Abs(y1-y2)) * ((nimotsu + 100) / 120d);
        return ans; 
    }
    
    private List<Haitatsusaki> TargetList = new List<Haitatsusaki>();
    public int StartX;
    public int StartY;
    
    public class Haitatsusaki {
        public int X;
        public int Y;
        public double Nimotsu;
        
        public Haitatsusaki(int x, int y, double nimotsu) {
            this.X = x;
            this.Y = y;
            this.Nimotsu = nimotsu;
        }
    }
    

    public class Reader
    {
        public static bool IsDebug = true;
        private static String PlainInput = @"


4
0 1 1 0


 
";
        private static System.IO.StringReader Sr = null;
        public static string ReadLine()
        {
            if (IsDebug)
            {
                if (Sr == null)
                {
                    Sr = new System.IO.StringReader(PlainInput.Trim());
                }
                return Sr.ReadLine();
            }
            else
            {
                return Console.ReadLine();
            }
        }
        public static int[] GetInt(char delimiter = ' ', bool trim = false)
        {
            string inptStr = ReadLine();
            if (trim)
            {
                inptStr = inptStr.Trim();
            }
            string[] inpt = inptStr.Split(delimiter);
            int[] ret = new int[inpt.Length];
            for (int i = 0; i < inpt.Length; i++)
            {
                ret[i] = int.Parse(inpt[i]);
            }
            return ret;
        }
    }
    static void Main()
    {
        Program prg = new Program();
        prg.Proc();
    }
}
0