結果

問題 No.1730 GCD on Blackboard in yukicoder
ユーザー googol_S0googol_S0
提出日時 2021-11-05 21:28:27
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 253 ms / 2,000 ms
コード長 322 bytes
コンパイル時間 503 ms
コンパイル使用メモリ 86,972 KB
実行使用メモリ 123,100 KB
最終ジャッジ日時 2023-08-07 22:56:18
合計ジャッジ時間 8,064 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 253 ms
123,024 KB
testcase_01 AC 184 ms
92,500 KB
testcase_02 AC 184 ms
92,284 KB
testcase_03 AC 184 ms
92,284 KB
testcase_04 AC 183 ms
92,244 KB
testcase_05 AC 180 ms
92,144 KB
testcase_06 AC 182 ms
92,284 KB
testcase_07 AC 181 ms
92,260 KB
testcase_08 AC 182 ms
92,020 KB
testcase_09 AC 180 ms
92,228 KB
testcase_10 AC 182 ms
92,216 KB
testcase_11 AC 180 ms
92,496 KB
testcase_12 AC 184 ms
92,264 KB
testcase_13 AC 245 ms
122,856 KB
testcase_14 AC 243 ms
123,040 KB
testcase_15 AC 244 ms
122,808 KB
testcase_16 AC 244 ms
122,880 KB
testcase_17 AC 244 ms
123,100 KB
testcase_18 AC 242 ms
122,936 KB
testcase_19 AC 243 ms
122,860 KB
testcase_20 AC 247 ms
121,540 KB
testcase_21 AC 244 ms
121,980 KB
testcase_22 AC 245 ms
122,848 KB
testcase_23 AC 238 ms
120,360 KB
testcase_24 AC 237 ms
120,312 KB
testcase_25 AC 244 ms
122,812 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())
A=list(map(int,input().split()))
M=10**6+3
C=[0]*M
for i in range(N):
  C[A[i]]+=1
X=[0]*M
for i in range(1,M):
  for j in range(i,M,i):
    X[i]+=C[j]
ANS=[0]*(N+1)
for i in range(M):
  ANS[X[i]]=max(ANS[X[i]],i)
for i in range(N-1,-1,-1):
  ANS[i]=max(ANS[i],ANS[i+1])
for i in range(N):
  print(ANS[N-i])
0