結果

問題 No.1884 Sequence
ユーザー silv723silv723
提出日時 2022-03-25 21:38:48
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 592 bytes
コンパイル時間 2,511 ms
コンパイル使用メモリ 200,900 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-22 06:19:04
合計ジャッジ時間 7,353 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 1 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 WA -
testcase_10 AC 148 ms
5,376 KB
testcase_11 AC 149 ms
5,376 KB
testcase_12 AC 29 ms
5,376 KB
testcase_13 AC 33 ms
5,376 KB
testcase_14 AC 30 ms
5,376 KB
testcase_15 AC 91 ms
5,376 KB
testcase_16 AC 141 ms
5,376 KB
testcase_17 AC 64 ms
5,376 KB
testcase_18 AC 87 ms
5,376 KB
testcase_19 AC 70 ms
5,376 KB
testcase_20 AC 78 ms
5,376 KB
testcase_21 AC 61 ms
5,376 KB
testcase_22 AC 84 ms
5,376 KB
testcase_23 AC 140 ms
5,376 KB
testcase_24 AC 140 ms
5,376 KB
testcase_25 AC 133 ms
5,376 KB
testcase_26 AC 141 ms
5,376 KB
testcase_27 AC 37 ms
5,376 KB
testcase_28 AC 37 ms
5,376 KB
testcase_29 WA -
testcase_30 AC 37 ms
5,376 KB
testcase_31 AC 75 ms
5,376 KB
testcase_32 WA -
testcase_33 AC 126 ms
5,376 KB
testcase_34 AC 127 ms
5,376 KB
testcase_35 AC 43 ms
5,376 KB
testcase_36 AC 98 ms
5,376 KB
testcase_37 AC 129 ms
5,376 KB
testcase_38 WA -
testcase_39 AC 56 ms
5,376 KB
testcase_40 WA -
testcase_41 AC 115 ms
5,376 KB
testcase_42 AC 117 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using ll=long long;
int main(){
	ll n;
	cin>>n;
	vector<ll> a(n);
	ll cnt=0;
	for(int i=0;i<n;i++){
		cin>>a[i];
		if(a[i]==0)cnt++;
	}
	sort(a.begin(),a.end());
    ll k=0;
    for(int i=0;i<n-1;i++){
		k=max(k,a[i+1]-a[i]);
	}
	for(int i=0;i<n-1;i++){
		if(a[i]==0) continue;
		k=gcd(k,a[i+1]-a[i]);
	}
	ll z=0;
    if(k==0){
      cout<<"Yes"<<endl;
      return 0;
    }
	for(int i=0;i<n-1;i++){
		if(a[i]==0||a[i+1]==0) continue;
		z+=(a[i+1]-a[i])/k-1;
    }
	//cout<<k<<" "<<z<<endl;
	if(cnt>=z) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
}
0