結果
問題 | No.1973 Divisor Sequence |
ユーザー | Haa |
提出日時 | 2022-06-10 21:57:02 |
言語 | C++14 (gcc 13.2.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 129 ms / 2,000 ms |
コード長 | 1,255 bytes |
コンパイル時間 | 1,853 ms |
コンパイル使用メモリ | 180,420 KB |
実行使用メモリ | 4,348 KB |
最終ジャッジ日時 | 2023-10-21 06:20:04 |
合計ジャッジ時間 | 3,620 ms |
ジャッジサーバーID (参考情報) |
judge10 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
4,348 KB |
testcase_01 | AC | 2 ms
4,348 KB |
testcase_02 | AC | 40 ms
4,348 KB |
testcase_03 | AC | 10 ms
4,348 KB |
testcase_04 | AC | 29 ms
4,348 KB |
testcase_05 | AC | 28 ms
4,348 KB |
testcase_06 | AC | 32 ms
4,348 KB |
testcase_07 | AC | 17 ms
4,348 KB |
testcase_08 | AC | 27 ms
4,348 KB |
testcase_09 | AC | 26 ms
4,348 KB |
testcase_10 | AC | 42 ms
4,348 KB |
testcase_11 | AC | 12 ms
4,348 KB |
testcase_12 | AC | 34 ms
4,348 KB |
testcase_13 | AC | 14 ms
4,348 KB |
testcase_14 | AC | 35 ms
4,348 KB |
testcase_15 | AC | 32 ms
4,348 KB |
testcase_16 | AC | 37 ms
4,348 KB |
testcase_17 | AC | 41 ms
4,348 KB |
testcase_18 | AC | 19 ms
4,348 KB |
testcase_19 | AC | 48 ms
4,348 KB |
testcase_20 | AC | 19 ms
4,348 KB |
testcase_21 | AC | 47 ms
4,348 KB |
testcase_22 | AC | 31 ms
4,348 KB |
testcase_23 | AC | 129 ms
4,348 KB |
testcase_24 | AC | 92 ms
4,348 KB |
ソースコード
#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; }