結果
問題 | No.1973 Divisor Sequence |
ユーザー | Haa |
提出日時 | 2022-06-10 21:57:02 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 128 ms / 2,000 ms |
コード長 | 1,255 bytes |
コンパイル時間 | 1,784 ms |
コンパイル使用メモリ | 180,420 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-21 07:29:33 |
合計ジャッジ時間 | 3,483 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 22 |
ソースコード
#include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef pair<ll,ll> P; typedef vector<ll> VI; typedef vector<VI> VVI; #define REP(i,n) for(ll i=0;i<(n);i++) #define ALL(v) v.begin(),v.end() template<typename T> bool chmax(T &x, const T &y) {return (x<y)?(x=y,true):false;}; template<typename T> bool chmin(T &x, const T &y) {return (x>y)?(x=y,true):false;}; constexpr ll MOD=1000000007; constexpr ll INF=2e18; ll power(ll x, ll y){ x%=MOD; ll ret=1; while(y){ if(y&1) ret=ret*x%MOD; x=x*x%MOD; y>>=1; } return ret; } int main(){ ll n, m; cin >> n >> m; ll x=m; map<ll,ll> mp; for(ll i=2;i<=sqrt(m);i++){ ll cnt=0; while(x%i==0){ x/=i; cnt++; } mp[cnt]++; } if(x!=1) mp[1]++; ll ans=1; for(auto p:mp){ ll l=p.first+1; VI dp(l,0); dp[0]=1; REP(i,n){ VI ndp(l,0); ll sum=0; REP(j,l){ sum=(sum+dp[j])%MOD; ndp[l-1-j]=sum; } dp=ndp; } ll s=0; REP(i,l) s=(s+dp[i])%MOD; ans=ans*power(s,p.second)%MOD; } cout << ans << endl; return 0; }