結果
問題 | No.1929 Exponential Sequence |
ユーザー |
![]() |
提出日時 | 2022-05-06 23:24:04 |
言語 | cLay (20241019-1) |
結果 |
AC
|
実行時間 | 35 ms / 2,000 ms |
コード長 | 481 bytes |
コンパイル時間 | 2,443 ms |
コンパイル使用メモリ | 181,104 KB |
実行使用メモリ | 7,040 KB |
最終ジャッジ日時 | 2024-09-14 03:54:14 |
合計ジャッジ時間 | 3,521 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge6 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 24 |
ソースコード
ll n,s;map<ll,ll> f(ll n){map<ll,ll>src,dst;src[0]=1;rep(n){ll@a;for(auto t:src){for(ll b=a;t.first+b<=s;b*=a){dst[t.first+b]+=t.second;}}swap(src,dst);dst.clear();}return src;}{rd(n,s);auto z1=f(n/2);auto z2=f(n-n/2);ll m=0,z=0,y=0;auto t1=z1.begin();auto t2=z2.rbegin();for(;t2!=z2.rend();){if(t1!=z1.end() && t1->first+t2->first<=s){m+=t1->second;++t1;}else{z+=m*t2->second;++t2;}}wt(z);}