結果
| 問題 |
No.1250 汝は倍数なりや?
|
| コンテスト | |
| ユーザー |
mmn15277198
|
| 提出日時 | 2020-10-09 22:37:23 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 37 ms / 1,000 ms |
| コード長 | 859 bytes |
| コンパイル時間 | 968 ms |
| コンパイル使用メモリ | 98,240 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-20 13:00:51 |
| 合計ジャッジ時間 | 2,699 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 49 |
ソースコード
#include<iostream>
#include<stdio.h>
#include<stdlib.h>
#include<algorithm>
#include<vector>
#include<string.h>
#include<math.h>
#include<map>
#include<iomanip>
#include<queue>
using namespace std;
using ll = long long;
using ull = unsigned long long;
ll mod = 1e9 + 7;
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
int n;
ll h;
cin >> n >> h;
vector<ll> a(n);
for(int i = 0; i < n; i++){
cin >> a[i];
}
sort(a.begin() , a.end());
vector<ll> v;
for(ll i = 2; i * i <= h; i++){
while(h % i == 0){
v.push_back(i);
h /= i;
}
}
if(h != 1)v.push_back(h);
ll cnt = 0;
for(int i = 0; i < v.size(); i++){
bool ok = false;
for(int j = 0; j < n; j++){
if(a[j] % v[i] == 0){
a[j] /= v[i];
ok = true;
break;
}
}
if(!ok){
cout << "NO" << endl;
return 0;
}
}
cout << "YES" << endl;
return 0;
}
mmn15277198