結果

問題 No.1884 Sequence
ユーザー srjywrdnprktsrjywrdnprkt
提出日時 2023-05-21 02:23:03
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,044 bytes
コンパイル時間 1,336 ms
コンパイル使用メモリ 119,864 KB
実行使用メモリ 14,160 KB
最終ジャッジ日時 2024-06-01 08:55:38
合計ジャッジ時間 8,549 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 2 ms
6,816 KB
testcase_02 AC 2 ms
6,816 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 2 ms
6,944 KB
testcase_06 AC 2 ms
6,944 KB
testcase_07 AC 2 ms
6,940 KB
testcase_08 AC 2 ms
6,944 KB
testcase_09 AC 2 ms
6,940 KB
testcase_10 AC 231 ms
14,136 KB
testcase_11 AC 231 ms
14,160 KB
testcase_12 AC 25 ms
6,944 KB
testcase_13 AC 27 ms
6,940 KB
testcase_14 AC 27 ms
6,944 KB
testcase_15 AC 123 ms
8,780 KB
testcase_16 AC 222 ms
14,156 KB
testcase_17 AC 77 ms
6,944 KB
testcase_18 AC 128 ms
9,420 KB
testcase_19 AC 99 ms
7,884 KB
testcase_20 AC 100 ms
7,372 KB
testcase_21 AC 70 ms
6,944 KB
testcase_22 AC 110 ms
8,140 KB
testcase_23 AC 221 ms
14,156 KB
testcase_24 AC 221 ms
14,160 KB
testcase_25 AC 215 ms
14,160 KB
testcase_26 AC 219 ms
14,156 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 31 ms
6,940 KB
testcase_30 AC 31 ms
6,940 KB
testcase_31 AC 82 ms
6,944 KB
testcase_32 AC 193 ms
12,108 KB
testcase_33 AC 122 ms
6,944 KB
testcase_34 AC 125 ms
6,944 KB
testcase_35 AC 38 ms
6,944 KB
testcase_36 AC 90 ms
6,944 KB
testcase_37 AC 123 ms
6,944 KB
testcase_38 AC 110 ms
6,944 KB
testcase_39 AC 48 ms
6,944 KB
testcase_40 AC 53 ms
6,944 KB
testcase_41 AC 170 ms
11,468 KB
testcase_42 AC 173 ms
11,476 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <cmath>
#include <map>
#include <set>
#include <iomanip>
#include <queue>
#include <algorithm>
#include <numeric>
#include <deque>
#include <complex>
#include <cassert>

using namespace std;
using ll = long long;

int main(){

    ll N, M=0, a, g=0;
    cin >> N;
    vector<ll> A;
    for (int i=0; i<N; i++){
        cin >> a;
        if (a == 0) M++;
        else A.push_back(a);
    }
    sort(A.begin(), A.end());
    if (A.size() <= 1){
        cout << "Yes" << endl;
    }

    for (int i=1; i<A.size(); i++){
        g = gcd(g, A[i]-A[i-1]);
    }

    if (g == 0){
        bool f=1;
        for (int i=1; i<A.size(); i++) if (A[i] != A[0]) f=0;
        cout << (f ? "Yes" : "No") << endl;
        return 0;
    }

    set<ll> st;
    for (int i=0; i<A.size(); i++){
        if (st.count(A[i])){
            cout << "No" << endl;
            return 0;
        }
        st.insert(A[i]);
    }

    cout << (A.back()/g - A[0]/g + 1 <= A.size() + M ? "Yes" : "No") << endl;

    return 0;
}
0