結果
| 問題 | No.1250 汝は倍数なりや? | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2022-02-25 21:21:14 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                RE
                                 
                             | 
| 実行時間 | - | 
| コード長 | 669 bytes | 
| コンパイル時間 | 1,669 ms | 
| コンパイル使用メモリ | 175,148 KB | 
| 実行使用メモリ | 6,948 KB | 
| 最終ジャッジ日時 | 2024-07-03 15:57:47 | 
| 合計ジャッジ時間 | 9,910 ms | 
| ジャッジサーバーID (参考情報) | judge1 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | RE * 3 | 
| other | RE * 49 | 
コンパイルメッセージ
main.cpp: In function 'int pb(std::map<int, int>&, int)':
main.cpp:17:1: warning: no return statement in function returning non-void [-Wreturn-type]
   17 | }
      | ^
            
            ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int pb(map<int,int> &m, int x){ 
    int t = x;
    for(ll i=2; i*i<=t; i++){
        if(x % i == 0){
            x /= i;
            m[i]++;
        }
        if(x == 1) break;
    }
    if(x != 1) m[x]++;
}
int main(){
    int n,h;
    cin >> n >> h;
    map<int,int> hm;
    pb(hm, h);
    map<int,int> am;
    int t;
    for(int i=0; i<n; i++){
        cin >> t;
        pb(am, t);
    }
    for(auto e : hm){
        auto k = e.first;
        auto v = e.second;
        if(v > am[k]){
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;
}
            
            
            
        