結果

問題 No.2211 Frequency Table of GCD
ユーザー タコイモタコイモ
提出日時 2023-02-10 21:52:22
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 1,216 bytes
コンパイル時間 341 ms
コンパイル使用メモリ 87,156 KB
実行使用メモリ 109,556 KB
最終ジャッジ日時 2023-09-21 23:01:45
合計ジャッジ時間 25,126 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 94 ms
71,760 KB
testcase_01 AC 92 ms
71,736 KB
testcase_02 AC 92 ms
71,608 KB
testcase_03 AC 1,101 ms
81,092 KB
testcase_04 AC 1,161 ms
91,992 KB
testcase_05 AC 1,606 ms
102,136 KB
testcase_06 AC 1,332 ms
87,896 KB
testcase_07 AC 1,818 ms
99,476 KB
testcase_08 AC 146 ms
86,860 KB
testcase_09 AC 138 ms
82,684 KB
testcase_10 AC 192 ms
99,304 KB
testcase_11 AC 162 ms
92,556 KB
testcase_12 AC 198 ms
102,552 KB
testcase_13 AC 1,044 ms
88,392 KB
testcase_14 AC 1,450 ms
86,480 KB
testcase_15 AC 1,214 ms
83,552 KB
testcase_16 AC 1,373 ms
86,372 KB
testcase_17 AC 1,521 ms
99,036 KB
testcase_18 TLE -
testcase_19 TLE -
testcase_20 TLE -
testcase_21 TLE -
testcase_22 TLE -
testcase_23 AC 1,203 ms
81,736 KB
testcase_24 TLE -
testcase_25 AC 156 ms
105,240 KB
testcase_26 AC 93 ms
71,708 KB
testcase_27 TLE -
testcase_28 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

import time
import sys
#sys.setrecursionlimit(500000)
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def TI(): return tuple(map(int,sys.stdin.readline().rstrip().split()))
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip())
#for i, pi in enumerate(p):
from collections import defaultdict,deque
import bisect
import itertools
dic = defaultdict(int)
def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]
d = deque()
N,M = MI()
A = LI()
mod = 998244353
#たかいやつから数える
S = [0]*(M) #xで割り切れる個数
for i in A:
  s = make_divisors(i)

  for j in s:
    S[j-1] += 1
ans = [0]*(M)
for i in range(M-1,-1,-1):
  ans[i] = (ans[i]+pow(2,S[i],mod)-1)%mod
  s = make_divisors(i+1)
  for j in s:
    if i+1 == j:
      continue
    ans[j-1] -= ans[i]
for i in ans:
  print(i)
  
0