結果

問題 No.1046 Fruits Rush
コンテスト
ユーザー face4
提出日時 2021-04-10 23:44:29
言語 Kotlin
(2.3.20)
コンパイル:
kotlinc _filename_ -include-runtime -d main.jar
実行:
kotlin main.jar
結果
AC  
実行時間 203 ms / 2,000 ms
+ 296µs
コード長 268 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 8,723 ms
コンパイル使用メモリ 511,636 KB
実行使用メモリ 57,892 KB
最終ジャッジ日時 2026-07-30 16:56:55
合計ジャッジ時間 12,654 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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