結果

問題 No.2318 Phys Bone Maker
ユーザー otoshigootoshigo
提出日時 2023-05-27 04:59:32
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 360 ms / 3,000 ms
コード長 1,588 bytes
コンパイル時間 1,027 ms
コンパイル使用メモリ 86,728 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-07 12:00:29
合計ジャッジ時間 5,011 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 360 ms
5,376 KB
testcase_03 AC 7 ms
5,376 KB
testcase_04 AC 8 ms
5,376 KB
testcase_05 AC 8 ms
5,376 KB
testcase_06 AC 8 ms
5,376 KB
testcase_07 AC 3 ms
5,376 KB
testcase_08 AC 8 ms
5,376 KB
testcase_09 AC 7 ms
5,376 KB
testcase_10 AC 12 ms
5,376 KB
testcase_11 AC 9 ms
5,376 KB
testcase_12 AC 12 ms
5,376 KB
testcase_13 AC 11 ms
5,376 KB
testcase_14 AC 9 ms
5,376 KB
testcase_15 AC 9 ms
5,376 KB
testcase_16 AC 9 ms
5,376 KB
testcase_17 AC 12 ms
5,376 KB
testcase_18 AC 12 ms
5,376 KB
testcase_19 AC 6 ms
5,376 KB
testcase_20 AC 10 ms
5,376 KB
testcase_21 AC 8 ms
5,376 KB
testcase_22 AC 7 ms
5,376 KB
testcase_23 AC 7 ms
5,376 KB
testcase_24 AC 11 ms
5,376 KB
testcase_25 AC 9 ms
5,376 KB
testcase_26 AC 10 ms
5,376 KB
testcase_27 AC 11 ms
5,376 KB
testcase_28 AC 8 ms
5,376 KB
testcase_29 AC 6 ms
5,376 KB
testcase_30 AC 5 ms
5,376 KB
testcase_31 AC 13 ms
5,376 KB
testcase_32 AC 10 ms
5,376 KB
testcase_33 AC 2 ms
5,376 KB
testcase_34 AC 10 ms
5,376 KB
testcase_35 AC 43 ms
5,376 KB
testcase_36 AC 175 ms
5,376 KB
testcase_37 AC 176 ms
5,376 KB
testcase_38 AC 180 ms
5,376 KB
testcase_39 AC 269 ms
5,376 KB
testcase_40 AC 266 ms
5,376 KB
testcase_41 AC 304 ms
5,376 KB
testcase_42 AC 306 ms
5,376 KB
testcase_43 AC 13 ms
5,376 KB
testcase_44 AC 44 ms
5,376 KB
testcase_45 AC 41 ms
5,376 KB
testcase_46 AC 309 ms
5,376 KB
testcase_47 AC 13 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
template<class T> bool chmax(T &a, T b){if (a < b){a = b;return true;} else return false;}
template<class T> bool chmin(T &a, T b){if (a > b){a = b;return true;} else return false;}

const ll MOD=998244353;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll N;
    cin>>N;
    ll x=1;
    vector<ll>C;
    while(x*x<=N){
        if(N%x==0){
            C.push_back(x);
            if(x*x<N)C.push_back(N/x);
        }
        x++;
    }
    sort(all(C));
    int l=C.size();
    vector<ll>P;
    for(int i=1;i<l;i++){
        bool flag=true;
        for(auto p:P){
            if(C[i]%p==0){
                flag=false;
                break;
            }
        }
        if(flag)P.push_back(C[i]);
    }
    int m=P.size();
    vector V(l,vector<int>(m));
    rep(i,l){
        rep(j,m){
            ll p=P[j],q=p;
            while(C[i]%q==0){
                q*=p;
                V[i][j]++;
            }
        }
    }
    vector<ll>dp(l);
    dp[0]=1;
    rep(i,l-1){
        for(int j=i+1;j<l;j++){
            if(C[j]%C[i]!=0)continue;
            ll t=1;
            rep(k,m){
                if(V[i][k]==V[j][k]){
                    t*=V[i][k]+1;
                    t%=MOD;
                }
            }
            dp[j]+=t*dp[i];
            dp[j]%=MOD;
        }
    }
    cout<<dp[l-1]<<"\n";
}
0