結果

問題 No.1884 Sequence
ユーザー CleyLCleyL
提出日時 2022-03-25 21:29:53
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 2,719 bytes
コンパイル時間 1,519 ms
コンパイル使用メモリ 120,132 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-22 06:05:30
合計ジャッジ時間 3,175 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 WA -
testcase_09 AC 2 ms
5,376 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 7 ms
5,376 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 6 ms
5,376 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 6 ms
5,376 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 6 ms
5,376 KB
testcase_24 AC 6 ms
5,376 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 13 ms
5,376 KB
testcase_28 AC 8 ms
5,376 KB
testcase_29 AC 12 ms
5,376 KB
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 AC 5 ms
5,376 KB
testcase_34 AC 6 ms
5,376 KB
testcase_35 AC 6 ms
5,376 KB
testcase_36 AC 6 ms
5,376 KB
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 AC 6 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

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<int> A;
  int zero = 0;
  set<int> X;
  bool same = false;
  for(int i = 0; n > i; i++){
    int 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<int> B;
  int 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]);
  }
  int x = (A[A.size()-1]-A[0])/mn+2;
  if(x <= n){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  
}
0