結果

問題 No.1973 Divisor Sequence
ユーザー kwm_tkwm_t
提出日時 2022-06-10 21:56:44
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
MLE  
(最新)
AC  
(最初)
実行時間 -
コード長 1,633 bytes
コンパイル時間 4,637 ms
コンパイル使用メモリ 270,344 KB
実行使用メモリ 814,876 KB
最終ジャッジ日時 2023-10-21 06:20:15
合計ジャッジ時間 9,984 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 108 ms
52,924 KB
testcase_03 AC 9 ms
5,412 KB
testcase_04 AC 64 ms
32,204 KB
testcase_05 AC 27 ms
16,628 KB
testcase_06 AC 53 ms
31,608 KB
testcase_07 AC 16 ms
8,052 KB
testcase_08 AC 35 ms
18,280 KB
testcase_09 AC 56 ms
28,508 KB
testcase_10 AC 112 ms
44,612 KB
testcase_11 AC 14 ms
7,260 KB
testcase_12 AC 46 ms
26,064 KB
testcase_13 AC 20 ms
11,220 KB
testcase_14 AC 1,496 ms
123,948 KB
testcase_15 AC 170 ms
59,064 KB
testcase_16 AC 105 ms
45,532 KB
testcase_17 AC 96 ms
37,484 KB
testcase_18 AC 29 ms
7,260 KB
testcase_19 AC 125 ms
48,768 KB
testcase_20 AC 20 ms
8,844 KB
testcase_21 AC 67 ms
38,140 KB
testcase_22 AC 76 ms
37,944 KB
testcase_23 AC 595 ms
100,904 KB
testcase_24 MLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using mint = modint1000000007;
const int mod = 1000000007;
//using mint = modint998244353;
//const int mod = 998244353;
//const int INF = 1e9;
//const long long LINF = 1e18;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep2(i,l,r)for(int i=(l);i<(r);++i)
#define rrep(i, n) for (int i = (n-1); i >= 0; --i)
#define rrep2(i,l,r)for(int i=(r-1);i>=(l);--i)
#define all(x) (x).begin(),(x).end()
#define allR(x) (x).rbegin(),(x).rend()
#define endl "\n"
#define P pair<int,int>
template<typename A, typename B> inline bool chmax(A & a, const B & b) { if (a < b) { a = b; return true; } return false; }
template<typename A, typename B> inline bool chmin(A & a, const B & b) { if (a > b) { a = b; return true; } return false; }
//約数列挙
vector<long long>  DivisorEnumeration(long long n) {
	vector<long long> x;
	for (long long i = 1; i*i <= n; i++) {
		if (0 == n % i) {
			x.push_back(i);
			if (n != i * i) x.push_back(n / i);
		}
	}
	sort(all(x));
	return x;
}
int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int n; cin >> n;
	long long m; cin >> m;
	auto v = DivisorEnumeration(m);
	int c = v.size();
	vector<vector<int>>edge(c);
	rep(i, c) {
		rep(j, c) {
			long long x = m / v[i];
			if ((v[j] <= x) && (0 == x % v[j]))edge[i].push_back(j);
		}
	}
	vector<vector<mint>> dp(n + 1, vector<mint>(c + 1));
	dp[0][0] = 1;
	rep(i, n) {
		rep(j, c) {
			rep(k, edge[j].size()) {
				dp[i + 1][edge[j][k]] += dp[i][j];
			}
		}
	}
	mint ans = 0;
	rep(i, c)ans += dp[n][i];
	cout << ans.val() << endl;
	return 0;
}
0