結果

問題 No.135 とりあえず1次元の問題
ユーザー phsplsphspls
提出日時 2020-03-27 23:50:15
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 123 ms / 5,000 ms
コード長 538 bytes
コンパイル時間 2,256 ms
コンパイル使用メモリ 102,320 KB
実行使用メモリ 30,356 KB
最終ジャッジ日時 2023-08-30 17:02:38
合計ジャッジ時間 5,516 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 123 ms
30,260 KB
testcase_01 AC 60 ms
21,568 KB
testcase_02 AC 60 ms
21,608 KB
testcase_03 AC 60 ms
21,684 KB
testcase_04 AC 61 ms
23,716 KB
testcase_05 AC 61 ms
21,808 KB
testcase_06 AC 61 ms
21,652 KB
testcase_07 AC 61 ms
21,684 KB
testcase_08 AC 60 ms
21,580 KB
testcase_09 AC 60 ms
21,580 KB
testcase_10 AC 62 ms
21,792 KB
testcase_11 AC 60 ms
21,776 KB
testcase_12 AC 70 ms
23,824 KB
testcase_13 AC 62 ms
21,576 KB
testcase_14 AC 69 ms
22,032 KB
testcase_15 AC 68 ms
21,816 KB
testcase_16 AC 68 ms
21,812 KB
testcase_17 AC 69 ms
21,844 KB
testcase_18 AC 67 ms
21,772 KB
testcase_19 AC 68 ms
23,804 KB
testcase_20 AC 68 ms
21,920 KB
testcase_21 AC 113 ms
28,624 KB
testcase_22 AC 123 ms
30,356 KB
evil01.txt AC 123 ms
30,368 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;

public class P0135 {
    public static void Main() {
        var n = int.Parse(Console.ReadLine().Trim());
        var x = Console.ReadLine().Trim().Split(' ').Select(int.Parse).ToList();
        x.Sort();
        var result = 1000001;
        for(int i=0; i<n-1; i++) {
            if(x[i] != x[i+1]) {
                result = Math.Min(Math.Abs(x[i] - x[i+1]), result);
            }
        }
        if(result == 1000001) {
            result = 0;
        }
        Console.WriteLine(result);
    }
}
0