結果
| 問題 |
No.406 鴨等間隔の法則
|
| コンテスト | |
| ユーザー |
SSRS
|
| 提出日時 | 2020-07-28 21:24:58 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 47 ms / 2,000 ms |
| コード長 | 405 bytes |
| コンパイル時間 | 1,438 ms |
| コンパイル使用メモリ | 172,196 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-28 20:55:48 |
| 合計ジャッジ時間 | 3,928 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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());
vector<int> d(N - 1);
for (int i = 0; i < N - 1; i++){
d[i] = x[i + 1] - x[i];
}
sort(d.begin(), d.end());
if (d[0] == d[N - 2] && d[0] != 0){
cout << "YES" << endl;
} else {
cout << "NO" << endl;
}
}
SSRS