結果

問題 No.2682 Visible Divisible
ユーザー MMMM
提出日時 2024-03-20 21:33:02
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 245 ms / 2,000 ms
コード長 895 bytes
コンパイル時間 3,762 ms
コンパイル使用メモリ 229,680 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-03-20 21:33:10
合計ジャッジ時間 7,998 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 243 ms
6,676 KB
testcase_01 AC 212 ms
6,676 KB
testcase_02 AC 213 ms
6,676 KB
testcase_03 AC 229 ms
6,676 KB
testcase_04 AC 155 ms
6,676 KB
testcase_05 AC 184 ms
6,676 KB
testcase_06 AC 218 ms
6,676 KB
testcase_07 AC 245 ms
6,676 KB
testcase_08 AC 2 ms
6,676 KB
testcase_09 AC 2 ms
6,676 KB
testcase_10 AC 2 ms
6,676 KB
testcase_11 AC 214 ms
6,676 KB
testcase_12 AC 214 ms
6,676 KB
testcase_13 AC 205 ms
6,676 KB
testcase_14 AC 194 ms
6,676 KB
testcase_15 AC 181 ms
6,676 KB
testcase_16 AC 158 ms
6,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
#include<atcoder/all>
#define chmin(x,y) (x) = min((x),(y))
#define chmax(x,y) (x) = max((x),(y))
#define ld long double
using namespace std;
using namespace atcoder;
using ll = long long;
const ll mod = 998244353;
using mint = modint998244353;
//using Graph = vector<vector<pair<int,int>>>;
using Graph = vector<vector<int>>;
const vector<int> dx = {1,0,-1,0}, dy = {0,1,0,-1};

ll sqrtll(ll x) {
  assert(x >= 0);
  ll hi(x), lo(0);
  while (hi != lo) {
    ll y = (hi + lo + 1) / 2;
    if (y <= x/y) lo = y;
    else hi = y - 1;
  }
  return lo;
}


int main(){
  // input 
  int N; ll K;
  cin >> N >> K;
  vector<ll> A(N);
  for(int i = 0; i < N; i++) cin >> A[i];
  
  // solve
  ll L = 1;
  for(int i = 0; i < N; i++){
    ll g = __gcd(A[i],K);
    ll div = g / __gcd(g,L);
    K /= div;
    L *= div;
  }
  
  // output
  cout << (K == 1 ? "Yes":"No") << endl;
}
0