結果

問題 No.1532 Different Products
ユーザー milanis48663220milanis48663220
提出日時 2021-06-04 22:39:14
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 1,671 bytes
コンパイル時間 2,414 ms
コンパイル使用メモリ 132,628 KB
実行使用メモリ 333,392 KB
最終ジャッジ日時 2023-08-12 15:59:29
合計ジャッジ時間 128,830 ms
ジャッジサーバーID
(参考情報)
judge8 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 450 ms
57,924 KB
testcase_02 AC 2 ms
4,384 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,384 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 3 ms
4,380 KB
testcase_07 AC 5 ms
4,380 KB
testcase_08 AC 15 ms
6,524 KB
testcase_09 AC 245 ms
35,380 KB
testcase_10 AC 774 ms
81,112 KB
testcase_11 AC 589 ms
67,052 KB
testcase_12 AC 2,064 ms
169,460 KB
testcase_13 AC 1,378 ms
129,192 KB
testcase_14 AC 3,518 ms
273,304 KB
testcase_15 AC 280 ms
44,332 KB
testcase_16 AC 489 ms
63,864 KB
testcase_17 AC 707 ms
78,396 KB
testcase_18 AC 646 ms
72,244 KB
testcase_19 AC 1,820 ms
163,860 KB
testcase_20 AC 3,522 ms
280,028 KB
testcase_21 AC 942 ms
91,008 KB
testcase_22 AC 1,286 ms
117,080 KB
testcase_23 AC 966 ms
94,496 KB
testcase_24 AC 3,446 ms
257,232 KB
testcase_25 AC 1,715 ms
145,932 KB
testcase_26 AC 143 ms
24,808 KB
testcase_27 AC 1,148 ms
121,828 KB
testcase_28 AC 882 ms
97,708 KB
testcase_29 AC 606 ms
74,488 KB
testcase_30 AC 1,672 ms
162,328 KB
testcase_31 AC 1,704 ms
166,940 KB
testcase_32 AC 2,129 ms
192,464 KB
testcase_33 AC 1,599 ms
149,056 KB
testcase_34 AC 3,049 ms
239,212 KB
testcase_35 AC 2,384 ms
192,480 KB
testcase_36 AC 3,077 ms
232,124 KB
testcase_37 AC 269 ms
39,004 KB
testcase_38 AC 3,236 ms
248,588 KB
testcase_39 AC 2,813 ms
221,068 KB
testcase_40 AC 2,862 ms
227,120 KB
testcase_41 TLE -
testcase_42 AC 3,719 ms
289,308 KB
testcase_43 AC 3,837 ms
301,088 KB
testcase_44 TLE -
testcase_45 TLE -
testcase_46 TLE -
testcase_47 TLE -
testcase_48 TLE -
testcase_49 TLE -
testcase_50 TLE -
testcase_51 TLE -
testcase_52 TLE -
testcase_53 TLE -
testcase_54 TLE -
testcase_55 TLE -
testcase_56 TLE -
testcase_57 TLE -
testcase_58 TLE -
testcase_59 TLE -
testcase_60 TLE -
testcase_61 AC 2 ms
4,380 KB
testcase_62 AC 2 ms
4,380 KB
testcase_63 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <tuple>
#include <cmath>
#include <numeric>
#include <functional>
#include <cassert>

#define debug_value(x) cerr << "line" << __LINE__ << ":<" << __func__ << ">:" << #x << "=" << x << endl;
#define debug(x) cerr << "line" << __LINE__ << ":<" << __func__ << ">:" << x << endl;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

using namespace std;
typedef long long ll;

vector<ll> calc(ll k){
    set<ll> st;
    for(ll i = 1; i*i <= k; i++){
        st.insert(i);
        st.insert(k/i);
    }
    vector<ll> ans;
    for(ll x: st) ans.push_back(x);
    return ans;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setprecision(10) << fixed;
    int n; ll k; cin >> n >> k;
    auto v = calc(k);
    int m = v.size();
    unordered_map<ll, int> inv = [&](){
        unordered_map<ll, int> ans;
        for(int i = 0; i < m; i++) ans[v[i]] = i;
        return ans;
    }();
    
    vector<vector<ll>> dp(m, vector<ll>(n+1)); // nx[i][j] = v[i]/j
    dp[m-1][n] = 1;
    for(int i = n; i >= 1; i--){
        for(int j = 0; j < m; j++){
            dp[j][i-1] += dp[j][i];
            ll x = v[j]/i;
            if(x == 0) continue;
            dp[inv[x]][i-1] += dp[j][i];
        }
        // for(int j = 0; j < m; j++) cout << dp[i-1][j] << ' ';
        // cout << endl;
    }
    ll ans = 0;
    for(int j = 0; j < m; j++) ans += dp[j][0];
    cout << ans-1 << endl;
}
0