結果

問題 No.1884 Sequence
ユーザー silv723silv723
提出日時 2022-03-25 21:30:05
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 493 bytes
コンパイル時間 2,466 ms
コンパイル使用メモリ 201,076 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-22 06:06:08
合計ジャッジ時間 7,198 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 1 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 WA -
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 149 ms
5,376 KB
testcase_11 AC 149 ms
5,376 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 31 ms
5,376 KB
testcase_15 AC 94 ms
5,376 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 91 ms
5,376 KB
testcase_19 AC 73 ms
5,376 KB
testcase_20 AC 79 ms
5,376 KB
testcase_21 AC 62 ms
5,376 KB
testcase_22 AC 86 ms
5,376 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 139 ms
5,376 KB
testcase_26 AC 144 ms
5,376 KB
testcase_27 AC 37 ms
5,376 KB
testcase_28 AC 36 ms
5,376 KB
testcase_29 WA -
testcase_30 AC 36 ms
5,376 KB
testcase_31 AC 76 ms
5,376 KB
testcase_32 AC 140 ms
5,376 KB
testcase_33 AC 131 ms
5,376 KB
testcase_34 AC 130 ms
5,376 KB
testcase_35 AC 43 ms
5,376 KB
testcase_36 AC 99 ms
5,376 KB
testcase_37 AC 129 ms
5,376 KB
testcase_38 AC 117 ms
5,376 KB
testcase_39 AC 56 ms
5,376 KB
testcase_40 AC 61 ms
5,376 KB
testcase_41 AC 119 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=a[a.size()-1];
	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;
	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