結果
| 問題 |
No.1532 Different Products
|
| コンテスト | |
| ユーザー |
Haa
|
| 提出日時 | 2021-06-04 21:19:46 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 1,058 bytes |
| コンパイル時間 | 1,671 ms |
| コンパイル使用メモリ | 177,032 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-19 12:09:05 |
| 合計ジャッジ時間 | 124,369 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 54 TLE * 8 |
ソースコード
#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;
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;
for(ll j=i;j<=n;j++){
if(p.first*j<=k)
ans+=p.second;
}
for(ll j=i;j<=n;j++)for(ll l=j+1;l<=n;l++){
if(p.first*j*l<=k)
ans+=p.second;
}
}
}
mp=nxmp;
}
for(auto p:mp){
ans+=p.second;
}
cout << ans-1 << endl;
return 0;
}
Haa