結果

問題 No.1884 Sequence
ユーザー kokatsukokatsu
提出日時 2022-03-25 22:35:40
言語 D
(dmd 2.106.1)
結果
WA  
実行時間 -
コード長 574 bytes
コンパイル時間 2,066 ms
コンパイル使用メモリ 208,748 KB
実行使用メモリ 17,084 KB
最終ジャッジ日時 2023-09-04 16:31:31
合計ジャッジ時間 6,189 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 WA -
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 1 ms
4,384 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 1 ms
4,384 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 19 ms
9,048 KB
testcase_13 AC 20 ms
9,276 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 91 ms
14,660 KB
testcase_17 AC 37 ms
11,668 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 92 ms
14,728 KB
testcase_24 AC 93 ms
14,728 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 22 ms
10,668 KB
testcase_28 AC 23 ms
10,648 KB
testcase_29 AC 23 ms
10,476 KB
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 AC 72 ms
14,760 KB
testcase_34 AC 73 ms
14,756 KB
testcase_35 AC 26 ms
10,108 KB
testcase_36 AC 58 ms
12,556 KB
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 AC 77 ms
13,820 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 = A[i];
    }

    bool isOK = true;
    if (!B.empty) {
        long g = B.fold!gcd;

        if (diff0) isOK = !diff;
        else isOK = mx <= mn + g * (N - 1);
    }

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