結果

問題 No.135 とりあえず1次元の問題
ユーザー itezpaceitezpace
提出日時 2016-08-28 15:09:37
言語 JavaScript
(node v21.7.1)
結果
WA  
実行時間 -
コード長 449 bytes
コンパイル時間 427 ms
コンパイル使用メモリ 7,196 KB
実行使用メモリ 54,192 KB
最終ジャッジ日時 2024-04-21 01:24:14
合計ジャッジ時間 3,101 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 266 ms
54,192 KB
testcase_01 AC 63 ms
39,168 KB
testcase_02 AC 63 ms
39,040 KB
testcase_03 AC 63 ms
39,168 KB
testcase_04 AC 68 ms
39,296 KB
testcase_05 AC 64 ms
39,168 KB
testcase_06 AC 62 ms
39,424 KB
testcase_07 AC 62 ms
39,168 KB
testcase_08 AC 62 ms
39,168 KB
testcase_09 AC 62 ms
39,296 KB
testcase_10 AC 63 ms
39,040 KB
testcase_11 AC 64 ms
39,040 KB
testcase_12 AC 63 ms
39,168 KB
testcase_13 AC 64 ms
39,168 KB
testcase_14 AC 65 ms
42,496 KB
testcase_15 AC 62 ms
39,424 KB
testcase_16 AC 65 ms
42,496 KB
testcase_17 AC 65 ms
42,624 KB
testcase_18 AC 63 ms
39,168 KB
testcase_19 AC 66 ms
42,496 KB
testcase_20 AC 64 ms
42,496 KB
testcase_21 WA -
testcase_22 AC 263 ms
54,188 KB
evil01.txt AC 206 ms
54,192 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

function compare(a,b){
  return a-b;
}

function Main(input){
  var d=input.split("\n");
  var x=d[1].split(" ");
  var ary=[];
  for(var i=0; i<x.length; ++i){
    ary.push(x[i]);
  }
  ary.sort(compare);
  var y=1e6;
  for(var i=0; i<ary.length-1; ++i){
    var a=ary[i];
    var b=ary[i+1];
    if(a!=b){
      var c=b-a;
      if(c<y) y=c;
    }
  }
  if(y==1e6) y=0;
  console.log(y);
}

Main(require("fs").readFileSync("/dev/stdin","utf-8"));
0