結果
| 問題 |
No.1250 汝は倍数なりや?
|
| コンテスト | |
| ユーザー |
ui_mtc
|
| 提出日時 | 2020-10-09 23:09:57 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 737 bytes |
| コンパイル時間 | 1,673 ms |
| コンパイル使用メモリ | 174,032 KB |
| 実行使用メモリ | 10,624 KB |
| 最終ジャッジ日時 | 2024-07-20 14:03:50 |
| 合計ジャッジ時間 | 4,940 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 26 WA * 4 TLE * 1 -- * 18 |
ソースコード
#include <bits/stdc++.h>
#define int long long
#define double long double
using namespace std;
const int MOD = 1000000007;
const int INF = 1e11;
using Graph = vector<vector<int>>;
signed main(){
int N, H;
cin >> N >> H;
map<int, int> fac;
for( int i = 2; i <= sqrt(H); i++ ){
while( H%i == 0 ){
fac[i]++;
H /= i;
}
}
if( H > 1 ) fac[H]++;
map<int, int> sum;
for( int i = 0; i < N; i++ ){
int A;
cin >> A;
for( int j = 2; j <= sqrt(A); j++ ){
while( A%j == 0 ){
sum[j]++;
A /= j;
}
}
if( A > 1 ) sum[A]++;
}
for( auto p : fac ){
if( sum[p.first] < p.second ){
cout << "NO" << endl;
return 0;
}
}
cout << "YES" << endl;
}
ui_mtc