結果

問題 No.406 鴨等間隔の法則
ユーザー バカらっくバカらっく
提出日時 2018-03-01 15:05:00
言語 Swift
(5.10.0)
結果
WA  
実行時間 -
コード長 390 bytes
コンパイル時間 1,766 ms
コンパイル使用メモリ 137,336 KB
実行使用メモリ 14,828 KB
最終ジャッジ日時 2024-05-07 17:20:22
合計ジャッジ時間 4,335 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
11,224 KB
testcase_01 AC 8 ms
9,216 KB
testcase_02 WA -
testcase_03 AC 7 ms
9,344 KB
testcase_04 AC 80 ms
14,640 KB
testcase_05 AC 34 ms
11,420 KB
testcase_06 AC 37 ms
11,568 KB
testcase_07 AC 36 ms
11,192 KB
testcase_08 AC 81 ms
14,600 KB
testcase_09 AC 87 ms
14,424 KB
testcase_10 AC 46 ms
11,480 KB
testcase_11 AC 78 ms
14,232 KB
testcase_12 AC 53 ms
11,440 KB
testcase_13 AC 50 ms
11,536 KB
testcase_14 AC 73 ms
14,408 KB
testcase_15 AC 12 ms
9,504 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 16 ms
9,620 KB
testcase_20 AC 16 ms
9,752 KB
testcase_21 WA -
testcase_22 AC 25 ms
10,044 KB
testcase_23 AC 52 ms
11,468 KB
testcase_24 AC 66 ms
14,332 KB
testcase_25 AC 88 ms
14,428 KB
testcase_26 AC 90 ms
14,444 KB
testcase_27 AC 77 ms
14,700 KB
testcase_28 AC 78 ms
14,688 KB
testcase_29 AC 90 ms
14,828 KB
testcase_30 AC 86 ms
14,552 KB
testcase_31 AC 85 ms
14,648 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

let kamoCount = Int(readLine()!)!

var kamo = readLine()!.split(separator: " ").map{Int($0)!}

kamo.sort{$0<$1}

if(kamo.count != Set(kamo).count) {
    print("NO")
} else {
    let dif = kamo[1]-kamo[0]
    var isValid = true
    for i in 2..<kamoCount {
        if(kamo[i]-kamo[i-1] != dif) {
            isValid = true
            break
        }
    }
    print(isValid ? "YES":"NO")
}
0