結果

問題 No.406 鴨等間隔の法則
ユーザー 👑 CleyL
提出日時 2020-01-16 17:00:14
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 520 bytes
コンパイル時間 809 ms
コンパイル使用メモリ 76,152 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-06-23 21:51:58
合計ジャッジ時間 3,422 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1
other AC * 10 WA * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
    int n;cin>>n;
    vector<int> a(n);
    for(int i = 0; n > i; i++){
        cin>>a[i];
    }
    sort(a.begin(),a.end());
    int k = 0;
    for(int i = 1; n > i; i++){
        if(!(a[i]-a[i-1])){
            cout << "NO" << endl;
            return 0;
        }
        if(i==1){
            k = a[i]-a[i-1];
        }else if(k != a[i]-a[i-1]){
            cout << "NO" << endl;
        }
    }
    cout << "YES" << endl;
}
0