結果

問題 No.615 集合に分けよう
ユーザー 💕💖💞💕💖💞
提出日時 2018-06-18 12:56:42
言語 Kotlin
(1.9.23)
結果
AC  
実行時間 635 ms / 2,000 ms
コード長 345 bytes
コンパイル時間 13,820 ms
コンパイル使用メモリ 442,628 KB
実行使用メモリ 75,664 KB
最終ジャッジ日時 2024-04-30 18:55:54
合計ジャッジ時間 25,531 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 297 ms
60,260 KB
testcase_01 AC 291 ms
60,248 KB
testcase_02 AC 302 ms
60,368 KB
testcase_03 AC 307 ms
60,352 KB
testcase_04 AC 298 ms
60,380 KB
testcase_05 AC 297 ms
60,264 KB
testcase_06 AC 282 ms
60,304 KB
testcase_07 AC 288 ms
60,424 KB
testcase_08 AC 280 ms
60,324 KB
testcase_09 AC 295 ms
60,416 KB
testcase_10 AC 285 ms
60,320 KB
testcase_11 AC 282 ms
60,408 KB
testcase_12 AC 289 ms
60,284 KB
testcase_13 AC 299 ms
60,504 KB
testcase_14 AC 315 ms
60,504 KB
testcase_15 AC 448 ms
65,076 KB
testcase_16 AC 615 ms
75,664 KB
testcase_17 AC 613 ms
75,360 KB
testcase_18 AC 635 ms
75,484 KB
testcase_19 AC 609 ms
75,436 KB
testcase_20 AC 618 ms
75,428 KB
testcase_21 AC 606 ms
75,608 KB
testcase_22 AC 603 ms
75,308 KB
testcase_23 AC 519 ms
69,340 KB
testcase_24 AC 626 ms
73,492 KB
testcase_25 AC 275 ms
57,068 KB
testcase_26 AC 282 ms
56,908 KB
testcase_27 AC 412 ms
67,036 KB
testcase_28 AC 412 ms
66,980 KB
testcase_29 AC 460 ms
73,032 KB
testcase_30 AC 453 ms
73,212 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.kt:1:10: warning: parameter 'args' is never used
fun main(args:Array<String>) {
         ^

ソースコード

diff #

fun main(args:Array<String>) {
  val (n, k) = readLine()!!.split(" ").map(String::toInt)
  val xs = readLine()!!.split(" ").map(String::toLong).sorted().toMutableList()
  
  var bs = mutableListOf<Long>()
  for( i in (0..xs.size - 2) ) {
    bs.add( xs[i+1] - xs[i] )
  }
  bs = bs.sorted().toMutableList()
  println(bs.slice(0..n-k-1).sum())
}
0