結果
問題 |
No.1250 汝は倍数なりや?
|
ユーザー |
|
提出日時 | 2024-05-17 06:08:46 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,061 bytes |
コンパイル時間 | 3,280 ms |
コンパイル使用メモリ | 255,136 KB |
実行使用メモリ | 15,144 KB |
最終ジャッジ日時 | 2024-12-20 11:30:16 |
合計ジャッジ時間 | 33,919 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 30 WA * 4 TLE * 15 |
ソースコード
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() const int MAX = 1e9; const int MIN = -1*1e9; const ll MAXLL = 1e18; const ll MINLL = -1*1e18; vector<pair<ll,ll>> Prime_factorize(ll N) { vector<pair<ll,ll>> res; for (ll a = 2; a*a <= N; a++) { if(N%a!=0) continue; ll ex = 0; // 指数 while (N%a == 0) { ex++; N /= a; } res.push_back({a, ex}); } if (N != 1) res.push_back({N, 1}); return res; } int main() { ll N,H; cin >> N >> H; map<ll,ll> Need,Count; for(int i = 0; i < N; i++) { ll A; cin >> A; vector<pair<ll,ll>> V = Prime_factorize(A); for(auto x : V) Count[x.first] += x.second; } vector<pair<ll,ll>> V = Prime_factorize(H); for(auto x : V) { if(Count[x.first] < x.second) { cout << "NO" << endl; return 0; } } cout << "YES" << endl; return 0; }