結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 1 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 151 ms
5,376 KB
testcase_11 AC 150 ms
5,376 KB
testcase_12 AC 30 ms
5,376 KB
testcase_13 AC 32 ms
5,376 KB
testcase_14 AC 30 ms
5,376 KB
testcase_15 AC 90 ms
5,376 KB
testcase_16 AC 141 ms
5,376 KB
testcase_17 AC 63 ms
5,376 KB
testcase_18 AC 88 ms
5,376 KB
testcase_19 AC 71 ms
5,376 KB
testcase_20 AC 77 ms
5,376 KB
testcase_21 AC 60 ms
5,376 KB
testcase_22 AC 84 ms
5,376 KB
testcase_23 AC 141 ms
5,376 KB
testcase_24 AC 141 ms
5,376 KB
testcase_25 AC 134 ms
5,376 KB
testcase_26 AC 140 ms
5,376 KB
testcase_27 AC 36 ms
5,376 KB
testcase_28 AC 36 ms
5,376 KB
testcase_29 AC 37 ms
5,376 KB
testcase_30 AC 37 ms
5,376 KB
testcase_31 AC 75 ms
5,376 KB
testcase_32 WA -
testcase_33 AC 127 ms
5,376 KB
testcase_34 AC 127 ms
5,376 KB
testcase_35 AC 43 ms
5,376 KB
testcase_36 AC 97 ms
5,376 KB
testcase_37 AC 129 ms
5,376 KB
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 AC 116 ms
5,376 KB
testcase_42 AC 115 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++){
		if(a[i]==0||a[i+1]==0) continue;
		k=max(k,a[i+1]-a[i]);
	}
	for(int i=0;i<n-1;i++){
		if(a[i]==0||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