結果

問題 No.1532 Different Products
ユーザー 👑 kmjpkmjp
提出日時 2021-06-04 22:50:12
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 369 ms / 4,000 ms
コード長 1,365 bytes
コンパイル時間 1,708 ms
コンパイル使用メモリ 201,960 KB
実行使用メモリ 321,380 KB
最終ジャッジ日時 2024-04-30 11:08:14
合計ジャッジ時間 17,285 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
14,084 KB
testcase_01 AC 158 ms
165,436 KB
testcase_02 AC 15 ms
35,012 KB
testcase_03 AC 6 ms
15,080 KB
testcase_04 AC 9 ms
23,256 KB
testcase_05 AC 3 ms
13,664 KB
testcase_06 AC 17 ms
26,072 KB
testcase_07 AC 26 ms
34,920 KB
testcase_08 AC 29 ms
41,324 KB
testcase_09 AC 63 ms
71,888 KB
testcase_10 AC 127 ms
137,424 KB
testcase_11 AC 111 ms
123,460 KB
testcase_12 AC 202 ms
213,368 KB
testcase_13 AC 117 ms
124,960 KB
testcase_14 AC 338 ms
318,788 KB
testcase_15 AC 28 ms
37,524 KB
testcase_16 AC 232 ms
239,916 KB
testcase_17 AC 109 ms
116,508 KB
testcase_18 AC 78 ms
84,756 KB
testcase_19 AC 183 ms
192,512 KB
testcase_20 AC 312 ms
298,672 KB
testcase_21 AC 247 ms
262,216 KB
testcase_22 AC 140 ms
147,272 KB
testcase_23 AC 86 ms
91,896 KB
testcase_24 AC 290 ms
287,672 KB
testcase_25 AC 220 ms
230,916 KB
testcase_26 AC 88 ms
96,300 KB
testcase_27 AC 295 ms
293,364 KB
testcase_28 AC 209 ms
218,964 KB
testcase_29 AC 320 ms
311,928 KB
testcase_30 AC 325 ms
320,600 KB
testcase_31 AC 369 ms
316,764 KB
testcase_32 AC 313 ms
318,280 KB
testcase_33 AC 309 ms
307,744 KB
testcase_34 AC 311 ms
305,696 KB
testcase_35 AC 308 ms
313,868 KB
testcase_36 AC 313 ms
320,596 KB
testcase_37 AC 307 ms
313,108 KB
testcase_38 AC 306 ms
313,080 KB
testcase_39 AC 298 ms
309,452 KB
testcase_40 AC 302 ms
308,588 KB
testcase_41 AC 313 ms
316,996 KB
testcase_42 AC 305 ms
316,892 KB
testcase_43 AC 306 ms
312,956 KB
testcase_44 AC 324 ms
320,556 KB
testcase_45 AC 322 ms
320,676 KB
testcase_46 AC 324 ms
321,380 KB
testcase_47 AC 322 ms
320,732 KB
testcase_48 AC 327 ms
320,680 KB
testcase_49 AC 323 ms
320,704 KB
testcase_50 AC 321 ms
320,700 KB
testcase_51 AC 327 ms
320,768 KB
testcase_52 AC 320 ms
321,112 KB
testcase_53 AC 333 ms
320,864 KB
testcase_54 AC 312 ms
320,764 KB
testcase_55 AC 316 ms
320,760 KB
testcase_56 AC 319 ms
320,628 KB
testcase_57 AC 315 ms
320,652 KB
testcase_58 AC 320 ms
320,704 KB
testcase_59 AC 323 ms
321,120 KB
testcase_60 AC 314 ms
320,560 KB
testcase_61 AC 4 ms
10,172 KB
testcase_62 AC 3 ms
9,880 KB
testcase_63 AC 317 ms
320,728 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;

#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define FORR2(x,y,arr) for(auto& [x,y]:arr)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
template<class T> bool chmax(T &a, const T &b) { if(a<b){a=b;return 1;}return 0;}
template<class T> bool chmin(T &a, const T &b) { if(a>b){a=b;return 1;}return 0;}
//-------------------------------------------------------

int N;
ll K;

ll L[202][101010];
ll R[202][101010];

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N>>K;
	L[0][1]=1;
	R[N+1][1]=1;
	for(i=N;i>=1;i--) {
		for(j=1;j<=100000;j++) {
			R[i][j]+=R[i+1][j];
			if(j*i<=100000) R[i][j*i]+=R[i+1][j];
			R[i+1][j]+=R[i+1][j-1];
		}
	}
	
	ll ret=0;
	for(i=1;i<=min(100000LL,K);i++) ret+=R[1][i];
	
	for(i=1;i<=N;i++) {
		for(j=1;j<=100000;j++) {
			L[i][j]+=L[i-1][j];
			ll a=1LL*i*j;
			if(a<=100000) {
				L[i][a]+=L[i-1][j];
			}
			else if(a<=K) ret+=L[i-1][j]*R[i+1][K/a];
		}
	}
	ret--;
	cout<<ret<<endl;
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}
0