結果
| 問題 | No.1532 Different Products |
| コンテスト | |
| ユーザー |
Haa
|
| 提出日時 | 2021-06-04 21:26:38 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 293 ms / 4,000 ms |
| コード長 | 1,055 bytes |
| コンパイル時間 | 1,988 ms |
| コンパイル使用メモリ | 185,540 KB |
| 実行使用メモリ | 17,664 KB |
| 最終ジャッジ日時 | 2024-11-19 12:24:20 |
| 合計ジャッジ時間 | 13,460 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 62 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> P;
typedef vector<ll> VI;
typedef vector<VI> VVI;
#define REP(i,n) for(ll i=0;i<(n);i++)
#define ALL(v) v.begin(),v.end()
constexpr ll MOD=998244353;
constexpr ll INF=2e18;
int main(){
ll n, k; cin >> n >> k;
VVI dp(n+10);
for(ll i=n;i>=1;i--){
dp[i]=dp[i+1];
dp[i].push_back(i);
for(int j=i+1;j<=n;j++){
dp[i].push_back(i*j);
}
sort(ALL(dp[i]));
}
unordered_map<ll,ll> mp; mp[1]=1;
ll ans=0;
for(ll i=1;i<=n;i++){
unordered_map<ll,ll> nxmp;
for(auto p:mp){
if(p.first*i*(i+1)*(i+2)<=k){
nxmp[p.first]+=p.second;
nxmp[p.first*i]+=p.second;
}
else{
ans+=p.second;
ans+=p.second*(upper_bound(ALL(dp[i]),k/p.first)-dp[i].begin());
}
}
mp=nxmp;
}
for(auto p:mp){
ans+=p.second;
}
cout << ans-1 << endl;
return 0;
}
Haa