結果
| 問題 | No.406 鴨等間隔の法則 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-02-18 18:12:16 |
| 言語 | C++11 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 31 ms / 2,000 ms |
| コード長 | 452 bytes |
| 記録 | |
| コンパイル時間 | 618 ms |
| コンパイル使用メモリ | 76,672 KB |
| 実行使用メモリ | 6,144 KB |
| 最終ジャッジ日時 | 2026-03-29 02:42:03 |
| 合計ジャッジ時間 | 1,735 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 29 |
ソースコード
#include <iostream>
#include <algorithm>
#include <string>
#include <cstdio>
using namespace std;
int main()
{
int n;
cin >> n;
int a[n];
for (auto& x : a) cin >> x;
sort(a, a + n);
int d;
for (int i = 0; i < n - 1; i++) {
if (a[i] == a[i + 1]) return cout << "NO\n", 0;
if (!i) d = a[i + 1] - a[i];
if (a[i + 1] - a[i] != d) return cout << "NO\n", 0;
}
cout << "YES\n";
return 0;
}