結果

問題 No.406 鴨等間隔の法則
ユーザー snrnsidysnrnsidy
提出日時 2021-06-15 00:52:19
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 525 bytes
コンパイル時間 2,005 ms
コンパイル使用メモリ 202,684 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-26 15:20:30
合計ジャッジ時間 4,531 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

int main(void)
{
	cin.tie(0);
	ios::sync_with_stdio(false);

	int n, t;
	vector <int> v;

	cin >> n;

	for (int i = 0; i < n; i++)
	{
		cin >> t;
		v.push_back(t);
	}

	sort(v.begin(), v.end());

	for (int i = 1; i < n; i++)
	{
		if (v[i - 1] == v[i])
		{
			cout << "NO" << '\n';
			return 0;
		}
	}

	for (int i = 1; i < n - 1; i++)
	{
		if (abs(v[i] - v[i - 1]) == abs(v[i + 1] - v[i]))
		{
			cout << "NO" << '\n';
			return 0;
		}
	}

	cout << "YES" << '\n';
	return 0;
}
0