結果

問題 No.1730 GCD on Blackboard in yukicoder
ユーザー HydruHydru
提出日時 2021-11-06 12:37:30
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 157 ms / 2,000 ms
コード長 487 bytes
コンパイル時間 153 ms
コンパイル使用メモリ 82,420 KB
実行使用メモリ 122,780 KB
最終ジャッジ日時 2024-04-25 17:40:02
合計ジャッジ時間 4,455 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 157 ms
122,780 KB
testcase_01 AC 35 ms
53,820 KB
testcase_02 AC 90 ms
82,484 KB
testcase_03 AC 90 ms
83,292 KB
testcase_04 AC 88 ms
81,700 KB
testcase_05 AC 86 ms
81,328 KB
testcase_06 AC 86 ms
81,800 KB
testcase_07 AC 88 ms
81,380 KB
testcase_08 AC 36 ms
52,396 KB
testcase_09 AC 74 ms
76,984 KB
testcase_10 AC 77 ms
77,036 KB
testcase_11 AC 36 ms
52,620 KB
testcase_12 AC 36 ms
52,792 KB
testcase_13 AC 146 ms
122,404 KB
testcase_14 AC 146 ms
122,236 KB
testcase_15 AC 150 ms
122,468 KB
testcase_16 AC 147 ms
122,592 KB
testcase_17 AC 145 ms
122,404 KB
testcase_18 AC 110 ms
109,752 KB
testcase_19 AC 142 ms
122,632 KB
testcase_20 AC 127 ms
116,392 KB
testcase_21 AC 127 ms
116,628 KB
testcase_22 AC 138 ms
118,148 KB
testcase_23 AC 91 ms
107,424 KB
testcase_24 AC 139 ms
119,712 KB
testcase_25 AC 148 ms
122,016 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#Z-Transform
def Multiple_Zeta_Transform(A):
    N=len(A)-1
    S=[1]*(N+1)

    for p in range(2,N+1):
        if S[p]:
            for k in range(N//p,0,-1):
                S[k*p]=0
                A[k]+=A[k*p]

N=int(input())
A=list(map(int,input().split()))

alpha=max(A)
T=[0]*(alpha+1)

for a in A:
    T[a]+=1

Multiple_Zeta_Transform(T)

X=[0]*(N+1)
for a in range(alpha+1):
    X[T[a]]=a

for i in range(N-1,0,-1):
    X[i]=max(X[i],X[i+1])

print("\n".join(map(str,X[:0:-1])))
0