結果

問題 No.1532 Different Products
ユーザー SumitacchanSumitacchan
提出日時 2021-06-04 21:17:38
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 799 ms / 4,000 ms
コード長 3,022 bytes
コンパイル時間 1,990 ms
コンパイル使用メモリ 171,980 KB
実行使用メモリ 318,584 KB
最終ジャッジ日時 2024-04-30 01:19:11
合計ジャッジ時間 37,960 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 11 ms
11,824 KB
testcase_01 AC 392 ms
162,096 KB
testcase_02 AC 38 ms
33,684 KB
testcase_03 AC 16 ms
14,924 KB
testcase_04 AC 25 ms
22,812 KB
testcase_05 AC 9 ms
10,264 KB
testcase_06 AC 47 ms
24,240 KB
testcase_07 AC 72 ms
33,808 KB
testcase_08 AC 81 ms
36,912 KB
testcase_09 AC 165 ms
69,760 KB
testcase_10 AC 330 ms
135,456 KB
testcase_11 AC 292 ms
119,808 KB
testcase_12 AC 515 ms
209,044 KB
testcase_13 AC 298 ms
123,040 KB
testcase_14 AC 780 ms
315,476 KB
testcase_15 AC 75 ms
33,696 KB
testcase_16 AC 567 ms
237,108 KB
testcase_17 AC 273 ms
113,600 KB
testcase_18 AC 203 ms
83,852 KB
testcase_19 AC 464 ms
190,288 KB
testcase_20 AC 723 ms
295,168 KB
testcase_21 AC 627 ms
259,216 KB
testcase_22 AC 355 ms
144,896 KB
testcase_23 AC 218 ms
89,936 KB
testcase_24 AC 697 ms
285,728 KB
testcase_25 AC 546 ms
226,236 KB
testcase_26 AC 222 ms
94,852 KB
testcase_27 AC 688 ms
290,384 KB
testcase_28 AC 518 ms
215,380 KB
testcase_29 AC 737 ms
309,264 KB
testcase_30 AC 770 ms
318,452 KB
testcase_31 AC 751 ms
310,692 KB
testcase_32 AC 760 ms
315,476 KB
testcase_33 AC 727 ms
302,800 KB
testcase_34 AC 737 ms
302,804 KB
testcase_35 AC 753 ms
310,824 KB
testcase_36 AC 779 ms
318,576 KB
testcase_37 AC 737 ms
309,140 KB
testcase_38 AC 745 ms
309,140 KB
testcase_39 AC 744 ms
306,160 KB
testcase_40 AC 748 ms
304,520 KB
testcase_41 AC 761 ms
312,340 KB
testcase_42 AC 758 ms
310,816 KB
testcase_43 AC 758 ms
309,268 KB
testcase_44 AC 788 ms
318,584 KB
testcase_45 AC 780 ms
318,580 KB
testcase_46 AC 787 ms
318,572 KB
testcase_47 AC 777 ms
318,576 KB
testcase_48 AC 799 ms
318,576 KB
testcase_49 AC 783 ms
318,452 KB
testcase_50 AC 787 ms
318,584 KB
testcase_51 AC 779 ms
318,580 KB
testcase_52 AC 785 ms
318,584 KB
testcase_53 AC 784 ms
318,576 KB
testcase_54 AC 782 ms
318,580 KB
testcase_55 AC 790 ms
318,580 KB
testcase_56 AC 790 ms
318,580 KB
testcase_57 AC 791 ms
318,580 KB
testcase_58 AC 790 ms
318,580 KB
testcase_59 AC 793 ms
318,580 KB
testcase_60 AC 789 ms
318,580 KB
testcase_61 AC 8 ms
8,716 KB
testcase_62 AC 8 ms
8,712 KB
testcase_63 AC 790 ms
318,580 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
//using namespace atcoder;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define all(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define bit(n) (1LL<<(n))
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) { cout << #v << "=" << endl; REP(i_debug, v.size()){ cout << v[i_debug] << ","; } cout << endl; }
#define mdebug(m) { cout << #m << "=" << endl; REP(i_debug, m.size()){ REP(j_debug, m[i_debug].size()){ cout << m[i_debug][j_debug] << ","; } cout << endl;} }
#define pb push_back
#define fi first
#define se second
#define int long long
#define INF 1000000000000000000
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream &operator<<(ostream &os, vector<T> &v){ for(int i = 0; i < v.size(); i++) { cout << v[i]; if(i != v.size() - 1) cout << endl; }; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, pair<T1, T2> p){ cout << '(' << p.first << ',' << p.second << ')'; return os; }
template<typename T> void Out(T x) { cout << x << endl; }
template<typename T1, typename T2> void chOut(bool f, T1 y, T2 n) { if(f) Out(y); else Out(n); }

using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using v_bool = vector<bool>;
using v_Pii = vector<Pii>;

//int dx[4] = {1,0,-1,0};
//int dy[4] = {0,1,0,-1};
//char d[4] = {'D','R','U','L'};

const int mod = 1000000007;
//const int mod = 998244353;



signed main(){

    int N, K; cin >> N >> K;
    
    const int M = 100000;
    mat dp(N + 1, vec(M + 1, 0)), dq(N + 1, vec(M + 1, 0));
    dp[0][1] = dq[0][1] = 1;

    REP(i, N){
        FOR(j, 1, M + 1){
            dp[i + 1][j] += dp[i][j];
            if(j * (i + 1) <= M) dp[i + 1][j * (i + 1)] += dp[i][j];
        } 
    }
    REP(i, N){
        FOR(j, 1, M + 1){
            dq[i + 1][j] += dq[i][j];
            if(j * (N - i) <= M) dq[i + 1][j * (N - i)] += dq[i][j];
        } 
    }
    //mdebug(dp); mdebug(dq);

    REP(i, N + 1){
        FOR(j, 1, M + 1){
            dq[i][j] += dq[i][j - 1];
        }
    }

    int ans = 0;
    FOR(x, 1, N + 1){
        FOR(l, 1, M + 1) if(l * x <= K){
            int rmax = min(K / (l * x), l * x);
            int rmin = l / x + 1;
            if(rmin <= rmax) ans += dp[x - 1][l] * (dq[N - x][rmax] - dq[N - x][rmin - 1]);
        }
    }
    ans++;
    Out(ans);

    return 0;
}
0