結果
| 問題 |
No.406 鴨等間隔の法則
|
| コンテスト | |
| ユーザー |
Kaz_nl
|
| 提出日時 | 2017-08-26 12:04:18 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 46 ms / 2,000 ms |
| コード長 | 414 bytes |
| コンパイル時間 | 487 ms |
| コンパイル使用メモリ | 64,708 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-07 12:10:19 |
| 合計ジャッジ時間 | 2,215 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 29 |
ソースコード
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main() {
int n, b, c;
bool f = true;
cin >> n;
vector<int> a(n);
for (auto& e : a) cin >> e;
sort(a.begin(), a.end());
int d = a[1] - a[0];
for (int i = 1; i < n - 1; i++) {
if (a[i + 1] - a[i] != d) {
f = false;
break;
}
}
if (d && f) cout << "YES" << endl;
else cout << "NO" << endl;
}
Kaz_nl