結果

問題 No.2211 Frequency Table of GCD
ユーザー HydruHydru
提出日時 2023-02-10 22:03:15
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 881 bytes
コンパイル時間 347 ms
コンパイル使用メモリ 87,152 KB
実行使用メモリ 118,620 KB
最終ジャッジ日時 2023-09-21 23:19:09
合計ジャッジ時間 28,192 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 85 ms
71,348 KB
testcase_01 AC 80 ms
71,244 KB
testcase_02 AC 81 ms
71,388 KB
testcase_03 AC 192 ms
89,280 KB
testcase_04 AC 897 ms
98,304 KB
testcase_05 AC 1,328 ms
110,932 KB
testcase_06 AC 955 ms
92,836 KB
testcase_07 AC 1,376 ms
108,376 KB
testcase_08 AC 120 ms
90,252 KB
testcase_09 AC 117 ms
84,556 KB
testcase_10 AC 162 ms
109,296 KB
testcase_11 AC 130 ms
98,528 KB
testcase_12 AC 173 ms
112,800 KB
testcase_13 AC 782 ms
94,256 KB
testcase_14 AC 869 ms
91,264 KB
testcase_15 AC 620 ms
87,564 KB
testcase_16 AC 808 ms
91,160 KB
testcase_17 AC 1,217 ms
107,948 KB
testcase_18 AC 1,960 ms
107,676 KB
testcase_19 TLE -
testcase_20 AC 1,952 ms
107,536 KB
testcase_21 AC 1,934 ms
107,472 KB
testcase_22 AC 1,935 ms
107,504 KB
testcase_23 AC 129 ms
95,292 KB
testcase_24 AC 1,590 ms
111,320 KB
testcase_25 AC 131 ms
118,620 KB
testcase_26 AC 81 ms
71,520 KB
testcase_27 TLE -
testcase_28 AC 1,598 ms
111,540 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def divisor_enumation(n):
    i=1
    result=set()
    while(i*i<n):
        if n%i==0:
            result.add(i)
            result.add(n//i)
        i+=1
    if i*i==n:
        result.add(i)
    return result

mod=998244353

n,m=map(int,input().split())
A=list(map(int,input().split()))

pow_2=[1]
for _ in range(n+1):
    pow_2.append(pow_2[-1]*2%mod)

cnt=[0 for _ in range(m+1)]

for i in range(n):
    a=A[i]
    n=1

    while(n*n<a):
        if a%n==0:
            cnt[n]+=1
            cnt[a//n]+=1
        n+=1
    if n*n==a:
        cnt[n]+=1

dem=[0 for _ in range(m+1)]
ans=[]

for i in range(m,0,-1):
    
    ans.append((pow_2[cnt[i]]-1-dem[i])%mod)

    if cnt[i]==0:
        continue
    
    X=divisor_enumation(i)
    for u in X:
        if u==i:
            continue
        dem[u]+=pow_2[cnt[i]]-1-dem[i]
        dem[u]%=mod

for x in ans[::-1]:
    print(x)

0