結果
| 問題 |
No.406 鴨等間隔の法則
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-03-29 23:28:23 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 511 bytes |
| コンパイル時間 | 1,627 ms |
| コンパイル使用メモリ | 197,276 KB |
| 最終ジャッジ日時 | 2025-02-20 15:37:16 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 WA * 1 |
| other | AC * 27 WA * 2 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> x(n);
int distance;
bool f = true;
for (auto &i : x) {
cin >> i;
}
sort(x.begin(), x.end());
distance = x[1] - x[0];
for (int i = 2; i != x.size(); i++) {
if (distance != x[i] - x[i - 1]) {
f = false;
break;
}
}
if (f) {
cout << "YES" << endl;
} else {
cout << "NO" << endl;
}
// system("pause");
}