結果

問題 No.135 とりあえず1次元の問題
ユーザー yozayoza
提出日時 2015-02-26 18:14:04
言語 Nim
(2.0.2)
結果
AC  
実行時間 48 ms / 5,000 ms
コード長 379 bytes
コンパイル時間 3,314 ms
コンパイル使用メモリ 69,100 KB
実行使用メモリ 12,240 KB
最終ジャッジ日時 2023-09-11 07:51:39
合計ジャッジ時間 4,348 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 48 ms
12,040 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 3 ms
4,380 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,384 KB
testcase_19 AC 2 ms
4,376 KB
testcase_20 AC 2 ms
4,376 KB
testcase_21 AC 27 ms
12,240 KB
testcase_22 AC 47 ms
12,212 KB
evil01.txt AC 38 ms
12,092 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
/home/judge/data/code/Main.nim(1, 39) Warning: imported and not used: 'math' [UnusedImport]

ソースコード

diff #

import strutils, sequtils, algorithm, math

var
  n = readLine(stdin).parseInt
  x_seq = split(readLine(stdin), ' ').map(parseInt)
  min_v = high(int)
  flag = true

x_seq.sort(cmp[int])

for i in countup(0, x_seq.len() - 2):
  if x_seq[i] == x_seq[i + 1]:
    continue
  min_v = min(min_v, max(abs(x_seq[i] - x_seq[i + 1]), 1))
  flag = false

if flag:
  min_v = 0

echo(min_v)
0