結果

問題 No.406 鴨等間隔の法則
ユーザー dnk
提出日時 2016-08-05 22:46:51
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 22 ms / 2,000 ms
コード長 388 bytes
コンパイル時間 1,377 ms
コンパイル使用メモリ 160,088 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-07 11:25:35
合計ジャッジ時間 2,747 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

const int N = (int) 1e5;
int x[N];

int main() {
    ios::sync_with_stdio(false);
    int n; cin >> n;
    for (int i = 0; i < n; ++i) cin >> x[i];
    sort(x, x + n);
    for (int i = 0; i + 1 < n; ++i) if (x[i + 1] - x[i] != x[1] - x[0])
        return cout << "NO\n", 0;
    cout << (x[0] == x[1] ? "NO" : "YES") << endl;
    return 0;
}
0