結果

問題 No.1884 Sequence
ユーザー kaichou243kaichou243
提出日時 2022-03-25 23:32:46
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 585 bytes
コンパイル時間 2,490 ms
コンパイル使用メモリ 203,976 KB
実行使用メモリ 7,016 KB
最終ジャッジ日時 2023-08-04 10:53:34
合計ジャッジ時間 9,434 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 RE -
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 RE -
testcase_06 RE -
testcase_07 WA -
testcase_08 AC 2 ms
4,376 KB
testcase_09 RE -
testcase_10 AC 131 ms
6,664 KB
testcase_11 AC 134 ms
6,776 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 25 ms
4,492 KB
testcase_15 AC 80 ms
5,616 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 80 ms
5,584 KB
testcase_19 AC 64 ms
5,400 KB
testcase_20 AC 69 ms
5,720 KB
testcase_21 AC 53 ms
5,236 KB
testcase_22 AC 74 ms
5,580 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 125 ms
6,632 KB
testcase_26 AC 130 ms
6,676 KB
testcase_27 AC 31 ms
4,744 KB
testcase_28 AC 31 ms
4,628 KB
testcase_29 AC 30 ms
4,580 KB
testcase_30 AC 30 ms
4,632 KB
testcase_31 RE -
testcase_32 RE -
testcase_33 RE -
testcase_34 RE -
testcase_35 RE -
testcase_36 RE -
testcase_37 RE -
testcase_38 RE -
testcase_39 RE -
testcase_40 RE -
testcase_41 AC 106 ms
6,628 KB
testcase_42 WA -
権限があれば一括ダウンロードができます

ソースコード

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((mx-mn)%Mn==0&&(mx-mn)/Mn-1ll<=cnt) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}
0