結果

問題 No.1973 Divisor Sequence
ユーザー otoshigootoshigo
提出日時 2022-06-10 21:44:11
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 521 ms / 2,000 ms
コード長 1,863 bytes
コンパイル時間 2,295 ms
コンパイル使用メモリ 209,588 KB
実行使用メモリ 198,428 KB
最終ジャッジ日時 2023-10-21 06:18:37
合計ジャッジ時間 6,583 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 269 ms
56,864 KB
testcase_03 AC 17 ms
7,988 KB
testcase_04 AC 158 ms
34,632 KB
testcase_05 AC 49 ms
29,832 KB
testcase_06 AC 180 ms
47,644 KB
testcase_07 AC 34 ms
10,788 KB
testcase_08 AC 95 ms
26,636 KB
testcase_09 AC 138 ms
30,580 KB
testcase_10 AC 173 ms
37,496 KB
testcase_11 AC 22 ms
7,828 KB
testcase_12 AC 141 ms
38,792 KB
testcase_13 AC 43 ms
13,512 KB
testcase_14 AC 90 ms
20,508 KB
testcase_15 AC 227 ms
40,688 KB
testcase_16 AC 229 ms
48,980 KB
testcase_17 AC 142 ms
31,768 KB
testcase_18 AC 10 ms
5,124 KB
testcase_19 AC 188 ms
40,900 KB
testcase_20 AC 33 ms
9,548 KB
testcase_21 AC 214 ms
57,704 KB
testcase_22 AC 188 ms
40,940 KB
testcase_23 AC 266 ms
198,428 KB
testcase_24 AC 521 ms
73,556 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/modint>
using namespace std;
using namespace atcoder;
using ll = long long;
using mint = modint1000000007;
#define rep(i,n) for (int i = 0; i < n; i++)
#define rrep(i,n) for (int i = n-1; i >= 0; i--)
#define rep2(i,a,b) for (int i = a; i < b; i++)
#define rrep2(i,a,b) for (int i = a-1; i >= b; i--)
#define rep3(i,a,b,c) for (int i = a; i < b; i+=c)
#define rrep3(i,a,b,c) for (int i = a-1; i >= b; i-=c)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
template<class T> bool chmax(T &a, T b){if (a < b){a = b;return true;} else return false;}
template<class T> bool chmin(T &a, T b){if (a > b){a = b;return true;} else return false;}

ll n,m;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cin>>n>>m;
    ll x=2;
    mint ans=1;
    while(x*x<=m){
        int c=0;
        while(m%x==0){
            m/=x;
            c++;
        }
        x++;
        if(c==0)continue;
        vector<vector<mint>>dp(n+1,vector<mint>(c+1)),S(n+1,vector<mint>(c+1));
        rep(i,c+1){
            dp[0][i]=1;
            S[0][i]=i+1;
        }
        rep(i,n-1){
            rep(j,c+1){
                dp[i+1][j]+=S[i][c-j];
            }
            S[i+1][0]=dp[i+1][0];
            rep2(j,1,c+1){
                S[i+1][j]=S[i+1][j-1]+dp[i+1][j];
            }
        }
        ans*=S[n-1][c];
    }
    if(m>1){
        int c=1;
        vector<vector<mint>>dp(n+1,vector<mint>(c+1)),S(n+1,vector<mint>(c+1));
        rep(i,c+1){
            dp[0][i]=1;
            S[0][i]=i+1;
        }
        rep(i,n-1){
            rep(j,c+1){
                dp[i+1][j]+=S[i][c-j];
            }
            S[i+1][0]=dp[i+1][0];
            rep2(j,1,c+1){
                S[i+1][j]=S[i+1][j-1]+dp[i+1][j];
            }
        }
        ans*=S[n-1][c];
    }
    cout<<ans.val()<<"\n";
}
0