結果

問題 No.1884 Sequence
ユーザー kaichou243
提出日時 2022-03-25 23:34:48
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 695 bytes
コンパイル時間 1,903 ms
コンパイル使用メモリ 200,520 KB
最終ジャッジ日時 2025-01-28 12:40:03
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 32 WA * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using ll=long long;
int main(){
    int n;
    cin>>n;
    vector<ll> a(n);
    ll mx=0,mn=1e18;
    vector<ll> t;
    ll cnt=0;
    for(int i=0;i<n;i++){
        cin>>a[i];
        if(a[i]!=0){
            mx=max(mx,a[i]);
            mn=min(mn,a[i]);
            t.push_back(a[i]);
        }else{
            cnt++;
        }
    }
    ll Mn=1e18;
    sort(t.begin(),t.end());
    for(int i=1;i<t.size();i++){
        Mn=min(Mn,t[i]-t[i-1]);
    }
    if(Mn==0){
        if(mx-mn==0) cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
        return 0;
    }
    if((mx-mn)%Mn==0&&(mx-mn)/Mn-1ll<=cnt) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}
0