結果
| 問題 |
No.406 鴨等間隔の法則
|
| コンテスト | |
| ユーザー |
trineutron
|
| 提出日時 | 2020-02-21 05:21:35 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 60 ms / 2,000 ms |
| コード長 | 420 bytes |
| コンパイル時間 | 2,757 ms |
| コンパイル使用メモリ | 195,916 KB |
| 最終ジャッジ日時 | 2025-01-09 01:14:22 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 29 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> x(n);
for (int i = 0; i < n; i++) cin >> x[i];
sort(x.begin(), x.end());
int d = x[1] - x[0];
if (d == 0) {
puts("NO");
return 0;
}
for (int i = 2; i < n; i++) {
if (x[i] - x[i - 1] != d) {
puts("NO");
return 0;
}
}
puts("YES");
}
trineutron