結果

問題 No.1884 Sequence
ユーザー kokatsukokatsu
提出日時 2022-03-25 21:46:46
言語 D
(dmd 2.106.1)
結果
WA  
実行時間 -
コード長 562 bytes
コンパイル時間 4,496 ms
コンパイル使用メモリ 208,876 KB
実行使用メモリ 15,156 KB
最終ジャッジ日時 2023-09-04 16:28:41
合計ジャッジ時間 6,282 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 1 ms
4,384 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 107 ms
14,940 KB
testcase_11 AC 106 ms
14,640 KB
testcase_12 AC 19 ms
10,108 KB
testcase_13 AC 21 ms
9,548 KB
testcase_14 AC 19 ms
9,068 KB
testcase_15 AC 66 ms
12,668 KB
testcase_16 AC 98 ms
14,676 KB
testcase_17 AC 39 ms
11,528 KB
testcase_18 AC 55 ms
13,556 KB
testcase_19 AC 48 ms
11,788 KB
testcase_20 AC 55 ms
12,184 KB
testcase_21 AC 42 ms
10,272 KB
testcase_22 AC 59 ms
11,932 KB
testcase_23 AC 97 ms
14,816 KB
testcase_24 AC 99 ms
14,728 KB
testcase_25 AC 96 ms
15,048 KB
testcase_26 AC 97 ms
14,708 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 23 ms
10,496 KB
testcase_31 AC 54 ms
11,216 KB
testcase_32 AC 95 ms
15,156 KB
testcase_33 AC 78 ms
14,796 KB
testcase_34 AC 77 ms
14,800 KB
testcase_35 AC 27 ms
10,424 KB
testcase_36 AC 62 ms
12,808 KB
testcase_37 AC 78 ms
14,576 KB
testcase_38 AC 72 ms
14,920 KB
testcase_39 AC 35 ms
10,344 KB
testcase_40 AC 39 ms
11,604 KB
testcase_41 AC 82 ms
13,808 KB
testcase_42 AC 81 ms
13,692 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
/dmd2/linux/bin64/../../src/phobos/std/numeric.d(2999): Warning: cannot inline function `std.numeric.gcdImpl!ulong.gcdImpl`

ソースコード

diff #

import std;

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

    auto A = readln.chomp.split.to!(long[]);

    A.sort!"a > b";

    bool diff, diff0;
    long mx = A[0], mn = A[0];
    long[] B;
    foreach (i; 1 .. N) {
        if (A[i] == 0) break;

        long d = A[i-1] - A[i];
        (d > 0 ? diff : diff0) = true;
        B ~= d;
        mn = min(mn, A[i]);
    }

    bool isOK;
    if (!B.empty) {
        long g = B.fold!gcd;
        isOK = mx <= mn + g * (N - 1);

        if (diff && diff0) isOK = false;
    }

    writeln(isOK ? "Yes" : "No");
}
0