結果
| 問題 |
No.1250 汝は倍数なりや?
|
| コンテスト | |
| ユーザー |
a01sa01to
|
| 提出日時 | 2024-01-24 00:33:15 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 718 bytes |
| コンパイル時間 | 2,111 ms |
| コンパイル使用メモリ | 201,604 KB |
| 最終ジャッジ日時 | 2025-02-18 22:28:48 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 18 TLE * 1 -- * 30 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "settings/debug.cpp"
#define _GLIBCXX_DEBUG
#else
#define Debug(...) void(0)
#endif
#define rep(i, n) for (int i = 0; i < (n); ++i)
using ll = long long;
using ull = unsigned long long;
int main() {
int n, h;
cin >> n >> h;
map<int, int> mp;
for (int i = 2; i * i <= h; i++) {
while (h % i == 0) h /= i, mp[i]++;
}
if (h != 1) mp[h]++;
vector<int> a(n);
rep(i, n) cin >> a[i];
for (int x : a) {
for (auto&& [p, cnt] : mp) {
while (x % p == 0) x /= p, cnt--;
}
}
for (auto&& [p, cnt] : mp) {
if (cnt > 0) {
cout << "NO" << endl;
return 0;
}
}
cout << "YES" << endl;
return 0;
}
a01sa01to