結果

問題 No.1884 Sequence
ユーザー gazellegazelle
提出日時 2022-03-25 21:40:51
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 1,213 bytes
コンパイル時間 2,551 ms
コンパイル使用メモリ 200,888 KB
実行使用メモリ 5,608 KB
最終ジャッジ日時 2024-04-22 06:21:53
合計ジャッジ時間 6,322 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 RE -
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 RE -
testcase_06 RE -
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 WA -
testcase_10 AC 65 ms
5,476 KB
testcase_11 AC 64 ms
5,480 KB
testcase_12 AC 11 ms
5,376 KB
testcase_13 AC 11 ms
5,376 KB
testcase_14 AC 12 ms
5,376 KB
testcase_15 AC 37 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 23 ms
5,376 KB
testcase_22 AC 34 ms
5,376 KB
testcase_23 AC 57 ms
5,608 KB
testcase_24 AC 58 ms
5,376 KB
testcase_25 AC 55 ms
5,472 KB
testcase_26 AC 57 ms
5,480 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 13 ms
5,376 KB
testcase_31 AC 30 ms
5,376 KB
testcase_32 WA -
testcase_33 RE -
testcase_34 RE -
testcase_35 RE -
testcase_36 RE -
testcase_37 AC 44 ms
5,604 KB
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 AC 47 ms
5,476 KB
testcase_42 AC 47 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define FOR(i, n, m) for (long long i = (n); i < (long long)(m); i++)
#define REP(i, n) FOR(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define pb push_back
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
constexpr ll inf = 1000000000;
constexpr ll mod = 998244353;
constexpr ld eps = 1e-6;

template <typename T1, typename T2>
ostream &operator<<(ostream &os, pair<T1, T2> p) {
    os << to_string(p.first) << " " << to_string(p.second);
    return os;
}
template <typename T>
ostream &operator<<(ostream &os, vector<T> &v) {
    REP(i, v.size()) {
        if (i) os << " ";
        os << v[i];
    }
    return os;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n;
    cin >> n;

    vector<ll> a;
    REP(i, n) {
        ll num;
        cin >> num;
        if (num != 0) a.pb(num);
    }

    if ((int)a.size() <= 1) {
        cout << "Yes" << endl;
        return 0;
    }

    sort(ALL(a));
    ll g = a[1] - a[0];

    FOR(i, 1, a.size()) g = gcd(g, a[i] - a[i - 1]);

    if ((a.back() - a.front()) / g <= n - 1) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}
0