結果

問題 No.716 距離
ユーザー n3k2t1
提出日時 2019-07-08 23:15:25
言語 JavaScript
(node v23.5.0)
結果
AC  
実行時間 70 ms / 2,000 ms
コード長 391 bytes
コンパイル時間 113 ms
コンパイル使用メモリ 5,248 KB
実行使用メモリ 39,296 KB
最終ジャッジ日時 2024-10-13 01:08:12
合計ジャッジ時間 3,925 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 40
権限があれば一括ダウンロードができます

ソースコード

diff #

const lines = require('fs')
  .readFileSync('/dev/stdin', 'utf-8')
  .trim().split('\n').values();

const N = Number(lines.next().value);
const a = lines.next().value.split(' ').map(x => Number(x));

let max = a[a.length - 1] - a[0];
let min = Number.POSITIVE_INFINITY;

for (let i = 0; i < a.length - 1; i++) {
  min = Math.min(min, a[i + 1] - a[i]);
}

console.log(min);
console.log(max);
0