結果

問題 No.406 鴨等間隔の法則
ユーザー Fujisaki_prprFujisaki_prpr
提出日時 2016-08-29 15:33:13
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 64 ms / 2,000 ms
コード長 1,453 bytes
コンパイル時間 1,669 ms
コンパイル使用メモリ 175,420 KB
実行使用メモリ 8,740 KB
最終ジャッジ日時 2023-09-21 18:04:17
合計ジャッジ時間 4,129 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 20 ms
5,244 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 56 ms
8,096 KB
testcase_05 AC 17 ms
5,116 KB
testcase_06 AC 18 ms
5,148 KB
testcase_07 AC 18 ms
5,208 KB
testcase_08 AC 53 ms
8,144 KB
testcase_09 AC 59 ms
8,648 KB
testcase_10 AC 21 ms
5,332 KB
testcase_11 AC 44 ms
7,480 KB
testcase_12 AC 25 ms
5,968 KB
testcase_13 AC 23 ms
5,760 KB
testcase_14 AC 46 ms
7,684 KB
testcase_15 AC 3 ms
4,380 KB
testcase_16 AC 4 ms
4,380 KB
testcase_17 AC 3 ms
4,376 KB
testcase_18 AC 4 ms
4,376 KB
testcase_19 AC 5 ms
4,384 KB
testcase_20 AC 6 ms
4,380 KB
testcase_21 AC 7 ms
4,376 KB
testcase_22 AC 11 ms
4,380 KB
testcase_23 AC 28 ms
6,028 KB
testcase_24 AC 42 ms
6,936 KB
testcase_25 AC 63 ms
8,624 KB
testcase_26 AC 63 ms
8,740 KB
testcase_27 AC 15 ms
4,376 KB
testcase_28 AC 41 ms
8,524 KB
testcase_29 AC 64 ms
8,648 KB
testcase_30 AC 61 ms
8,380 KB
testcase_31 AC 62 ms
8,272 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std ;

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) begin(r),end(r)
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)
#define vvl(v,w,h,init) vector<vector<ll>> v(w,vector<ll>(h,init))
#define mp(a,b) make_pair(a,b)

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

using ll = long long;
using pii = pair<int,int> ;
using pll = pair<ll,ll> ;

const int mod = 1000000007;
constexpr int inf = ((1<<30)-1)*2+1 ;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0,1,-1,1,-1};
const int dx[] = {0,-1,0,1,1,-1,-1,1};

inline bool value(int x,int y,int w,int h){
  return (x >= 0 && x < w && y >= 0 && y < h);
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n;
  cin >> n;
  vector<ll> v(n);
  set<ll> s;
  rep(i,n){
    cin >> v[i];
    s.insert(v[i]);
  }
  sort(all(v));
  rep(i,n-2){
    if(s.size() != n || v[i] - v[i+1] != v[i+1] - v[i+2]){
      cout << "NO"<<endl;
      return 0;
    }
  }
  cout << "YES"<<endl;
  return 0;
}

0