結果

問題 No.1686 Geschenkt
コンテスト
ユーザー GatanityHouse
提出日時 2021-10-17 01:51:35
言語 Kotlin
(2.4.10 + ACL)
コンパイル:
kotlinc -cp /opt/aclib/ac_library.jar _filename_ -include-runtime -d main.jar
実行:
java -cp main.jar:/opt/aclib/ac_library.jar _class_
結果
AC  
実行時間 205 ms / 2,000 ms
+ 301µs
コード長 395 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 9,180 ms
コンパイル使用メモリ 498,172 KB
実行使用メモリ 57,564 KB
最終ジャッジ日時 2026-08-29 19:07:07
合計ジャッジ時間 11,015 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge2_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 7
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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