結果

問題 No.406 鴨等間隔の法則
ユーザー yukiteruyukiteru
提出日時 2017-09-19 20:23:00
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 742 bytes
コンパイル時間 932 ms
コンパイル使用メモリ 76,952 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-25 03:09:08
合計ジャッジ時間 3,586 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include<iostream>
#include<string>
#include<string.h>
#include<algorithm>
#include<stdio.h>
#include<cmath>
#include<vector>
#include<utility>
#define FOR(i, a, b) for(int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for(int i=(a);i>=(b);i--)
#define MOD 1000000007

using namespace std;


int main(void) {
	int n;
	int *x;
	int point;
	bool flag = true;

	cin >> n;
	x = new int[n];
	FOR(i, 0, n - 1) {
		cin >> x[i];
	}
	point = abs(x[2] - x[0]);
	FOR(i, 1, n - 2) {
		if (abs(x[i - 1] - x[i + 1]) != point) {
			flag = false;
			break;
		}
	}
	sort(x, x + n );
	FOR(i, 0, n - 2) {
		if (x[i] == x[i + 1]) {
			flag = false;
			break;
		}
	}
	if (flag) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}

	delete[] x;
	return 0;
}
0