結果

問題 No.406 鴨等間隔の法則
ユーザー Pachicobue
提出日時 2017-08-27 22:21:39
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 423 bytes
コンパイル時間 669 ms
コンパイル使用メモリ 75,668 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-11-07 10:49:07
合計ジャッジ時間 2,585 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21 WA * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
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 start = x[1];
int inte = x[1]-x[0];
if(inte == 0){
cout << "NO" << endl;
} else {
int pos = start;
for(int i = 2; i < n; i++){
if(x[i] != pos+inte){
cout << "NO" << endl;
return 0;
}
}
cout << "YES" << endl;
}

return 0;
}
0