結果

問題 No.1532 Different Products
ユーザー asaringoasaringo
提出日時 2021-06-05 15:55:46
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 560 ms / 4,000 ms
コード長 602 bytes
コンパイル時間 1,839 ms
コンパイル使用メモリ 175,564 KB
実行使用メモリ 12,036 KB
最終ジャッジ日時 2024-11-21 13:42:25
合計ジャッジ時間 21,566 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 62
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std ;
typedef long long ll ;
#define rep(i,n) for(int i = 0 ; i < n ; i++)
#define rrep(i,a,b) for(int i = a ; i < b ; i++)

int main() {
    ll n, k ;
    cin >> n >> k ;
    unordered_map<ll, ll> dp ;
    dp[k] = 1 ;
    for(int i = n ; i > 0 ; i--)
        for (auto it : unordered_map<ll, ll>(dp)){
            ll x = it.first , y = it.second ;
            dp[x/i] += y ;
        }
    ll ans = -1 ;
    for (auto it : dp){
        ll x = it.first , y = it.second ; 
        if(x == 0) continue ;
        if (x) ans += y ;
    }
    cout << ans << endl ;
}
0