結果

問題 No.2318 Phys Bone Maker
ユーザー ttkkggwwttkkggww
提出日時 2023-05-26 23:30:11
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 1,956 ms / 3,000 ms
コード長 1,477 bytes
コンパイル時間 4,234 ms
コンパイル使用メモリ 280,820 KB
実行使用メモリ 22,940 KB
最終ジャッジ日時 2023-08-26 13:54:20
合計ジャッジ時間 20,447 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1,956 ms
22,940 KB
testcase_03 AC 18 ms
4,380 KB
testcase_04 AC 24 ms
4,376 KB
testcase_05 AC 15 ms
4,376 KB
testcase_06 AC 15 ms
4,376 KB
testcase_07 AC 6 ms
4,380 KB
testcase_08 AC 32 ms
4,376 KB
testcase_09 AC 18 ms
4,376 KB
testcase_10 AC 39 ms
4,376 KB
testcase_11 AC 51 ms
4,380 KB
testcase_12 AC 86 ms
4,380 KB
testcase_13 AC 70 ms
4,380 KB
testcase_14 AC 29 ms
4,380 KB
testcase_15 AC 27 ms
4,376 KB
testcase_16 AC 19 ms
4,376 KB
testcase_17 AC 34 ms
4,380 KB
testcase_18 AC 76 ms
4,376 KB
testcase_19 AC 11 ms
4,380 KB
testcase_20 AC 21 ms
4,376 KB
testcase_21 AC 15 ms
4,376 KB
testcase_22 AC 16 ms
4,380 KB
testcase_23 AC 17 ms
4,380 KB
testcase_24 AC 31 ms
4,376 KB
testcase_25 AC 36 ms
4,380 KB
testcase_26 AC 36 ms
4,380 KB
testcase_27 AC 23 ms
4,376 KB
testcase_28 AC 13 ms
4,376 KB
testcase_29 AC 11 ms
4,376 KB
testcase_30 AC 13 ms
4,380 KB
testcase_31 AC 51 ms
4,376 KB
testcase_32 AC 28 ms
4,380 KB
testcase_33 AC 2 ms
4,380 KB
testcase_34 AC 36 ms
4,376 KB
testcase_35 AC 227 ms
5,088 KB
testcase_36 AC 830 ms
12,012 KB
testcase_37 AC 867 ms
13,480 KB
testcase_38 AC 1,050 ms
14,116 KB
testcase_39 AC 1,284 ms
16,336 KB
testcase_40 AC 1,355 ms
17,828 KB
testcase_41 AC 1,513 ms
17,864 KB
testcase_42 AC 1,619 ms
19,720 KB
testcase_43 AC 81 ms
4,376 KB
testcase_44 AC 580 ms
8,228 KB
testcase_45 AC 525 ms
7,968 KB
testcase_46 AC 1,871 ms
21,888 KB
testcase_47 AC 33 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#include<atcoder/all>
using namespace atcoder;
using ll = long long;
ll x;
vector<long long> divisor(long long n) {
    vector<long long> ret;
    for (long long i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            ret.push_back(i);
            if (i * i != n) ret.push_back(n / i);
        }
    }
    sort(ret.begin(), ret.end()); // 昇順に並べる
    return ret;
}
template <typename T>
vector<pair<T, T>> prime_factor(T n) {
    vector<pair<T, T>> ret;
    for (T i = 2; i * i <= n; i++) {
        if (n % i != 0) continue;
        T tmp = 0;
        while (n % i == 0) {
            tmp++;
            n /= i;
        }
        ret.push_back(make_pair(i, tmp));
    }
    if (n != 1) ret.push_back(make_pair(n, 1));
    return ret;
}
using mit = modint998244353;

unordered_map<ll,ll> mp;
unordered_map<ll,mit> dp;
unordered_map<ll,vector<ll>> divisor_mp;

ll cnt_prime(ll n,ll x){
	int cnt = 0;
	while(n%x==0){
		cnt++;
		n/=x;
	}
	return cnt;
}

void solve(){
	auto v = divisor(x);
	for(auto &i:v){
		divisor_mp[i] = divisor(i);
	}
	dp[1] = 1;
	auto pv = prime_factor(x);
	for(auto &i:v){
		for(auto &j:divisor_mp[i]){
			if(j==i)continue;
			mit mul = 1;
			for(auto &[p,x]:pv){
				if(cnt_prime(i,p)==cnt_prime(j,p)){
					mul *= cnt_prime(i,p)+1;
				}
			}
			dp[i] += dp[j]*(mul);
		}
	}
	cout<<dp[x].val()<<endl;
}

signed main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cin >> x;
	solve();
}
0