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