結果

問題 No.1532 Different Products
ユーザー milanis48663220milanis48663220
提出日時 2021-06-04 22:07:29
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 1,874 bytes
コンパイル時間 1,440 ms
コンパイル使用メモリ 135,516 KB
実行使用メモリ 471,316 KB
最終ジャッジ日時 2024-04-30 03:00:48
合計ジャッジ時間 76,231 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 606 ms
83,320 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 3 ms
5,376 KB
testcase_07 AC 6 ms
5,376 KB
testcase_08 AC 18 ms
7,552 KB
testcase_09 AC 276 ms
47,408 KB
testcase_10 AC 837 ms
114,808 KB
testcase_11 AC 610 ms
93,532 KB
testcase_12 AC 2,516 ms
247,808 KB
testcase_13 AC 1,348 ms
182,388 KB
testcase_14 TLE -
testcase_15 AC 319 ms
58,392 KB
testcase_16 AC 691 ms
93,012 KB
testcase_17 AC 757 ms
109,328 KB
testcase_18 AC 753 ms
101,980 KB
testcase_19 AC 2,462 ms
239,384 KB
testcase_20 TLE -
testcase_21 AC 1,137 ms
133,584 KB
testcase_22 AC 1,417 ms
166,096 KB
testcase_23 AC 983 ms
133,588 KB
testcase_24 TLE -
testcase_25 AC 2,145 ms
210,868 KB
testcase_26 AC 177 ms
33,860 KB
testcase_27 AC 2,026 ms
179,284 KB
testcase_28 AC 1,472 ms
142,892 KB
testcase_29 AC 1,003 ms
109,444 KB
testcase_30 AC 2,429 ms
238,472 KB
testcase_31 AC 2,596 ms
244,316 KB
testcase_32 AC 2,991 ms
283,920 KB
testcase_33 AC 2,180 ms
219,352 KB
testcase_34 TLE -
testcase_35 AC 3,087 ms
281,928 KB
testcase_36 AC 3,758 ms
341,192 KB
testcase_37 AC 316 ms
56,960 KB
testcase_38 TLE -
testcase_39 AC 3,475 ms
325,260 KB
testcase_40 AC 3,725 ms
332,728 KB
testcase_41 TLE -
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 <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;

ll dp[205][300000];

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<int>> nx(m, vector<int>(n+1)); // nx[i][j] = v[i]/j
    for(int i = 0; i < m; i++){
        for(int j = 1; j <= n; j++){
            ll x = v[i]/j;
            if(x == 0) nx[i][j] = -1;
            else nx[i][j] = inv[x];
        }
    }
    dp[n][m-1] = 1;
    for(int i = n; i >= 1; i--){
        for(int j = 0; j < m; j++){
            dp[i-1][j] += dp[i][j];
            int k = nx[j][i];
            if(k == -1) continue;
            dp[i-1][k] += dp[i][j];
        }
        // for(int j = 0; j < m; j++) cout << dp[i-1][j] << ' ';
        // cout << endl;
    }
    ll ans = 0;
    for(int i = 0; i < m; i++) ans += dp[0][i];
    cout << ans-1 << endl;
}
0