結果
| 問題 | No.406 鴨等間隔の法則 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-08-26 01:30:35 |
| 言語 | C++11 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 32 ms / 2,000 ms |
| コード長 | 551 bytes |
| 記録 | |
| コンパイル時間 | 745 ms |
| コンパイル使用メモリ | 85,048 KB |
| 実行使用メモリ | 6,272 KB |
| 最終ジャッジ日時 | 2026-03-29 02:31:36 |
| 合計ジャッジ時間 | 2,223 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 29 |
ソースコード
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long lint;
#define MIN(a,b) ((a)<(b)?(a):(b))
#define MAX(a,b) ((a)>(b)?(a):(b))
int main()
{
lint N;
cin >> N;
vector<lint> x(N);
for (lint i = 0; i < N; i++)
cin >> x[i];
sort(x.begin(), x.end());
lint w = x[1] - x[0];
if (w == 0) {
cout << "NO" << endl;
return 0;
}
for (lint i = 0; i < x.size() - 1; i++) {
if (x[i + 1] - x[i] != w) {
cout << "NO" << endl;
return 0;
}
}
cout << "YES" << endl;
return 0;
}