結果
問題 | No.2211 Frequency Table of GCD |
ユーザー |
|
提出日時 | 2023-02-10 23:27:01 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 475 bytes |
コンパイル時間 | 372 ms |
コンパイル使用メモリ | 82,048 KB |
実行使用メモリ | 67,456 KB |
最終ジャッジ日時 | 2024-07-07 17:23:51 |
合計ジャッジ時間 | 4,339 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | TLE * 1 -- * 25 |
ソースコード
MOD = 998244353 N, M = map(int, input().split()) A = list(map(int, input().split())) cnt = [0] * (M + 1) for i in range(1, M + 1): j = i while j <= M: cnt[i] += A.count(j) cnt[i] %= MOD j += i cnt[i] = (pow(2, cnt[i], MOD) - 1) % MOD ans = [0] * (M + 1) for i in range(M, 0, -1): ans[i] = cnt[i] j = 2 * i while j <= M: ans[i] -= ans[j] ans[i] %= MOD j += i for i in range(1, M + 1): print(ans[i])