結果

問題 No.1973 Divisor Sequence
ユーザー asaringoasaringo
提出日時 2022-06-11 00:55:33
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 855 ms / 2,000 ms
コード長 1,350 bytes
コンパイル時間 2,145 ms
コンパイル使用メモリ 209,756 KB
実行使用メモリ 179,036 KB
最終ジャッジ日時 2023-10-21 06:59:49
合計ジャッジ時間 6,197 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 155 ms
30,000 KB
testcase_03 AC 10 ms
5,476 KB
testcase_04 AC 89 ms
18,924 KB
testcase_05 AC 28 ms
16,616 KB
testcase_06 AC 95 ms
25,456 KB
testcase_07 AC 20 ms
6,984 KB
testcase_08 AC 50 ms
14,836 KB
testcase_09 AC 80 ms
16,880 KB
testcase_10 AC 101 ms
20,312 KB
testcase_11 AC 15 ms
5,428 KB
testcase_12 AC 83 ms
20,876 KB
testcase_13 AC 25 ms
8,372 KB
testcase_14 AC 64 ms
17,808 KB
testcase_15 AC 140 ms
21,948 KB
testcase_16 AC 139 ms
25,984 KB
testcase_17 AC 84 ms
17,408 KB
testcase_18 AC 7 ms
4,408 KB
testcase_19 AC 111 ms
22,004 KB
testcase_20 AC 19 ms
6,192 KB
testcase_21 AC 119 ms
30,472 KB
testcase_22 AC 103 ms
22,092 KB
testcase_23 AC 855 ms
179,036 KB
testcase_24 AC 315 ms
46,244 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std ;
#define fast_input_output ios::sync_with_stdio(false); cin.tie(nullptr);
typedef long long ll ;
typedef long double ld ;
typedef pair<ll,ll> P ;
typedef tuple<ll,ll,ll> TP ;
#define chmin(a,b) a = min(a,b)
#define chmax(a,b) a = max(a,b)
#define bit_count(x) __builtin_popcountll(x)
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) a / gcd(a,b) * b
#define rep(i,n) for(int i = 0 ; i < n ; i++)
#define rrep(i,a,b) for(int i = a ; i < b ; i++)
#define endl "\n"

const int mod = 1000000007 ;

ll n , m ;

int main(){
    // fast_input_output
    cin >> n >> m ;
    vector<P> vec ;
    for(ll i = 2 ; i * i <= m ; i++){
        if(m % i != 0) continue;
        int ex = 0 ;
        while(m % i == 0){
            ex++ ;
            m /= i ;
        }
        vec.push_back(P(i,ex)) ;
    }
    if(m != 1) vec.push_back(P(m,1)) ;
    int a = vec.size() ;
    ll res = 1 ;
    rep(p,a){
        auto[val,ex] = vec[p];
        vector<vector<ll>> dp(n,vector<ll>(ex+1,0)) ;
        rep(i,ex+1) dp[0][i] = 1 ;
        rep(i,n-1) rep(j,ex+1){
            rep(k,ex+1){
                if(j + k > ex) break;
                (dp[i+1][k] += dp[i][j]) %= mod ;
            }
        }
        ll sum = 0 ;
        rep(i,ex+1) (sum += dp[n-1][i]) %= mod ;
        (res *= sum) %= mod ;
    }
    cout << res << endl ;
}
0