結果

問題 No.1884 Sequence
ユーザー kokatsukokatsu
提出日時 2022-03-25 22:18:10
言語 D
(dmd 2.106.1)
結果
WA  
実行時間 -
コード長 639 bytes
コンパイル時間 2,042 ms
コンパイル使用メモリ 208,912 KB
実行使用メモリ 15,060 KB
最終ジャッジ日時 2023-09-04 16:31:20
合計ジャッジ時間 5,847 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 1 ms
4,384 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 99 ms
14,716 KB
testcase_11 AC 100 ms
14,808 KB
testcase_12 AC 19 ms
9,876 KB
testcase_13 AC 20 ms
9,304 KB
testcase_14 AC 20 ms
9,624 KB
testcase_15 AC 62 ms
12,712 KB
testcase_16 AC 92 ms
14,800 KB
testcase_17 AC 37 ms
11,576 KB
testcase_18 AC 50 ms
13,460 KB
testcase_19 AC 46 ms
11,888 KB
testcase_20 AC 53 ms
11,236 KB
testcase_21 AC 39 ms
10,684 KB
testcase_22 AC 56 ms
11,952 KB
testcase_23 AC 90 ms
14,520 KB
testcase_24 AC 92 ms
14,740 KB
testcase_25 AC 89 ms
14,960 KB
testcase_26 AC 90 ms
14,584 KB
testcase_27 AC 23 ms
10,460 KB
testcase_28 AC 22 ms
10,504 KB
testcase_29 WA -
testcase_30 AC 23 ms
10,480 KB
testcase_31 AC 52 ms
11,244 KB
testcase_32 AC 87 ms
15,060 KB
testcase_33 AC 62 ms
14,756 KB
testcase_34 AC 63 ms
14,304 KB
testcase_35 AC 25 ms
10,092 KB
testcase_36 AC 52 ms
11,736 KB
testcase_37 AC 61 ms
13,464 KB
testcase_38 AC 58 ms
13,420 KB
testcase_39 AC 32 ms
9,928 KB
testcase_40 AC 35 ms
11,592 KB
testcase_41 AC 76 ms
13,852 KB
testcase_42 AC 75 ms
13,716 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];
        if (d > 0) {
            diff = true;
            B ~= d;
        }
        else {
            diff0 = true;
        }

        mn = min(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);
    }

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