結果

問題 No.406 鴨等間隔の法則
ユーザー r2en_
提出日時 2017-07-05 00:42:42
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 46 ms / 2,000 ms
コード長 531 bytes
コンパイル時間 587 ms
コンパイル使用メモリ 75,660 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-07-07 12:07:59
合計ジャッジ時間 2,322 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main(){
    vector<double> V;
    int vec = 0; int intval = 0;
    int n = 0; cin >> n;
    for(int i = 0; i < n; ++i){
        cin >> vec;
        V.push_back(vec);
    }
    sort(V.begin(),V.end(), greater<int>());
    intval = V[0] - V[1];
    for(int i = 0; i < n - 1; ++i){
        if(V[i] != V[i+1]+intval || V[i] == V[i+1]){
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;
    return 0;
}
0