結果

問題 No.1884 Sequence
ユーザー 👑 colognecologne
提出日時 2022-03-25 21:41:16
言語 C++23(draft)
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 65 ms / 2,000 ms
コード長 886 bytes
コンパイル時間 3,753 ms
コンパイル使用メモリ 283,460 KB
実行使用メモリ 5,476 KB
最終ジャッジ日時 2024-04-22 06:22:35
合計ジャッジ時間 6,434 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 65 ms
5,376 KB
testcase_11 AC 65 ms
5,476 KB
testcase_12 AC 11 ms
5,376 KB
testcase_13 AC 11 ms
5,376 KB
testcase_14 AC 11 ms
5,376 KB
testcase_15 AC 36 ms
5,376 KB
testcase_16 AC 57 ms
5,476 KB
testcase_17 AC 22 ms
5,376 KB
testcase_18 AC 30 ms
5,376 KB
testcase_19 AC 25 ms
5,376 KB
testcase_20 AC 31 ms
5,376 KB
testcase_21 AC 24 ms
5,376 KB
testcase_22 AC 34 ms
5,376 KB
testcase_23 AC 57 ms
5,376 KB
testcase_24 AC 57 ms
5,376 KB
testcase_25 AC 56 ms
5,376 KB
testcase_26 AC 57 ms
5,376 KB
testcase_27 AC 13 ms
5,376 KB
testcase_28 AC 13 ms
5,376 KB
testcase_29 AC 13 ms
5,376 KB
testcase_30 AC 12 ms
5,376 KB
testcase_31 AC 31 ms
5,376 KB
testcase_32 AC 55 ms
5,476 KB
testcase_33 AC 43 ms
5,476 KB
testcase_34 AC 43 ms
5,376 KB
testcase_35 AC 16 ms
5,376 KB
testcase_36 AC 34 ms
5,376 KB
testcase_37 AC 43 ms
5,476 KB
testcase_38 AC 40 ms
5,472 KB
testcase_39 AC 19 ms
5,376 KB
testcase_40 AC 21 ms
5,376 KB
testcase_41 AC 47 ms
5,476 KB
testcase_42 AC 47 ms
5,476 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/modint>
using namespace std;

using Mint = atcoder::modint998244353;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N;
    cin >> N;
    vector<long long> V;
    for (int i = 0; i < N; ++i)
    {
        long long x;
        cin >> x;
        if (x != 0)
            V.push_back(x);
    }
    sort(V.begin(), V.end());
    long long g = 0;
    bool eq = 0;
    for (int i = 0; i < (int)V.size() - 1; ++i)
    {
        g = gcd(g, V[i + 1] - V[i]);
        if (V[i] == V[i + 1])
            eq = 1;
    }
    if (g == 0)
    {
        cout << "Yes" << endl;
        return 0;
    }
    if (eq)
    {
        cout << "No" << endl;
        return 0;
    }

    long long rng = V.back() - V.front();

    long long cnt = rng / g + 1;
    if (cnt <= N)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}
0