結果

問題 No.370 道路の掃除
ユーザー 💕💖💞💕💖💞
提出日時 2017-07-01 14:40:50
言語 Kotlin
(1.9.23)
結果
AC  
実行時間 337 ms / 2,000 ms
コード長 450 bytes
コンパイル時間 12,304 ms
コンパイル使用メモリ 422,540 KB
実行使用メモリ 58,252 KB
最終ジャッジ日時 2023-08-12 20:09:55
合計ジャッジ時間 24,708 ms
ジャッジサーバーID
(参考情報)
judge14 / judge10
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 310 ms
57,168 KB
testcase_01 AC 303 ms
56,872 KB
testcase_02 AC 296 ms
58,252 KB
testcase_03 AC 301 ms
57,044 KB
testcase_04 AC 306 ms
56,888 KB
testcase_05 AC 301 ms
57,180 KB
testcase_06 AC 299 ms
56,892 KB
testcase_07 AC 313 ms
56,936 KB
testcase_08 AC 309 ms
56,908 KB
testcase_09 AC 305 ms
56,984 KB
testcase_10 AC 306 ms
56,948 KB
testcase_11 AC 318 ms
57,048 KB
testcase_12 AC 309 ms
56,888 KB
testcase_13 AC 312 ms
57,052 KB
testcase_14 AC 306 ms
57,024 KB
testcase_15 AC 306 ms
57,224 KB
testcase_16 AC 306 ms
57,152 KB
testcase_17 AC 310 ms
57,120 KB
testcase_18 AC 306 ms
57,284 KB
testcase_19 AC 306 ms
56,892 KB
testcase_20 AC 337 ms
57,512 KB
testcase_21 AC 326 ms
57,336 KB
testcase_22 AC 323 ms
57,232 KB
testcase_23 AC 330 ms
57,220 KB
testcase_24 AC 314 ms
57,036 KB
testcase_25 AC 337 ms
57,248 KB
testcase_26 AC 326 ms
57,244 KB
testcase_27 AC 319 ms
57,104 KB
testcase_28 AC 330 ms
57,300 KB
testcase_29 AC 330 ms
57,232 KB
testcase_30 AC 328 ms
57,192 KB
testcase_31 AC 331 ms
57,328 KB
testcase_32 AC 324 ms
57,240 KB
testcase_33 AC 326 ms
57,312 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