結果

問題 No.1884 Sequence
ユーザー SSRSSSRS
提出日時 2022-03-25 21:24:35
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 679 bytes
コンパイル時間 2,208 ms
コンパイル使用メモリ 200,988 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-22 05:58:24
合計ジャッジ時間 6,700 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 AC 2 ms
5,376 KB
testcase_09 WA -
testcase_10 AC 146 ms
5,376 KB
testcase_11 AC 146 ms
5,376 KB
testcase_12 AC 28 ms
5,376 KB
testcase_13 AC 31 ms
5,376 KB
testcase_14 AC 29 ms
5,376 KB
testcase_15 AC 87 ms
5,376 KB
testcase_16 AC 137 ms
5,376 KB
testcase_17 AC 61 ms
5,376 KB
testcase_18 AC 86 ms
5,376 KB
testcase_19 AC 68 ms
5,376 KB
testcase_20 AC 76 ms
5,376 KB
testcase_21 AC 59 ms
5,376 KB
testcase_22 AC 83 ms
5,376 KB
testcase_23 AC 138 ms
5,376 KB
testcase_24 AC 138 ms
5,376 KB
testcase_25 AC 131 ms
5,376 KB
testcase_26 AC 137 ms
5,376 KB
testcase_27 AC 35 ms
5,376 KB
testcase_28 AC 36 ms
5,376 KB
testcase_29 AC 35 ms
5,376 KB
testcase_30 AC 35 ms
5,376 KB
testcase_31 AC 73 ms
5,376 KB
testcase_32 WA -
testcase_33 AC 125 ms
5,376 KB
testcase_34 AC 126 ms
5,376 KB
testcase_35 AC 41 ms
5,376 KB
testcase_36 AC 95 ms
5,376 KB
testcase_37 AC 127 ms
5,376 KB
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 AC 113 ms
5,376 KB
testcase_42 AC 113 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  vector<long long> A(N);
  for (int i = 0; i < N; i++){
    cin >> A[i];
  }
  sort(A.begin(), A.end());
  long long g = 0;
  long long mn = 0;
  for (int i = 0; i < N - 1; i++){
    if (A[i] != 0){
      if (mn == 0){
        mn = A[i];
      }
      g = gcd(g, A[i + 1] - A[i]);
    }
  }
  if (mn == 0){
    mn = A[N - 1];
  }
  long long mx = A[N - 1];
  if (mn == 0){
    cout << "Yes" << endl;
  } else if (g == 0){
    cout << "Yes" << endl;
  } else {
    long long cnt = (mx - mn) / g + 1;
    if (cnt <= N){
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  }
}
0