結果

問題 No.1884 Sequence
ユーザー colognecologne
提出日時 2022-03-25 21:39:51
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 735 bytes
コンパイル時間 2,967 ms
コンパイル使用メモリ 254,264 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-10-14 05:35:55
合計ジャッジ時間 5,771 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 35 WA * 5
権限があれば一括ダウンロードができます

ソースコード

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;
    for (int i = 0; i < (int)V.size() - 1; ++i)
        g = gcd(g, V[i + 1] - V[i]);
    if (g == 0)
    {
        cout << "Yes" << 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