結果

問題 No.1884 Sequence
ユーザー CleyLCleyL
提出日時 2022-03-25 21:33:10
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 2,796 bytes
コンパイル時間 1,607 ms
コンパイル使用メモリ 121,688 KB
実行使用メモリ 17,256 KB
最終ジャッジ日時 2024-04-22 06:10:00
合計ジャッジ時間 6,204 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 AC 217 ms
17,128 KB
testcase_11 AC 218 ms
17,256 KB
testcase_12 AC 11 ms
5,376 KB
testcase_13 AC 11 ms
5,376 KB
testcase_14 AC 12 ms
5,376 KB
testcase_15 AC 95 ms
10,204 KB
testcase_16 AC 219 ms
17,248 KB
testcase_17 AC 43 ms
7,140 KB
testcase_18 AC 75 ms
10,852 KB
testcase_19 AC 58 ms
9,444 KB
testcase_20 AC 70 ms
8,804 KB
testcase_21 AC 44 ms
6,504 KB
testcase_22 WA -
testcase_23 AC 219 ms
17,128 KB
testcase_24 AC 218 ms
17,128 KB
testcase_25 AC 218 ms
17,128 KB
testcase_26 AC 215 ms
17,120 KB
testcase_27 AC 13 ms
5,376 KB
testcase_28 AC 12 ms
5,376 KB
testcase_29 AC 13 ms
5,376 KB
testcase_30 WA -
testcase_31 AC 65 ms
7,740 KB
testcase_32 AC 183 ms
13,540 KB
testcase_33 AC 42 ms
5,472 KB
testcase_34 AC 42 ms
5,476 KB
testcase_35 AC 15 ms
5,376 KB
testcase_36 AC 32 ms
5,376 KB
testcase_37 AC 42 ms
5,604 KB
testcase_38 AC 39 ms
5,376 KB
testcase_39 AC 19 ms
5,376 KB
testcase_40 AC 21 ms
5,376 KB
testcase_41 AC 155 ms
14,552 KB
testcase_42 AC 153 ms
14,688 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<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+1;
  //cout << x << " " << n << endl;
  if(x <= n){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  
}
0