結果

問題 No.2318 Phys Bone Maker
ユーザー otoshigootoshigo
提出日時 2023-05-27 04:55:51
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,589 bytes
コンパイル時間 920 ms
コンパイル使用メモリ 87,192 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-26 16:22:37
合計ジャッジ時間 6,264 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 334 ms
4,380 KB
testcase_03 AC 6 ms
4,376 KB
testcase_04 AC 8 ms
4,376 KB
testcase_05 AC 8 ms
4,376 KB
testcase_06 AC 7 ms
4,380 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 7 ms
4,376 KB
testcase_09 AC 6 ms
4,376 KB
testcase_10 AC 11 ms
4,380 KB
testcase_11 WA -
testcase_12 AC 11 ms
4,380 KB
testcase_13 AC 9 ms
4,380 KB
testcase_14 AC 8 ms
4,376 KB
testcase_15 AC 8 ms
4,376 KB
testcase_16 WA -
testcase_17 AC 10 ms
4,380 KB
testcase_18 AC 11 ms
4,380 KB
testcase_19 AC 5 ms
4,376 KB
testcase_20 AC 9 ms
4,380 KB
testcase_21 AC 7 ms
4,376 KB
testcase_22 AC 6 ms
4,376 KB
testcase_23 AC 6 ms
4,380 KB
testcase_24 AC 9 ms
4,376 KB
testcase_25 WA -
testcase_26 AC 8 ms
4,376 KB
testcase_27 AC 10 ms
4,376 KB
testcase_28 AC 6 ms
4,380 KB
testcase_29 AC 6 ms
4,376 KB
testcase_30 WA -
testcase_31 AC 11 ms
4,380 KB
testcase_32 WA -
testcase_33 AC 1 ms
4,376 KB
testcase_34 RE -
testcase_35 AC 38 ms
4,376 KB
testcase_36 AC 158 ms
4,380 KB
testcase_37 AC 161 ms
4,376 KB
testcase_38 AC 165 ms
4,380 KB
testcase_39 AC 252 ms
4,380 KB
testcase_40 AC 244 ms
4,380 KB
testcase_41 AC 274 ms
4,380 KB
testcase_42 AC 275 ms
4,376 KB
testcase_43 AC 12 ms
4,376 KB
testcase_44 AC 41 ms
4,380 KB
testcase_45 AC 36 ms
4,380 KB
testcase_46 AC 280 ms
4,380 KB
testcase_47 AC 12 ms
4,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){
            int 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