結果

問題 No.406 鴨等間隔の法則
ユーザー komkomhkomkomh
提出日時 2019-06-09 10:27:35
言語 Kotlin
(1.9.23)
結果
AC  
実行時間 815 ms / 2,000 ms
コード長 439 bytes
コンパイル時間 16,447 ms
コンパイル使用メモリ 419,172 KB
実行使用メモリ 68,260 KB
最終ジャッジ日時 2023-09-21 19:06:14
合計ジャッジ時間 36,287 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 509 ms
57,956 KB
testcase_01 AC 314 ms
57,548 KB
testcase_02 AC 324 ms
57,228 KB
testcase_03 AC 313 ms
53,108 KB
testcase_04 AC 563 ms
64,124 KB
testcase_05 AC 529 ms
58,204 KB
testcase_06 AC 532 ms
57,972 KB
testcase_07 AC 515 ms
58,040 KB
testcase_08 AC 567 ms
64,056 KB
testcase_09 AC 558 ms
63,960 KB
testcase_10 AC 519 ms
58,280 KB
testcase_11 AC 571 ms
59,884 KB
testcase_12 AC 531 ms
57,988 KB
testcase_13 AC 537 ms
57,976 KB
testcase_14 AC 782 ms
66,124 KB
testcase_15 AC 428 ms
54,016 KB
testcase_16 AC 444 ms
57,796 KB
testcase_17 AC 396 ms
57,508 KB
testcase_18 AC 442 ms
57,740 KB
testcase_19 AC 466 ms
57,956 KB
testcase_20 AC 514 ms
59,524 KB
testcase_21 AC 499 ms
59,376 KB
testcase_22 AC 552 ms
60,000 KB
testcase_23 AC 518 ms
58,084 KB
testcase_24 AC 664 ms
61,668 KB
testcase_25 AC 550 ms
63,980 KB
testcase_26 AC 815 ms
68,260 KB
testcase_27 AC 518 ms
63,944 KB
testcase_28 AC 544 ms
64,460 KB
testcase_29 AC 809 ms
68,156 KB
testcase_30 AC 814 ms
66,160 KB
testcase_31 AC 543 ms
63,984 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.kt:4:9: warning: variable 'N' is never used
    val N = readLine()!!.toInt()
        ^

ソースコード

diff #

package yukicoder

fun main() {
    val N = readLine()!!.toInt()
    val X = readLine()!!.split(" ").map(String::toInt)

    if (X.size != X.toSet().size) {
        println("NO")
        return
    }

    val hatos = X.sorted()
    val diff = hatos[1] - hatos[0]
    for (index in 1 until hatos.size) {
        if (hatos[index] - hatos[index -1] != diff) {
            println("NO")
            return
        }
    }
    println("YES")
}
0