結果
問題 | No.1250 汝は倍数なりや? |
ユーザー |
|
提出日時 | 2022-02-25 21:22:27 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 670 bytes |
コンパイル時間 | 1,709 ms |
コンパイル使用メモリ | 176,472 KB |
実行使用メモリ | 13,884 KB |
最終ジャッジ日時 | 2024-07-03 15:59:45 |
合計ジャッジ時間 | 5,084 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 23 WA * 7 TLE * 1 -- * 18 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; void pb(map<int,int> &m, int x){ int t = x; for(ll i=2; i*i<=t; i++){ if(x % i == 0){ x /= i; m[i]++; } if(x == 1) break; } if(x != 1) m[x]++; } int main(){ int n,h; cin >> n >> h; map<int,int> hm; pb(hm, h); map<int,int> am; int t; for(int i=0; i<n; i++){ cin >> t; pb(am, t); } for(auto e : hm){ auto k = e.first; auto v = e.second; if(v > am[k]){ cout << "NO" << endl; return 0; } } cout << "YES" << endl; }