結果
問題 |
No.1532 Different Products
|
ユーザー |
|
提出日時 | 2021-06-04 20:31:17 |
言語 | C++17(clang) (17.0.6 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 646 bytes |
コンパイル時間 | 1,084 ms |
コンパイル使用メモリ | 130,492 KB |
実行使用メモリ | 73,712 KB |
最終ジャッジ日時 | 2024-11-19 09:23:06 |
合計ジャッジ時間 | 216,294 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 22 TLE * 40 |
ソースコード
#include<iostream> #include<vector> #include<algorithm> using namespace std; int N; long K; const int LIM=23; 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); } } int 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; }