結果

問題 No.2902 ZERO!!
ユーザー 寝癖寝癖
提出日時 2024-09-27 20:54:48
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 48 ms / 2,000 ms
コード長 5,016 bytes
コンパイル時間 5,105 ms
コンパイル使用メモリ 329,140 KB
実行使用メモリ 11,324 KB
最終ジャッジ日時 2024-09-27 20:54:56
合計ジャッジ時間 6,723 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,812 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 46 ms
11,324 KB
testcase_03 AC 1 ms
6,940 KB
testcase_04 AC 11 ms
6,944 KB
testcase_05 AC 23 ms
7,296 KB
testcase_06 AC 48 ms
10,776 KB
testcase_07 AC 14 ms
6,940 KB
testcase_08 AC 43 ms
10,424 KB
testcase_09 AC 39 ms
10,180 KB
testcase_10 AC 29 ms
8,448 KB
testcase_11 AC 23 ms
7,424 KB
testcase_12 AC 4 ms
6,940 KB
testcase_13 AC 40 ms
10,372 KB
testcase_14 AC 30 ms
8,704 KB
testcase_15 AC 35 ms
9,472 KB
testcase_16 AC 20 ms
6,948 KB
testcase_17 AC 37 ms
10,036 KB
testcase_18 AC 38 ms
9,728 KB
testcase_19 AC 33 ms
9,160 KB
testcase_20 AC 27 ms
8,192 KB
testcase_21 AC 30 ms
8,704 KB
testcase_22 AC 15 ms
6,940 KB
testcase_23 AC 22 ms
7,040 KB
testcase_24 AC 1 ms
6,940 KB
testcase_25 AC 2 ms
6,940 KB
testcase_26 AC 1 ms
6,940 KB
testcase_27 AC 1 ms
6,940 KB
testcase_28 AC 1 ms
6,944 KB
testcase_29 AC 1 ms
6,940 KB
testcase_30 AC 2 ms
6,944 KB
testcase_31 AC 1 ms
6,940 KB
testcase_32 AC 2 ms
6,944 KB
testcase_33 AC 2 ms
6,944 KB
testcase_34 AC 1 ms
6,940 KB
testcase_35 AC 1 ms
6,944 KB
testcase_36 AC 2 ms
6,940 KB
testcase_37 AC 1 ms
6,944 KB
testcase_38 AC 2 ms
6,940 KB
testcase_39 AC 1 ms
6,944 KB
testcase_40 AC 1 ms
6,940 KB
testcase_41 AC 2 ms
6,940 KB
testcase_42 AC 1 ms
6,940 KB
testcase_43 AC 2 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>

namespace neguse {}
using namespace std;
using namespace atcoder;
using namespace neguse;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<ld> vld;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef vector<string> vs;
typedef vector<pii> vpii;
typedef vector<pll> vpll;

#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define _rrep(i, n) rrepi(i, n - 1, -1)
#define rrepi(i, a, b) for (int i = int(a); i > int(b); --i)
#define rrep(...) _overload3(__VA_ARGS__, rrepi, _rrep)(__VA_ARGS__)
#define _each1(i, v) for (auto &i : v)
#define _each2(i, j, v) for (auto &[i, j] : v)
#define each(...) _overload3(__VA_ARGS__, _each2, _each1, )(__VA_ARGS__)

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define SUM(x) accumulate(all(x), 0LL)
#define MAX(x) *max_element(all(x))
#define MIN(x) *min_element(all(x))
#define ACC(x, acc) partial_sum(all(x), acc.begin()+1)
#define SORT(x) sort(all(x))
#define RSORT(x) sort(rall(x))
#define REVERSE(x) reverse(all(x))

#define dump(x) cerr << #x << " = " << (x) << '\n'
#define print(x) cout << (x) << '\n'
#define yes(f) cout << ((f) ? "Yes" : "No") << '\n'

#define ge(v, x) (int)(lower_bound(all(v), x) - v.begin())
#define gt(v, x) (int)(upper_bound(all(v), x) - v.begin())
#define le(v, x) (int)(upper_bound(all(v), x) - v.begin()) - 1
#define lt(v, x) (int)(lower_bound(all(v), x) - v.begin()) - 1

template <class T> bool chmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; }
template <class T> bool chmin(T &a, const T &b) { return a > b ? a = b, 1 : 0; }

ostream &operator<<(ostream &os, const modint998244353 &a) { return os << a.val(); }
ostream &operator<<(ostream &os, const modint1000000007 &a) { return os << a.val(); }
istream &operator>>(istream &is, modint998244353 &a) { int64_t t; is >> t; a = t; return is; }
istream &operator>>(istream &is, modint1000000007 &a) { int64_t t; is >> t; a = t; return is; }

template <class S, class T> ostream &operator<<(ostream &os, const pair<S, T> &p) { return os << '(' << p.first << ", " << p.second << ')'; }
template <class S, class T> istream &operator>>(istream &is, pair<S, T> &p) { return is >> p.first >> p.second; }
template <class T> istream &operator>>(istream &is, vector<T> &v) { for (T &x : v) is >> x; return is; }
template <class T> ostream &operator<<(ostream &os, const vector<T> &v) { for (const T &x : v) os << x << ' '; return os; }
template <class T> ostream &operator<<(ostream &os, const vector<vector<T>> &v) { for (const vector<T> &x : v) os << x << '\n'; return os; }


#include <algorithm>
#include <vector>
#include <map>

namespace neguse {

std::vector<long long> divisor(long long n, bool sorted = true) {
    std::vector<long long> res;
    for (long long i = 1; i*i <= n; i++) {
        if (n % i == 0) {
            res.push_back(i);
            if (i*i != n) res.push_back(n/i);
        }
    }
    if (sorted) std::sort(res.begin(), res.end());
    return res;
}

std::map<long long, int> prime_factor(long long n) {
    std::map<long long, int> res;
    for (long long i = 2; i*i <= n; i++) {
        while (n % i == 0) {
            res[i]++;
            n /= i;
        }
    }
    if (n != 1) res[n] = 1;
    return res;
}

std::vector<int> spf(int n) {
    std::vector<int> spf(n+1);
    for (int i = 0; i <= n; i++) spf[i] = i;
    for (int i = 2; i*i <= n; i++) {
        if (spf[i] != i) continue;
        for (int j = i*i; j <= n; j += i) {
            if (spf[j] == j) spf[j] = i;
        }
    }
    return spf;
}

std::map<int, int> fast_prime_factor(int n, const std::vector<int>& spf) {
    std::map<int, int> res;
    while (n != 1) {
        res[spf[n]]++;
        n /= spf[n];
    }
    return res;
}

bool is_prime(long long n) {
    if (n <= 1) return false;
    for (long long i = 2; i*i <= n; i++) {
        if (n % i == 0) return false;
    }
    return true;
}

std::vector<bool> prime_table(int n) {
    std::vector<bool> is_prime(n+1, true);
    if (n >= 0) is_prime[0] = false;
    if (n >= 1) is_prime[1] = false;
    for (int i = 2; i*i <= n; i++) {
        if (!is_prime[i]) continue;
        for (int j = i*2; j <= n; j += i) {
            is_prime[j] = false;
        }
    }
    return is_prime;
}

}


int main() {
    int N;
    cin >> N;

    auto p = prime_table(N);
    vi primes;
    rep(i, N+1) if (p[i]) primes.push_back(i);

    map<int, int> cnt;
    for (auto p: primes) {
        for (ll i = p; i <= N; i *= p) cnt[p] += N / i;
    }
    using mint = modint998244353;
    vector<mint> A(cnt[2]+1, 1);
    for (auto [p, c]: cnt) {
        rep(k, 1, c+1) A[k] *= 1 + c/k;
    }
    mint ans = 0;
    for (auto a: A) ans += a - 1;
    cout << ans << endl;

    return 0;
}
0