結果

問題 No.1454 ツブ消ししとるなEasy
ユーザー face4
提出日時 2021-04-10 18:09:14
言語 Kotlin
(2.1.0)
結果
AC  
実行時間 564 ms / 2,000 ms
コード長 524 bytes
コンパイル時間 13,357 ms
コンパイル使用メモリ 436,272 KB
実行使用メモリ 72,632 KB
最終ジャッジ日時 2024-06-26 07:01:36
合計ジャッジ時間 22,177 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 16
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.kt:2:10: warning: variable 'n' is never used
    val (n, m, x, y) = readLine()!!.split(" ").map { it.toInt() }
         ^

ソースコード

diff #

fun main() {
    val (n, m, x, y) = readLine()!!.split(" ").map { it.toInt() }
    val a = readLine()!!.split(" ").map { it.toLong() }
    a.filter { it > y }.sorted().reversed().apply {
        dropLast(0.coerceAtLeast(this.size - (m + 1))).let {
            if(it.isEmpty()){
                println(0)
            }else if (it.size == m+1 && it.last() >= x) {
                println("Handicapped")
            } else {
                println(it.dropLast(if(it.size==m+1) 1 else 0).sum())
            }
        }
    }
}
0