結果

問題 No.1884 Sequence
ユーザー ytqm3ytqm3
提出日時 2022-04-07 13:29:56
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 632 bytes
コンパイル時間 2,098 ms
コンパイル使用メモリ 206,440 KB
実行使用メモリ 8,084 KB
最終ジャッジ日時 2023-08-18 17:22:03
合計ジャッジ時間 10,174 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 RE -
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 129 ms
7,712 KB
testcase_11 AC 130 ms
7,772 KB
testcase_12 AC 24 ms
4,376 KB
testcase_13 AC 27 ms
4,380 KB
testcase_14 AC 25 ms
4,560 KB
testcase_15 AC 81 ms
6,204 KB
testcase_16 AC 153 ms
7,844 KB
testcase_17 AC 63 ms
5,752 KB
testcase_18 AC 79 ms
6,400 KB
testcase_19 AC 63 ms
6,044 KB
testcase_20 AC 69 ms
5,876 KB
testcase_21 AC 53 ms
5,648 KB
testcase_22 AC 74 ms
6,272 KB
testcase_23 AC 154 ms
8,000 KB
testcase_24 AC 155 ms
7,644 KB
testcase_25 AC 122 ms
8,044 KB
testcase_26 AC 128 ms
7,848 KB
testcase_27 RE -
testcase_28 AC 30 ms
4,612 KB
testcase_29 AC 30 ms
4,924 KB
testcase_30 AC 30 ms
4,732 KB
testcase_31 AC 68 ms
5,744 KB
testcase_32 AC 123 ms
7,708 KB
testcase_33 AC 114 ms
6,672 KB
testcase_34 AC 114 ms
6,996 KB
testcase_35 AC 36 ms
4,848 KB
testcase_36 AC 84 ms
5,760 KB
testcase_37 AC 116 ms
7,776 KB
testcase_38 AC 105 ms
8,036 KB
testcase_39 AC 48 ms
5,348 KB
testcase_40 AC 52 ms
5,692 KB
testcase_41 AC 103 ms
8,084 KB
testcase_42 AC 123 ms
6,984 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using i64=long long;

int main(){
  i64 N;
  cin>>N;
  vector<i64> a(N);
  for(auto& v:a){
    cin>>v;
  }
  vector<i64> A;
  for(auto& v:a){
    if(v!=0){
      A.emplace_back(v);
    }
  }
  int n=A.size();
  sort(A.begin(),A.end());
  i64 now=1,k=A.back()-A[0];
  if(k==0){
    puts("Yes");
    return 0;
  }
  auto B=A;
  if(unique(B.begin(),B.end())!=B.end()){
    puts("No");
    return 0;
  }
  for(int i=1;i<n-1;++i){
    i64 t=k/gcd(k,A[i]-A[0]);
    if(t/gcd(now,t)<=(N-1)/now){
      now=lcm(t,now);
    }
    else{
      puts("No");
      return 0;
    }
  }
  puts("Yes");
}
0