結果
| 問題 |
No.1884 Sequence
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-03-25 23:32:46 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 585 bytes |
| コンパイル時間 | 1,956 ms |
| コンパイル使用メモリ | 199,900 KB |
| 最終ジャッジ日時 | 2025-01-28 12:39:14 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 RE * 1 |
| other | AC * 19 WA * 8 RE * 13 |
ソースコード
#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;
}