結果

問題 No.2318 Phys Bone Maker
ユーザー ruthenruthen
提出日時 2023-05-26 23:29:41
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 2,547 bytes
コンパイル時間 2,194 ms
コンパイル使用メモリ 207,828 KB
実行使用メモリ 8,760 KB
最終ジャッジ日時 2023-08-26 13:53:42
合計ジャッジ時間 6,949 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
7,596 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 TLE -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

using ll = long long;
#define REP(i, n) for (int i = 0; i < (n); i++)
template<class T> using V = vector<T>;

template<class T>
ostream &operator<<(ostream &os, const V<T> &v) {
    os << "[ ";
    for (auto &vi: v) os << vi << ", ";
    return os << "]";
}

template<class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
    return os << "{ " << p.first << ", " << p.second << "}";
}

#ifdef LOCAL
#define show(x) cerr << __LINE__ << " : " << #x << " = " << x << endl;
#else
#define show(x) true
#endif

using uint = unsigned int;
using ull = unsigned long long;
template <uint MD> struct Modint {
    using M = Modint;
    const static M G;
    uint v;
    Modint(ll val = 0) { set_v(val % MD + MD); }
    M& set_v(uint val) {
        v = (val < MD) ? val : val - MD;
        return *this;
    }
    explicit operator bool() const { return v != 0; }
    M operator-() const { return M() - *this; }
    M operator+(const M& r) const { return M().set_v(v + r.v); }
    M operator-(const M& r) const { return M().set_v(v + MD - r.v); }
    M operator*(const M& r) const { return M().set_v(ull(v) * r.v % MD); }
    M operator/(const M& r) const { return *this * r.inv(); }
    M& operator+=(const M& r) { return *this = *this + r; }
    M& operator-=(const M& r) { return *this = *this - r; }
    M& operator*=(const M& r) { return *this = *this * r; }
    M& operator/=(const M& r) { return *this = *this / r; }
    bool operator==(const M& r) const { return v == r.v; }
    M pow(ll n) const {
        M x = *this, r = 1;
        while (n) {
            if (n & 1) r *= x;
            x *= x;
            n >>= 1;
        }
        return r;
    }
    M inv() const { return pow(MD - 2); }
    friend ostream& operator<<(ostream& os, const M& r) { return os << r.v; }
};
using mint = Modint<998244353>;

int main() {
    long long N;
    cin >> N;
    vector<long long> div;
    for (long long d = 1; d * d <= N; d++) {
        if (N % d == 0) {
            div.push_back(d);
            if (d * d != N) div.push_back(N / d);
        }
    }
    sort(div.begin(), div.end());
    show(div);
    int M = int(div.size());
    vector<mint> dp(M);
    dp[0] = 1;
    REP(i, M) {
        REP(j, M) {
            long long nx = lcm(div[i], div[j]);
            int ind = lower_bound(div.begin(), div.end(), nx) - div.begin();
            if (i >= ind or ind >= M or div[ind] != nx) continue;
            dp[ind] += dp[i];
        }
    }
    cout << dp.back() << '\n';
    return 0;
}
0