結果
問題 |
No.406 鴨等間隔の法則
|
ユーザー |
![]() |
提出日時 | 2016-08-05 22:32:08 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 17 ms / 2,000 ms |
コード長 | 622 bytes |
コンパイル時間 | 1,115 ms |
コンパイル使用メモリ | 164,232 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-07 11:19:36 |
合計ジャッジ時間 | 2,504 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 29 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; using vl = vector<ll>; using vvl = vector<vl>; #define REP(i,n) for(ll i = 0; i < (n); ++i) #define ALL(c) (c).begin(), (c).end() int main() { cin.tie(0); ios_base::sync_with_stdio(false); cout << fixed << setprecision(50); ll n; cin >> n; vl x(n); REP(i, n) cin >> x[i]; sort(ALL(x)); x.erase(unique(ALL(x)), x.end()); if (x.size() != n) { cout << "NO" << endl; return 0; } ll diff = abs(x[1] - x[0]); REP(i, x.size() - 1) if (diff != x[i + 1] - x[i]) { cout << "NO" << endl; return 0; } cout << "YES" << endl; return 0; }