結果
| 問題 |
No.406 鴨等間隔の法則
|
| コンテスト | |
| ユーザー |
Kazu05
|
| 提出日時 | 2019-03-23 10:07:07 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 21 ms / 2,000 ms |
| コード長 | 407 bytes |
| コンパイル時間 | 1,432 ms |
| コンパイル使用メモリ | 170,520 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-07-07 12:36:10 |
| 合計ジャッジ時間 | 2,758 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 29 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main() {
cin.sync_with_stdio(0), cin.tie(0), cout.tie(0);
int n;
int x[100010];
cin >> n;
for (int i = 0; i < n; i++) {
cin >> x[i];
}
sort(x, x + n);
int a = abs(x[1] - x[0]);
for (int i = 1; i < n; i++) {
int y = abs(x[i] - x[i - 1]);
if (a != y || x[i] == x[i - 1]) {
cout << "NO" << endl;
return 0;
}
}
cout << "YES" << endl;
}
Kazu05