結果

問題 No.135 とりあえず1次元の問題
ユーザー toshiro_yanagitoshiro_yanagi
提出日時 2018-06-03 16:09:32
言語 Nim
(2.0.2)
結果
AC  
実行時間 48 ms / 5,000 ms
コード長 237 bytes
コンパイル時間 3,275 ms
コンパイル使用メモリ 68,804 KB
実行使用メモリ 12,340 KB
最終ジャッジ日時 2023-09-12 21:54:56
合計ジャッジ時間 4,272 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 48 ms
12,108 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 2 ms
4,376 KB
testcase_15 AC 2 ms
4,380 KB
testcase_16 AC 2 ms
4,376 KB
testcase_17 AC 2 ms
4,376 KB
testcase_18 AC 2 ms
4,380 KB
testcase_19 AC 2 ms
4,376 KB
testcase_20 AC 2 ms
4,376 KB
testcase_21 AC 28 ms
12,340 KB
testcase_22 AC 48 ms
12,096 KB
evil01.txt AC 38 ms
12,092 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import strutils, sequtils, algorithm

var
  N, X = stdin.readLine.split.map parseInt
  best = int.high

X.sort(cmp)

for i in 1 .. X.high:
  let d = X[i] - X[i - 1]
  if d != 0: best = min(best, d)

[best, 0][int(best == int.high)].echo
0