結果

問題 No.406 鴨等間隔の法則
ユーザー mine691
提出日時 2019-03-27 19:54:53
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 524 bytes
コンパイル時間 1,790 ms
コンパイル使用メモリ 172,324 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-11 02:25:20
合計ジャッジ時間 3,695 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1
other AC * 27 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll mod = 1e9 + 7;
const ll inf = (1 << 30) - 1;
const ll infll = (1LL << 61) - 1;

int n, d;

int main()
{
    cin >> n;
    vector<int> a;
    for (int i = 0; i < n; i++)
    {
        int p;
        cin >> p;
        a.push_back(p);
    }
    bool f = 1;
    sort(a.begin(), a.end());
    d = a[1] - a[0];
    for (int i = 2; i < n; i++)
    {
        if (a[i - 1] + d!= a[i])
            f = false;
    }

    cout << (f ? "YES" : "NO") << endl;
}
0