結果

問題 No.1686 Geschenkt
ユーザー GatanityHouseGatanityHouse
提出日時 2021-10-17 01:51:35
言語 Kotlin
(1.9.23)
結果
AC  
実行時間 330 ms / 2,000 ms
コード長 395 bytes
コンパイル時間 11,778 ms
コンパイル使用メモリ 433,008 KB
実行使用メモリ 58,508 KB
最終ジャッジ日時 2023-10-17 22:21:00
合計ジャッジ時間 16,021 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 327 ms
58,508 KB
testcase_01 AC 328 ms
58,508 KB
testcase_02 AC 318 ms
58,496 KB
testcase_03 AC 308 ms
54,408 KB
testcase_04 AC 312 ms
54,412 KB
testcase_05 AC 322 ms
58,504 KB
testcase_06 AC 329 ms
58,504 KB
testcase_07 AC 325 ms
58,508 KB
testcase_08 AC 323 ms
58,500 KB
testcase_09 AC 330 ms
58,508 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

fun main() {
    readLine()
    val a = readLine()!!.split(" ").map { it.toInt() }

    val sortedAs = a.sorted()
    val result = sortedAs
        .filterIndexed { index, value ->
            val beforeValue = sortedAs.getOrNull(index - 1)

            if (beforeValue == null) true else {
                (value - beforeValue != 1)
            }
        }
        .sum()
    println(result)
}
0