結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
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 2 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 148 ms
5,376 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 30 ms
5,376 KB
testcase_15 AC 92 ms
5,376 KB
testcase_16 AC 141 ms
5,376 KB
testcase_17 WA -
testcase_18 AC 92 ms
5,376 KB
testcase_19 AC 72 ms
5,376 KB
testcase_20 AC 79 ms
5,376 KB
testcase_21 AC 61 ms
5,376 KB
testcase_22 AC 84 ms
5,376 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 138 ms
5,376 KB
testcase_26 AC 143 ms
5,376 KB
testcase_27 AC 36 ms
5,376 KB
testcase_28 AC 36 ms
5,376 KB
testcase_29 WA -
testcase_30 AC 37 ms
5,376 KB
testcase_31 AC 77 ms
5,376 KB
testcase_32 AC 140 ms
5,376 KB
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 AC 60 ms
5,376 KB
testcase_41 AC 118 ms
5,376 KB
testcase_42 WA -
権限があれば一括ダウンロードができます

ソースコード

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+1]==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