結果

問題 No.1884 Sequence
ユーザー srjywrdnprktsrjywrdnprkt
提出日時 2023-05-21 02:23:03
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,044 bytes
コンパイル時間 2,745 ms
コンパイル使用メモリ 117,068 KB
実行使用メモリ 14,160 KB
最終ジャッジ日時 2023-08-23 11:17:00
合計ジャッジ時間 10,816 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 225 ms
14,024 KB
testcase_11 AC 226 ms
14,156 KB
testcase_12 AC 23 ms
4,380 KB
testcase_13 AC 25 ms
4,380 KB
testcase_14 AC 25 ms
4,380 KB
testcase_15 AC 119 ms
8,496 KB
testcase_16 AC 216 ms
14,160 KB
testcase_17 AC 75 ms
6,436 KB
testcase_18 AC 123 ms
9,292 KB
testcase_19 AC 95 ms
7,712 KB
testcase_20 AC 95 ms
7,316 KB
testcase_21 AC 67 ms
5,660 KB
testcase_22 AC 107 ms
7,852 KB
testcase_23 AC 218 ms
14,028 KB
testcase_24 AC 217 ms
14,160 KB
testcase_25 AC 212 ms
14,104 KB
testcase_26 AC 216 ms
14,160 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 29 ms
4,376 KB
testcase_30 AC 29 ms
4,380 KB
testcase_31 AC 79 ms
5,748 KB
testcase_32 AC 191 ms
11,976 KB
testcase_33 AC 116 ms
5,276 KB
testcase_34 AC 116 ms
5,068 KB
testcase_35 AC 34 ms
4,380 KB
testcase_36 AC 85 ms
4,380 KB
testcase_37 AC 117 ms
5,120 KB
testcase_38 AC 105 ms
5,140 KB
testcase_39 AC 47 ms
4,376 KB
testcase_40 AC 50 ms
4,376 KB
testcase_41 AC 167 ms
11,260 KB
testcase_42 AC 171 ms
11,260 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