結果
| 問題 |
No.1250 汝は倍数なりや?
|
| コンテスト | |
| ユーザー |
chacoder1
|
| 提出日時 | 2020-11-25 23:05:50 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 766 bytes |
| コンパイル時間 | 2,250 ms |
| コンパイル使用メモリ | 200,376 KB |
| 最終ジャッジ日時 | 2025-01-16 05:45:26 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 28 WA * 9 TLE * 12 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
map<int,int>mp;
map<int,int>np;
int main(){
int N,H;
cin>>N>>H;
int temp;
for(int i=0;i<N;i++){
cin>>temp;
if(temp==1) continue;
if(temp<0) temp*=-1;
if(temp==0){
cout<<"YES"<<endl;
return 0;
}
for(int j=2;j*j<=temp;j++){
if(temp%j==0){
mp[j]++;
temp/=j;
j--;
}
}
mp[temp]++;
}
temp=H;
for(int i=2;i*i<=H;i++){
if(temp%i==0){
np[i]++;
temp/=i;
i--;
}
}
np[temp]++;
for(auto itr=np.begin();itr !=np.end();itr++){
//cout<<itr->first<<" "<<itr->second<<endl;
if(mp[(itr->first)] < itr->second){
cout<<"NO"<<endl;
return 0;
}
}
cout<<"YES"<<endl;
return 0;
}
chacoder1