結果

問題 No.1884 Sequence
ユーザー harurunharurun
提出日時 2022-03-25 22:51:01
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,202 bytes
コンパイル時間 3,522 ms
コンパイル使用メモリ 180,896 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-22 07:37:32
合計ジャッジ時間 7,965 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 1 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 AC 2 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 140 ms
6,528 KB
testcase_11 AC 139 ms
6,656 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 28 ms
5,376 KB
testcase_15 AC 88 ms
5,632 KB
testcase_16 AC 142 ms
6,528 KB
testcase_17 AC 60 ms
5,504 KB
testcase_18 AC 86 ms
5,760 KB
testcase_19 AC 68 ms
5,376 KB
testcase_20 AC 74 ms
5,504 KB
testcase_21 AC 56 ms
5,376 KB
testcase_22 AC 80 ms
5,504 KB
testcase_23 AC 141 ms
6,656 KB
testcase_24 AC 141 ms
6,528 KB
testcase_25 AC 134 ms
6,656 KB
testcase_26 AC 140 ms
6,656 KB
testcase_27 AC 33 ms
5,376 KB
testcase_28 AC 32 ms
5,376 KB
testcase_29 AC 32 ms
5,376 KB
testcase_30 AC 32 ms
5,376 KB
testcase_31 AC 72 ms
5,376 KB
testcase_32 AC 132 ms
6,528 KB
testcase_33 AC 127 ms
6,400 KB
testcase_34 AC 127 ms
6,528 KB
testcase_35 AC 38 ms
5,376 KB
testcase_36 AC 94 ms
5,888 KB
testcase_37 AC 128 ms
6,656 KB
testcase_38 AC 115 ms
6,528 KB
testcase_39 AC 52 ms
5,376 KB
testcase_40 AC 56 ms
5,376 KB
testcase_41 AC 118 ms
6,016 KB
testcase_42 AC 114 ms
6,016 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <deque>
#include <queue>
#include <string>
#include <iomanip>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <utility>
#include <stdio.h>
#include <math.h>
#include <assert.h>
#if __has_include(<atcoder/all>)
#include <atcoder/all>
using namespace atcoder;
#endif
using namespace std;
using ll=long long;

int main(){
  ll N;
  cin>>N;
  vector<ll>A(N);
  for(int i=0;i<N;i++){
    cin>>A[i];
  }
  ll cnt=0;
  vector<ll> B;
  B.reserve(N);
  for(int i=0;i<N;i++){
    if(A[i]==0){
      cnt++;
    }else{
      B.emplace_back(A[i]);
    }
  }
  sort(B.begin(),B.end());
  ll sa=1000000000000000LL;
  for(int i=0;i<(int)B.size()-1;i++){
    sa=min(sa,B[i+1]-B[i]);
  }
  if(sa==0){
    for(ll i:B){
      if(i!=B[0]){
        cout<<"No"<<endl;
        return 0;
      }
    }
    cout<<"Yes"<<endl;
    return 0;
  }
  ll must=0;
  for(int i=0;i<(int)B.size()-1;i++){
    if((B[i+1]-B[i])%sa){
      cout<<"No"<<endl;
      return 0;
    }
    must+=(B[i+1]-B[i])/sa-1;
  }
  //cerr<<sa<<" "<<must<<" "<<cnt<<endl;
  if(must>cnt){
    cout<<"No"<<endl;
  }else{
    cout<<"Yes"<<endl;
  }
}

0