結果

問題 No.406 鴨等間隔の法則
ユーザー kyawashell
提出日時 2017-12-08 17:54:30
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 60 ms / 2,000 ms
コード長 903 bytes
コンパイル時間 1,091 ms
コンパイル使用メモリ 103,216 KB
最終ジャッジ日時 2025-01-05 05:00:21
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<climits>
#include<iostream>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<list>
#include<map>
#include<set>
#include<complex>

typedef long long ll;
typedef unsigned long long ull;
using namespace std;
#define pb push_back
int dy[]={0, 0, 1, -1, 1, 1, -1, -1};
int dx[]={1, -1, 0, 0, 1, -1, -1, 1};

#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define mp make_pair
#define fi first
#define sc second

int n;
int x[200000];

int main(){
	cin >> n;
	REP(i,n)
		cin >> x[i];

	sort(x,x + n);

	bool f = (x[1] - x[0] > 0);

	REP(i,n - 1){
		if(x[i + 1] - x[i] != x[1] - x[0]){
			f = false;
			break;
		}
	}

	cout << ((f) ? "YES" : "NO") << endl;
	return 0;
}
0