結果
| 問題 |
No.406 鴨等間隔の法則
|
| コンテスト | |
| ユーザー |
iroha168
|
| 提出日時 | 2017-01-12 19:19:57 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 79 ms / 2,000 ms |
| コード長 | 615 bytes |
| コンパイル時間 | 795 ms |
| コンパイル使用メモリ | 102,376 KB |
| 実行使用メモリ | 8,576 KB |
| 最終ジャッジ日時 | 2024-07-07 11:56:15 |
| 合計ジャッジ時間 | 2,868 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 29 |
ソースコード
#include<string>
#include<iostream>
#include<algorithm>
#include<set>
#include<math.h>
#include<vector>
#include<sstream>
#include<queue>
#include<functional>
#include<bitset>
#include<cstdio>
#include<iomanip>
using namespace std;
int x[100000];
int main() {
int n;
set<int> set;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> x[i];
set.insert(x[i]);
}
if (set.size() != n) {
cout << "NO" << endl;
return 0;
}
sort(x, x + n);
int dif = x[1] - x[0];
for (int i = 2; i < n - 1; i++) {
if (x[i + 1] - x[i] != dif) {
cout << "NO" << endl;
return 0;
}
}
cout << "YES" << endl;
return 0;
}
iroha168