結果

問題 No.1046 Fruits Rush
ユーザー face4face4
提出日時 2021-04-10 23:44:29
言語 Kotlin
(1.9.23)
結果
AC  
実行時間 327 ms / 2,000 ms
コード長 268 bytes
コンパイル時間 12,316 ms
コンパイル使用メモリ 416,300 KB
実行使用メモリ 57,340 KB
最終ジャッジ日時 2023-09-09 03:41:40
合計ジャッジ時間 19,387 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 310 ms
57,028 KB
testcase_01 AC 308 ms
57,340 KB
testcase_02 AC 306 ms
57,132 KB
testcase_03 AC 313 ms
57,140 KB
testcase_04 AC 313 ms
57,036 KB
testcase_05 AC 309 ms
57,044 KB
testcase_06 AC 312 ms
57,012 KB
testcase_07 AC 315 ms
57,132 KB
testcase_08 AC 310 ms
57,096 KB
testcase_09 AC 309 ms
57,036 KB
testcase_10 AC 310 ms
57,184 KB
testcase_11 AC 311 ms
57,236 KB
testcase_12 AC 327 ms
57,196 KB
testcase_13 AC 315 ms
57,124 KB
testcase_14 AC 306 ms
57,012 KB
testcase_15 AC 307 ms
56,932 KB
testcase_16 AC 290 ms
53,148 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.kt:2:10: warning: variable 'n' is never used
    val (n, k) = readLine()!!.split(" ").map{it.toInt()}
         ^

ソースコード

diff #

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