結果
問題 |
No.1532 Different Products
|
ユーザー |
|
提出日時 | 2021-06-04 20:28:16 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 642 bytes |
コンパイル時間 | 783 ms |
コンパイル使用メモリ | 76,088 KB |
実行使用メモリ | 23,448 KB |
最終ジャッジ日時 | 2024-11-19 09:07:48 |
合計ジャッジ時間 | 208,965 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 24 TLE * 38 |
コンパイルメッセージ
main.cpp:19:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 19 | main() | ^~~~
ソースコード
#include<iostream> #include<vector> #include<algorithm> using namespace std; int N; long K; const int LIM=20; long ans; vector<long>P; void f(long k,int n) { if(k==0)return; ans+=upper_bound(P.begin(),P.end(),k)-P.begin(); for(int m=min((long)n,k);m>LIM;m--) { f(k/m,m-1); } } main() { cin>>N>>K; if(N<=LIM) { for(int i=1;i<1<<N;i++) { long t=1; for(int j=0;t<=K&&j<N;j++)if(i>>j&1)t*=j+1; if(t<=K)ans++; } cout<<ans<<endl; return 0; } for(int i=0;i<1<<LIM;i++) { long t=1; for(int j=0;t<=K&&j<LIM;j++)if(i>>j&1)t*=j+1; if(t<=K)P.push_back(t); } sort(P.begin(),P.end()); f(K,N); cout<<ans-1<<endl; }