結果

問題 No.406 鴨等間隔の法則
ユーザー kokatsukokatsu
提出日時 2022-08-21 19:52:46
言語 D
(dmd 2.106.1)
結果
AC  
実行時間 39 ms / 2,000 ms
コード長 282 bytes
コンパイル時間 3,536 ms
コンパイル使用メモリ 207,484 KB
実行使用メモリ 8,132 KB
最終ジャッジ日時 2023-09-04 18:12:01
合計ジャッジ時間 5,108 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 18 ms
4,652 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 36 ms
7,980 KB
testcase_05 AC 14 ms
4,476 KB
testcase_06 AC 15 ms
4,572 KB
testcase_07 AC 15 ms
4,648 KB
testcase_08 AC 36 ms
8,000 KB
testcase_09 AC 38 ms
7,000 KB
testcase_10 AC 17 ms
4,648 KB
testcase_11 AC 30 ms
6,564 KB
testcase_12 AC 21 ms
5,704 KB
testcase_13 AC 19 ms
5,608 KB
testcase_14 AC 32 ms
6,660 KB
testcase_15 AC 3 ms
4,380 KB
testcase_16 AC 4 ms
4,380 KB
testcase_17 AC 3 ms
4,380 KB
testcase_18 AC 3 ms
4,380 KB
testcase_19 AC 4 ms
4,376 KB
testcase_20 AC 6 ms
4,380 KB
testcase_21 AC 6 ms
4,376 KB
testcase_22 AC 10 ms
4,380 KB
testcase_23 AC 22 ms
5,732 KB
testcase_24 AC 29 ms
6,136 KB
testcase_25 AC 38 ms
7,592 KB
testcase_26 AC 38 ms
7,340 KB
testcase_27 AC 22 ms
7,340 KB
testcase_28 AC 21 ms
7,804 KB
testcase_29 AC 39 ms
8,132 KB
testcase_30 AC 38 ms
7,024 KB
testcase_31 AC 37 ms
6,560 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import std;

void main() {
    int N;
    readf("%d\n", N);

    auto x = readln.chomp.split.to!(int[]);

    x.sort;

    bool isOK = true;
    foreach (i; 2 .. N) {
        isOK &= (x[i] - x[i-1] > 0 && x[i] - x[i-1] == x[i-1] - x[i-2]);
    }

    writeln(isOK ? "YES" : "NO");
}
0