結果

問題 No.406 鴨等間隔の法則
ユーザー dekomori_sanaedekomori_sanae
提出日時 2020-01-17 20:54:47
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 79 ms / 2,000 ms
コード長 1,128 bytes
コンパイル時間 891 ms
コンパイル使用メモリ 92,284 KB
実行使用メモリ 8,720 KB
最終ジャッジ日時 2023-09-21 19:11:20
合計ジャッジ時間 3,534 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
5,304 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 70 ms
8,184 KB
testcase_05 AC 24 ms
5,108 KB
testcase_06 AC 25 ms
5,012 KB
testcase_07 AC 26 ms
5,152 KB
testcase_08 AC 69 ms
8,116 KB
testcase_09 AC 78 ms
8,304 KB
testcase_10 AC 30 ms
5,296 KB
testcase_11 AC 58 ms
7,196 KB
testcase_12 AC 37 ms
5,704 KB
testcase_13 AC 33 ms
5,636 KB
testcase_14 AC 63 ms
7,552 KB
testcase_15 AC 3 ms
4,376 KB
testcase_16 AC 6 ms
4,376 KB
testcase_17 AC 3 ms
4,376 KB
testcase_18 AC 6 ms
4,376 KB
testcase_19 AC 6 ms
4,380 KB
testcase_20 AC 9 ms
4,376 KB
testcase_21 AC 9 ms
4,376 KB
testcase_22 AC 16 ms
4,384 KB
testcase_23 AC 38 ms
5,884 KB
testcase_24 AC 54 ms
6,984 KB
testcase_25 AC 77 ms
8,536 KB
testcase_26 AC 79 ms
8,564 KB
testcase_27 AC 37 ms
4,376 KB
testcase_28 AC 65 ms
8,720 KB
testcase_29 AC 78 ms
8,720 KB
testcase_30 AC 77 ms
8,408 KB
testcase_31 AC 74 ms
8,256 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
typedef vector<vector<P>> vvP;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;

int main() {
    ll n;
    cin >> n;

    set<ll> st;
    vl x(n);
    rep(i, n) {
        cin >> x[i];
        st.insert(x[i]);
    }
    sort(all(x));

    if(st.size() != n) {
        out("NO");
        re0;
    }

    ll u = x[1] - x[0];
    rep(i, n-1) {
        if(u != x[i+1] - x[i]) {
            out("NO");
            re0;
        }
    }
    
    out("YES");
    re0;
}
0