結果

問題 No.1884 Sequence
ユーザー 沙耶花沙耶花
提出日時 2022-03-25 21:28:04
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 970 bytes
コンパイル時間 4,472 ms
コンパイル使用メモリ 256,808 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-22 06:03:01
合計ジャッジ時間 8,711 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 WA -
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 1 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 27 ms
5,376 KB
testcase_13 AC 29 ms
5,376 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 124 ms
5,376 KB
testcase_17 AC 56 ms
5,376 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 123 ms
5,376 KB
testcase_24 AC 125 ms
5,376 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 31 ms
5,376 KB
testcase_28 AC 31 ms
5,376 KB
testcase_29 AC 31 ms
5,376 KB
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 AC 115 ms
5,376 KB
testcase_34 AC 116 ms
5,376 KB
testcase_35 AC 39 ms
5,376 KB
testcase_36 AC 87 ms
5,376 KB
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 AC 100 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace atcoder;
using mint = modint998244353;
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define Inf 1000000001


int main(){
	
	int n;
	cin>>n;
	
	vector<long long> a(n);
	rep(i,n){
		cin>>a[i];
	}
	sort(a.begin(),a.end());
	if(a.back()==0 || a[n-2]==0){
		cout<<"Yes"<<endl;
		return 0;
	}
	int zero = 0;
	rep(i,n){
		if(a[i]==0)zero++;
	}
	long long g = 0;
	rep(i,n){
		if(a[i]==0)continue;
		g = gcd(g,a.back()-a[i]);
	}
	long long m = a.back();
	long long M = a.back();
	if(m==M){
		cout<<"Yes"<<endl;
		return 0;
	}
	rep(i,a.size()){
		if(a[i]!=0)m = min(a[i],m);
	}
	vector<long long> y;
	for(long long i=1;i*i<=g;i++){
		if(g%i==0){
			y.push_back(i);
			if(i*i!=g)y.push_back(g/i);
		}
	}
	
	rep(i,y.size()){
		long long T = a.back() - m;
		T /= y[i];
		T ++;
		T -= (n-zero);
		if(T<=zero){
			cout<<"Yes"<<endl;
			return 0;
		}
	}
	cout<<"No"<<endl;
	
	return 0;
}
0