結果
| 問題 |
No.1250 汝は倍数なりや?
|
| コンテスト | |
| ユーザー |
YamaKasa
|
| 提出日時 | 2020-10-09 23:21:54 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 836 bytes |
| コンパイル時間 | 1,631 ms |
| コンパイル使用メモリ | 174,540 KB |
| 実行使用メモリ | 13,888 KB |
| 最終ジャッジ日時 | 2024-07-20 14:16:31 |
| 合計ジャッジ時間 | 4,578 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 3 |
| other | WA * 6 TLE * 1 -- * 42 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
int N;
int H;
cin >> N >> H;
int A[N];
for (int i = 0; i < N; i++) {
cin >> A[i];
if (A[i] < 0) A[i] = -A[i];
}
map<int, int> m;
for (int i = 2; i * i <= H; i++) {
while (H % i == 0) {
m[i]++;
H /= i;
}
}
m[H]++;
for (auto it = m.begin(); it != m.end(); it++) {
int cnt = 0;
for (int i = 0; i < N; i++) {
while (A[i] % it->first == 0) {
cnt++;
A[i] /= it->first;
}
if (cnt >= it->second) break;
}
//cout << cnt << "\n";
if (cnt < it->second) {
cout << "No\n";
return 0;
}
}
cout << "Yes\n";
return 0;
}
YamaKasa