結果

問題 No.1046 Fruits Rush
コンテスト
ユーザー face4
提出日時 2021-04-10 23:44:29
言語 Kotlin
(2.3.10)
コンパイル:
kotlinc _filename_ -include-runtime -d main.jar
実行:
kotlin main.jar
結果
AC  
実行時間 210 ms / 2,000 ms
コード長 268 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 8,310 ms
コンパイル使用メモリ 467,188 KB
実行使用メモリ 62,148 KB
最終ジャッジ日時 2026-03-13 15:46:01
合計ジャッジ時間 12,944 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge1_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 14
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

fun main() {
    val (n, k) = readLine()!!.split(" ").map{it.toInt()}
    println(readLine()!!.split(" ").map{it.toInt()}.sorted().reversed().take(k).let{
        if(it.first() < 0)  it.first()
        else                it.sumOf{it2 -> 0.coerceAtLeast(it2)}
    })
}
0