結果

問題 No.135 とりあえず1次元の問題
ユーザー 💕💖💞💕💖💞
提出日時 2017-06-27 23:19:00
言語 Kotlin
(1.9.23)
結果
RE  
(最新)
AC  
(最初)
実行時間 -
コード長 277 bytes
コンパイル時間 11,879 ms
コンパイル使用メモリ 423,144 KB
実行使用メモリ 72,788 KB
最終ジャッジ日時 2023-08-12 19:59:28
合計ジャッジ時間 23,598 ms
ジャッジサーバーID
(参考情報)
judge2 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 841 ms
72,640 KB
testcase_01 AC 314 ms
57,224 KB
testcase_02 AC 315 ms
57,092 KB
testcase_03 RE -
testcase_04 AC 322 ms
57,176 KB
testcase_05 AC 320 ms
57,164 KB
testcase_06 AC 324 ms
57,368 KB
testcase_07 AC 321 ms
57,244 KB
testcase_08 AC 319 ms
57,396 KB
testcase_09 AC 321 ms
57,108 KB
testcase_10 AC 320 ms
57,396 KB
testcase_11 AC 323 ms
57,316 KB
testcase_12 AC 331 ms
57,164 KB
testcase_13 AC 322 ms
57,168 KB
testcase_14 AC 347 ms
57,488 KB
testcase_15 AC 334 ms
57,396 KB
testcase_16 AC 345 ms
57,444 KB
testcase_17 AC 344 ms
57,436 KB
testcase_18 AC 328 ms
57,232 KB
testcase_19 AC 344 ms
57,324 KB
testcase_20 AC 337 ms
57,532 KB
testcase_21 AC 544 ms
65,280 KB
testcase_22 AC 846 ms
72,788 KB
evil01.txt AC 712 ms
72,292 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.kt:1:11: warning: parameter 'args' is never used
fun main( args : Array<String> ) {
          ^
Main.kt:14:5: warning: expression under 'when' is never equal to null
    null -> println(0)
    ^

ソースコード

diff #

fun main( args : Array<String> ) {
  readLine()
  val bs = readLine()!!
    .split(" ")
    .map { it.toInt() }
    .toSet()
    .sorted()

  val ans = (0..bs.size-2).map { i ->
    bs[i+1] - bs[i]
  }.min()

  when(ans) {
    null -> println(0)
    else -> println(ans)
  }
}
0