結果

問題 No.2211 Frequency Table of GCD
ユーザー 遭難者遭難者
提出日時 2022-12-22 18:05:27
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 46 ms / 2,000 ms
コード長 945 bytes
コンパイル時間 4,334 ms
コンパイル使用メモリ 261,300 KB
実行使用メモリ 5,544 KB
最終ジャッジ日時 2023-09-22 00:57:10
合計ジャッジ時間 7,367 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 18 ms
4,596 KB
testcase_04 AC 23 ms
4,392 KB
testcase_05 AC 31 ms
4,812 KB
testcase_06 AC 24 ms
4,668 KB
testcase_07 AC 32 ms
5,224 KB
testcase_08 AC 6 ms
4,380 KB
testcase_09 AC 5 ms
4,376 KB
testcase_10 AC 12 ms
4,376 KB
testcase_11 AC 10 ms
4,376 KB
testcase_12 AC 13 ms
4,376 KB
testcase_13 AC 20 ms
4,380 KB
testcase_14 AC 25 ms
5,000 KB
testcase_15 AC 21 ms
4,724 KB
testcase_16 AC 24 ms
4,624 KB
testcase_17 AC 28 ms
4,540 KB
testcase_18 AC 42 ms
5,416 KB
testcase_19 AC 46 ms
5,380 KB
testcase_20 AC 42 ms
5,440 KB
testcase_21 AC 41 ms
5,544 KB
testcase_22 AC 40 ms
5,336 KB
testcase_23 AC 20 ms
4,584 KB
testcase_24 AC 39 ms
5,392 KB
testcase_25 AC 14 ms
4,380 KB
testcase_26 AC 1 ms
4,380 KB
testcase_27 AC 38 ms
5,340 KB
testcase_28 AC 40 ms
5,328 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#include <atcoder/all>
using namespace atcoder;
#define mint modint998244353
#define rep(i, n) for (int i = 0; i < n; i++)
#define endl '\n'
int main()
{
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    int n, m;
    cin >> n >> m;
    vector<int> c(m + 1);
    for (int i = 0; i < n; i++)
    {
        int x;
        cin >> x;
        c[x]++;
    }
    for (int i = 1; i <= m; i++)
        for (int j = i << 1; j <= m; j += i)
            c[i] += c[j];
    vector<mint> two(n + 1), d(m + 1);
    two[0] = 1LL;
    for (int i = 1; i <= n; i++)
        two[i] = 2 * two[i - 1];
    for (int i = 1; i <= m; i++)
        d[i] = two[c[i]] - 1;
    for (int i = m; i > 0; i--)
        for (int j = i << 1; j <= m; j += i)
            d[i] -= d[j];
    for (int i = 1; i <= m; i++)
        cout << d[i].val() << endl;
    return 0;
}
0