結果

問題 No.1532 Different Products
ユーザー 00 Sakuda00 Sakuda
提出日時 2024-04-04 23:42:16
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
MLE  
実行時間 -
コード長 1,399 bytes
コンパイル時間 4,235 ms
コンパイル使用メモリ 206,892 KB
実行使用メモリ 813,968 KB
最終ジャッジ日時 2024-04-04 23:42:28
合計ジャッジ時間 10,348 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 44 ms
45,536 KB
testcase_01 MLE -
testcase_02 AC 187 ms
144,016 KB
testcase_03 AC 68 ms
59,568 KB
testcase_04 AC 116 ms
94,712 KB
testcase_05 AC 38 ms
38,456 KB
testcase_06 AC 126 ms
101,792 KB
testcase_07 AC 190 ms
144,016 KB
testcase_08 AC 209 ms
158,048 KB
testcase_09 AC 414 ms
305,704 KB
testcase_10 MLE -
testcase_11 MLE -
testcase_12 MLE -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
testcase_48 -- -
testcase_49 -- -
testcase_50 -- -
testcase_51 -- -
testcase_52 -- -
testcase_53 -- -
testcase_54 -- -
testcase_55 -- -
testcase_56 -- -
testcase_57 -- -
testcase_58 -- -
testcase_59 -- -
testcase_60 -- -
testcase_61 -- -
testcase_62 -- -
testcase_63 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
	int N;ll K;cin >> N >> K;
	int D = 3e5;
	vector<vector<ll>> dp(N + 1, vector<ll> (D + 1, 0));
	vector<vector<ll>> dp2(N + 2, vector<ll>(D + 1, 0));
	for (int i = 1;i <= N;i++) {
		//iをはじめて
		if (i <= D) dp[i][i]++;
		for (int j = 1;j <= D;j++) {
			dp[i][j] += dp[i - 1][j];
			if (j * i <= D) dp[i][i * j] += dp[i - 1][j];
		}
	}
	for (int i = N;i >= 1;i--) {
		if (i <= D) dp2[i][i]++;
		for (int j = 1;j <= D;j++) {
			dp2[i][j] += dp2[i + 1][j];
			if (j * i <= D) dp2[i][i * j] += dp2[i + 1][j];
		}
	}
	vector<vector<ll>> sdp(N + 2, vector<ll>(D + 1, 0));
	ll ans = 0;
	for (int i = 1;i <= N;i++) for (int j = 1;j <= D;j++) sdp[i][j] = sdp[i][j - 1] + dp2[i][j];
	for (int i = 1;i <= N;i++) {
		if (i > D) {
		//iだけつかう
		ans++;
		//iよりまえになにもでてこない かつ それいこうでいっこいじょうでつかう
		ll t = K / (ll)i;
		ans += sdp[i + 1][t];
		}
		//それよりまえでいっこいじょうつかいそのせきがj
		for (int j = 1;j <= D;j++) {
			ll x = (ll)i * (ll)j;
			if (x <= D) continue;
			//それいこうでいっこもつかわない
			if (x <= K) ans += dp[i - 1][j];
			//つかう
			//
			ll t = K / x;
			ans += dp[i - 1][j] * sdp[i + 1][t];
		}
	}
	for (ll j = 1;j <= min(K, (ll)D);j++) ans += dp[N][j];
	cout << ans << endl;
}
0