結果

問題 No.370 道路の掃除
ユーザー 💕💖💞💕💖💞
提出日時 2017-07-01 14:40:50
言語 Kotlin
(1.9.23)
結果
AC  
実行時間 318 ms / 2,000 ms
コード長 450 bytes
コンパイル時間 10,368 ms
コンパイル使用メモリ 440,980 KB
実行使用メモリ 60,684 KB
最終ジャッジ日時 2024-04-30 15:14:02
合計ジャッジ時間 21,631 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 295 ms
60,336 KB
testcase_01 AC 290 ms
60,296 KB
testcase_02 AC 292 ms
60,404 KB
testcase_03 AC 278 ms
60,356 KB
testcase_04 AC 282 ms
60,292 KB
testcase_05 AC 282 ms
60,408 KB
testcase_06 AC 282 ms
60,380 KB
testcase_07 AC 285 ms
60,232 KB
testcase_08 AC 294 ms
60,344 KB
testcase_09 AC 284 ms
60,268 KB
testcase_10 AC 290 ms
60,352 KB
testcase_11 AC 283 ms
60,456 KB
testcase_12 AC 281 ms
60,424 KB
testcase_13 AC 288 ms
60,432 KB
testcase_14 AC 287 ms
60,408 KB
testcase_15 AC 283 ms
60,432 KB
testcase_16 AC 289 ms
60,440 KB
testcase_17 AC 285 ms
60,324 KB
testcase_18 AC 287 ms
60,432 KB
testcase_19 AC 284 ms
60,336 KB
testcase_20 AC 318 ms
60,684 KB
testcase_21 AC 314 ms
60,624 KB
testcase_22 AC 311 ms
60,508 KB
testcase_23 AC 317 ms
60,600 KB
testcase_24 AC 292 ms
60,388 KB
testcase_25 AC 309 ms
60,516 KB
testcase_26 AC 313 ms
60,496 KB
testcase_27 AC 296 ms
60,540 KB
testcase_28 AC 300 ms
60,636 KB
testcase_29 AC 306 ms
60,612 KB
testcase_30 AC 303 ms
60,628 KB
testcase_31 AC 309 ms
60,560 KB
testcase_32 AC 304 ms
60,516 KB
testcase_33 AC 318 ms
60,520 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.kt:1:11: warning: parameter 'args' is never used
fun main( args : Array<String> ) {
          ^
Main.kt:14:8: warning: unnecessary non-null assertion (!!) on a non-null receiver of type Int
    ret!!
       ^

ソースコード

diff #

fun main( args : Array<String> ) {
  val (n, m) = readLine()!!.split(" ").map { it.toInt() }
  var ps = (1..m).map {
    readLine()!!.toInt()
  }.toList()
  .sorted()
  (0..m-n).map { i ->
    val a = ps[i]
    val b = ps[i+n-1]
    val ret = when { 
      a*b < 0 -> listOf( Math.abs(a)*2 + Math.abs(b), Math.abs(a) + Math.abs(b)*2).min()
      else    -> listOf( Math.abs(a), Math.abs(b) ).max()
    }
    ret!!
  }.min()
  .let { println( it ) }
}
0