結果

問題 No.406 鴨等間隔の法則
ユーザー th90tk297
提出日時 2017-11-29 17:51:36
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 52 ms / 2,000 ms
コード長 333 bytes
コンパイル時間 671 ms
コンパイル使用メモリ 72,876 KB
最終ジャッジ日時 2025-01-05 04:32:19
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<algorithm>
using namespace std;
int main() {
	int n; cin >> n;
	long long a[114514]; for (int i = 0; i < n; i++)cin >> a[i]; sort(a, a + n);
	for (int i = 1; i < n - 1; i++)if (a[i] - a[i - 1] != a[i + 1] - a[i] || a[i - 1] == a[i] || a[i] == a[i + 1]) {
		cout << "NO\n"; return 0;
	}
	cout << "YES\n";
}
0