結果

問題 No.1973 Divisor Sequence
ユーザー umimelumimel
提出日時 2022-06-10 22:11:40
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 1,261 bytes
コンパイル時間 1,788 ms
コンパイル使用メモリ 174,604 KB
実行使用メモリ 244,196 KB
最終ジャッジ日時 2023-10-21 05:17:51
合計ジャッジ時間 6,621 ms
ジャッジサーバーID
(参考情報)
judge10 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 211 ms
83,380 KB
testcase_03 AC 11 ms
6,300 KB
testcase_04 AC 128 ms
49,988 KB
testcase_05 AC 31 ms
16,724 KB
testcase_06 AC 83 ms
44,376 KB
testcase_07 AC 22 ms
9,996 KB
testcase_08 AC 51 ms
24,712 KB
testcase_09 AC 112 ms
43,916 KB
testcase_10 AC 246 ms
73,748 KB
testcase_11 AC 24 ms
9,732 KB
testcase_12 AC 71 ms
36,192 KB
testcase_13 AC 32 ms
15,540 KB
testcase_14 TLE -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
#define drep(i, cc, n) for (ll i = (cc); i <= (n); ++i)
#define rep(i, n) drep(i, 0, n - 1)
#define all(a) (a).begin(), (a).end()
#define pb push_back
#define fi first
#define se second

const ll MOD = 1000000007;
const ll MOD2 = 998244353;
const ll INF = 1LL << 60;
const ll N_MAX = 2e5;

int main(){
    ll n, m;
    cin >> n >> m;

    vector<ll> div;
    for(ll i=1; i*i<=m; i++){
        if(m%i != 0) continue;
        if(i == m/i){
            div.pb(i);
        }else{
            div.pb(i);
            div.pb(m/i);
        }
    }

    vector<vector<ll>> cnt(n, vector<ll>((ll)div.size(), 0));
    rep(i, (ll)div.size()) cnt[0][i] = 1;
    vector<vector<ll>> P((ll)div.size());
    rep(i, (ll)div.size()){
        rep(j, (ll)div.size()){
            if(m%(div[i]*div[j]) == 0){
                P[i].pb(j);
            }
        }
    }

    for(ll i=1; i<n; i++){
        rep(j, (ll)div.size()){
            for(ll k : P[j]){
                cnt[i][j] += cnt[i-1][k];
                cnt[i][j] %= MOD;
            }
        }
    }

    ll ans = 0;
    rep(i, (ll)div.size()){
        ans += cnt[n-1][i];
        ans %= MOD;
    }

    cout << ans << endl;
}
0