結果

問題 No.1730 GCD on Blackboard in yukicoder
ユーザー 👑 KazunKazun
提出日時 2021-11-05 22:51:24
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 216 ms / 2,000 ms
コード長 453 bytes
コンパイル時間 288 ms
コンパイル使用メモリ 82,168 KB
実行使用メモリ 121,396 KB
最終ジャッジ日時 2024-04-25 17:32:06
合計ジャッジ時間 5,992 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 200 ms
120,976 KB
testcase_01 AC 37 ms
53,536 KB
testcase_02 AC 149 ms
90,928 KB
testcase_03 AC 152 ms
91,344 KB
testcase_04 AC 155 ms
91,292 KB
testcase_05 AC 150 ms
91,308 KB
testcase_06 AC 158 ms
91,028 KB
testcase_07 AC 148 ms
91,024 KB
testcase_08 AC 37 ms
54,324 KB
testcase_09 AC 119 ms
86,768 KB
testcase_10 AC 120 ms
86,804 KB
testcase_11 AC 38 ms
52,268 KB
testcase_12 AC 38 ms
52,268 KB
testcase_13 AC 205 ms
121,396 KB
testcase_14 AC 216 ms
121,112 KB
testcase_15 AC 199 ms
120,936 KB
testcase_16 AC 207 ms
120,984 KB
testcase_17 AC 200 ms
121,116 KB
testcase_18 AC 117 ms
108,412 KB
testcase_19 AC 210 ms
121,056 KB
testcase_20 AC 171 ms
115,632 KB
testcase_21 AC 170 ms
115,692 KB
testcase_22 AC 174 ms
116,812 KB
testcase_23 AC 89 ms
106,776 KB
testcase_24 AC 188 ms
119,100 KB
testcase_25 AC 206 ms
120,976 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#==================================================
import sys
input=sys.stdin.readline
write=sys.stdout.write

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

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

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

U=[0]*(alpha+1)
for a in range(1,alpha+1):
    for b in range(a,alpha+1,a):
        U[a]+=T[b]

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

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

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