結果
| 問題 | No.406 鴨等間隔の法則 |
| コンテスト | |
| ユーザー |
srup٩(๑`н´๑)۶
|
| 提出日時 | 2016-08-06 00:25:05 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 43 ms / 2,000 ms |
| コード長 | 521 bytes |
| コンパイル時間 | 615 ms |
| コンパイル使用メモリ | 64,104 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-07 11:29:19 |
| 合計ジャッジ時間 | 2,082 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 29 |
ソースコード
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
int main(void){
int n; cin >> n;
vector<int> x(n);
rep(i, n) cin >> x[i];
sort(x.begin(), x.end());
int sa = x[1] - x[0];//一つの場所の差を求めておく
if(sa == 0){//同じ位置にある
printf("NO\n");
return 0;
}
for (int i = 1; i < n - 1; ++i){
if(sa != x[i + 1] - x[i]){//2点間の距離が異なる
printf("NO\n");
return 0;
}
}
printf("YES\n");
return 0;
}
srup٩(๑`н´๑)۶