結果
問題 | No.1250 汝は倍数なりや? |
ユーザー |
![]() |
提出日時 | 2021-02-05 15:33:38 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 33 ms / 1,000 ms |
コード長 | 2,005 bytes |
コンパイル時間 | 1,997 ms |
コンパイル使用メモリ | 197,804 KB |
最終ジャッジ日時 | 2025-01-18 11:46:27 |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 49 |
ソースコード
//#pragma GCC target("avx2")//#pragma GCC optimize("O3")//#pragma GCC optimize("unroll-loops")#include <bits/stdc++.h>#define ll long long#define ull unsigned long long#define ld long double#define rep(i, n) for(int i = 0; i < n; ++i)#define rep2(i, a, b) for(int i = a; i <= b; ++i)#define rrep(i, a, b) for(int i = a; i >= b; --i)#define pii pair<int, int>#define pll pair<ll, ll>#define fi first#define se second#define pb push_back#define eb emplace_back#define vi vector<int>#define vll vector<ll>#define vpii vector<pii>#define vpll vector<pll>#define vvi(a,b,c,d) vector<vector<int>> a(b,vector<int>(c,d));#define vvll(a,b,c,d) vector<vector<ll>> a(b,vector<ll>(c,d));#define all(a) a.begin(), a.end()#define rall(a) a.rbegin(), a.rend()#define sz(c) ((ll)(c).size())#define endl '\n'using namespace std;template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }const int MOD = 1000000007;//const int MOD = 998244353;const ll INF = 1e18+1;const int inf = 1e9+1;const double PI = acos(-1);int dx[8] = {1, 0, -1, 0, 1, 1, -1, -1};int dy[8] = {0, 1, 0, -1, -1, 1, 1, -1};bool range(int y, int x, int h, int w){if(y < 0 || x < 0 || y >= h || x >= w) return false;else return true;}const int M = 510000;signed main(){cin.tie(0);ios::sync_with_stdio(false);cout << fixed << setprecision(10);ll n, h; cin >> n >> h;vll s;for(ll i = 2; i*i <= h; i++){if(h % i != 0) continue;while(h % i == 0){s.eb(i);h /= i;}}if(h != 1) s.eb(h);//for(auto x: s) cout << x << endl;rep(i, n){ll a; cin >> a;vll ns;for(ll x : s){if(a%x == 0) a /= x;else ns.eb(x);}if(ns.size()) s = ns;else s = {};}//cout << s.size() << endl;if(s.empty()) cout << "YES" << endl;else cout << "NO" << endl;return 0;}