結果

問題 No.406 鴨等間隔の法則
ユーザー language_43language_43
提出日時 2016-09-12 18:00:22
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 743 bytes
コンパイル時間 816 ms
コンパイル使用メモリ 77,976 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-04-24 20:58:22
合計ジャッジ時間 4,851 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 9 ms
9,088 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 AC 19 ms
5,376 KB
testcase_05 AC 8 ms
5,376 KB
testcase_06 AC 8 ms
5,376 KB
testcase_07 AC 9 ms
5,376 KB
testcase_08 AC 19 ms
5,376 KB
testcase_09 AC 21 ms
5,376 KB
testcase_10 AC 10 ms
5,376 KB
testcase_11 AC 17 ms
5,376 KB
testcase_12 AC 11 ms
5,376 KB
testcase_13 AC 10 ms
5,376 KB
testcase_14 TLE -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

# include <iostream>
# include <cstring>
# include <string>
# include <vector>
# include <cmath>
# include <sstream>
# include <iomanip>
# include <algorithm>
using namespace std;

# define repl(i, a, b)	for(int i=(int)(a);i<(int)(b);i++)
# define rep(i, n)	repl(i, 0, n)
typedef long long ll;

int main(){
	cin.sync_with_stdio(false);
	int n;
	cin >> n;
	vector<ll> v(n);
	rep(i, n){
		cin >> v[i];
	}

	sort(v.begin(), v.end());
	int r = abs(v[1] - v[0]);
	repl(i, 1, n-1){
		if(r != abs(v[i] - v[i+1])){
			//cout << r << endl;
			//cout << v[i+1] - v[i] << endl;
			cout << "NO" << endl;
			return 0;
		}
		repl(j, i ,n){
			if(i!=j && v[i] == v[j]){
				cout << "NO" << endl;
				return 0;
			}
		}
	}
	cout << "YES" << endl;
	return 0;
}
0