結果
問題 | No.1532 Different Products |
ユーザー | Sumitacchan |
提出日時 | 2021-06-04 21:17:38 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 752 ms / 4,000 ms |
コード長 | 3,022 bytes |
コンパイル時間 | 1,696 ms |
コンパイル使用メモリ | 171,944 KB |
実行使用メモリ | 318,680 KB |
最終ジャッジ日時 | 2024-11-19 11:53:43 |
合計ジャッジ時間 | 35,134 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 10 ms
11,820 KB |
testcase_01 | AC | 365 ms
162,092 KB |
testcase_02 | AC | 36 ms
33,808 KB |
testcase_03 | AC | 14 ms
14,920 KB |
testcase_04 | AC | 22 ms
22,820 KB |
testcase_05 | AC | 8 ms
10,272 KB |
testcase_06 | AC | 43 ms
24,496 KB |
testcase_07 | AC | 66 ms
33,808 KB |
testcase_08 | AC | 75 ms
36,908 KB |
testcase_09 | AC | 149 ms
69,756 KB |
testcase_10 | AC | 298 ms
135,456 KB |
testcase_11 | AC | 268 ms
119,684 KB |
testcase_12 | AC | 473 ms
209,012 KB |
testcase_13 | AC | 281 ms
123,036 KB |
testcase_14 | AC | 707 ms
315,476 KB |
testcase_15 | AC | 67 ms
33,808 KB |
testcase_16 | AC | 518 ms
237,236 KB |
testcase_17 | AC | 253 ms
113,600 KB |
testcase_18 | AC | 184 ms
83,856 KB |
testcase_19 | AC | 425 ms
190,288 KB |
testcase_20 | AC | 665 ms
295,176 KB |
testcase_21 | AC | 561 ms
259,220 KB |
testcase_22 | AC | 318 ms
144,768 KB |
testcase_23 | AC | 197 ms
89,936 KB |
testcase_24 | AC | 640 ms
285,728 KB |
testcase_25 | AC | 517 ms
226,240 KB |
testcase_26 | AC | 203 ms
94,844 KB |
testcase_27 | AC | 636 ms
290,388 KB |
testcase_28 | AC | 468 ms
215,248 KB |
testcase_29 | AC | 675 ms
309,268 KB |
testcase_30 | AC | 716 ms
318,452 KB |
testcase_31 | AC | 697 ms
310,952 KB |
testcase_32 | AC | 698 ms
315,340 KB |
testcase_33 | AC | 673 ms
302,932 KB |
testcase_34 | AC | 680 ms
302,932 KB |
testcase_35 | AC | 690 ms
310,820 KB |
testcase_36 | AC | 705 ms
318,576 KB |
testcase_37 | AC | 671 ms
309,268 KB |
testcase_38 | AC | 681 ms
309,396 KB |
testcase_39 | AC | 686 ms
306,160 KB |
testcase_40 | AC | 673 ms
304,484 KB |
testcase_41 | AC | 693 ms
312,372 KB |
testcase_42 | AC | 692 ms
310,816 KB |
testcase_43 | AC | 683 ms
309,268 KB |
testcase_44 | AC | 718 ms
318,576 KB |
testcase_45 | AC | 706 ms
318,680 KB |
testcase_46 | AC | 708 ms
318,452 KB |
testcase_47 | AC | 713 ms
318,580 KB |
testcase_48 | AC | 710 ms
318,576 KB |
testcase_49 | AC | 707 ms
318,576 KB |
testcase_50 | AC | 706 ms
318,452 KB |
testcase_51 | AC | 736 ms
318,584 KB |
testcase_52 | AC | 720 ms
318,580 KB |
testcase_53 | AC | 722 ms
318,584 KB |
testcase_54 | AC | 721 ms
318,576 KB |
testcase_55 | AC | 721 ms
318,580 KB |
testcase_56 | AC | 721 ms
318,576 KB |
testcase_57 | AC | 722 ms
318,580 KB |
testcase_58 | AC | 752 ms
318,580 KB |
testcase_59 | AC | 717 ms
318,580 KB |
testcase_60 | AC | 724 ms
318,580 KB |
testcase_61 | AC | 7 ms
8,716 KB |
testcase_62 | AC | 6 ms
8,584 KB |
testcase_63 | AC | 723 ms
318,580 KB |
ソースコード
#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; }