結果

問題 No.1884 Sequence
ユーザー CleyLCleyL
提出日時 2022-03-25 21:31:03
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 2,761 bytes
コンパイル時間 1,382 ms
コンパイル使用メモリ 120,500 KB
実行使用メモリ 17,380 KB
最終ジャッジ日時 2024-04-22 06:07:06
合計ジャッジ時間 4,882 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 2 ms
5,248 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 AC 1 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 WA -
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 149 ms
17,248 KB
testcase_11 AC 147 ms
17,252 KB
testcase_12 AC 9 ms
5,376 KB
testcase_13 AC 10 ms
5,376 KB
testcase_14 AC 10 ms
5,376 KB
testcase_15 AC 72 ms
10,080 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 72 ms
10,852 KB
testcase_19 AC 56 ms
9,440 KB
testcase_20 AC 58 ms
8,808 KB
testcase_21 AC 37 ms
6,624 KB
testcase_22 WA -
testcase_23 AC 148 ms
17,120 KB
testcase_24 AC 154 ms
17,120 KB
testcase_25 AC 150 ms
17,124 KB
testcase_26 AC 149 ms
17,248 KB
testcase_27 AC 12 ms
5,376 KB
testcase_28 AC 11 ms
5,376 KB
testcase_29 AC 12 ms
5,376 KB
testcase_30 WA -
testcase_31 AC 52 ms
7,780 KB
testcase_32 AC 124 ms
13,544 KB
testcase_33 AC 37 ms
5,476 KB
testcase_34 AC 39 ms
5,476 KB
testcase_35 AC 14 ms
5,376 KB
testcase_36 AC 29 ms
5,376 KB
testcase_37 AC 38 ms
5,476 KB
testcase_38 AC 35 ms
5,480 KB
testcase_39 AC 17 ms
5,376 KB
testcase_40 AC 18 ms
5,376 KB
testcase_41 AC 117 ms
14,432 KB
testcase_42 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

//coder:luckYrat(twitter:@luckYrat_)
//おすすめの曲 無機質世界に彩を-MisomyL
//https://www.youtube.com/watch?v=8G590EiLQ3E

//標準入出力
#include <iostream>

#include <cmath>
#include <algorithm>

#include <iomanip>

//コンテナ系
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>

#include <bitset>

//複素数
#include <complex>

#include <cctype>
#include <utility>
#include <climits>

#include <numeric>

//なまえくーかん!
using namespace std;
using ll = long long;
using P = pair<ll,ll>;

//てーすう!
const ll MOD = 1000000007;
const ll MOD9 = 998244353;
const int inf = (1<<30)-1;
const ll linf = (1LL<<62LL)-1;
const double EPS = (1e-10);

//でふぁいん!
#define anyfill(n,s) setw(n) << setfill(s)
#define loop(s) for(int (i) = 0; (s) > (i); (i)++)
#define rep(i,q) for(int (i) = 0; (q) > (i); (i)++)
#define repp(i,n,q) for(int (i) = (n); (q) > (i); (i)++)
#define dep(i,q) for(int (i) = (q); 0 < (i); (i)--)

//みじかく!
#define pb push_back
#define mkp make_pair
#define fir first
#define scn second

//きんぼーnほーこー!!
P ar4[4] = {mkp(0,1),mkp(0,-1),mkp(1,0),mkp(-1,0)};
P ar8[8] = {mkp(-1,-1),mkp(-1,0),mkp(-1,1),mkp(0,-1),mkp(0,1),mkp(1,-1),mkp(1,0),mkp(1,1)};


template <typename T> vector<T> make_vector(size_t a, T b) { return vector<T>(a, b); }
template <typename... Ts> auto make_vector(size_t a, Ts... ts) { return vector<decltype(make_vector(ts...))>(a, make_vector(ts...)); }
 
 /*
確認ポイント
cout << fixed << setprecision(n) << 小数計算//n桁の小数表記になる

計算量は変わらないが楽できるシリーズ
min(max)_element(iter,iter)で一番小さい(大きい)値のポインタが帰ってくる
count(iter,iter,int)でintがiterからiterの間にいくつあったかを取得できる
*/
__attribute__((constructor))
void initial() {
 cin.tie(0);
 ios::sync_with_stdio(false);
}

int main(){
  int n;cin>>n;
  vector<long long> A;
  long long zero = 0;
  set<long long> X;
  bool same = false;
  for(int i = 0; n > i; i++){
    long long t;cin>>t;
    if(t){
      if(X.count(t)){
        same = true;
      }
      X.insert(t);
      A.push_back(t);
    }else{
      zero++;
    }
  }
  if(same){
    if(X.size() == 1){
      cout << "Yes" << endl;
    }else{
      cout << "No" << endl;
    }
    return 0;
  }
  if(A.size() <= 2){
    cout << "Yes" << endl;
    return 0;
  }
  sort(A.begin(),A.end());
  vector<long long> B;
  long long mn = A[1]-A[0];
  for(int i = 0; A.size()-1 > i; i++){
    B.push_back(A[i+1]-A[i]);
    mn = min(mn,A[i+1]-A[i]);
  }
  long long x = (A[A.size()-1]-A[0])/mn+2;
  if(x <= n){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  
}
0