結果

問題 No.1730 GCD on Blackboard in yukicoder
ユーザー googol_S0googol_S0
提出日時 2021-11-05 21:28:27
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 221 ms / 2,000 ms
コード長 322 bytes
コンパイル時間 211 ms
コンパイル使用メモリ 82,560 KB
実行使用メモリ 122,800 KB
最終ジャッジ日時 2024-04-25 17:13:45
合計ジャッジ時間 7,176 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 214 ms
122,800 KB
testcase_01 AC 150 ms
91,360 KB
testcase_02 AC 150 ms
91,100 KB
testcase_03 AC 151 ms
91,272 KB
testcase_04 AC 155 ms
91,476 KB
testcase_05 AC 149 ms
91,132 KB
testcase_06 AC 152 ms
91,116 KB
testcase_07 AC 153 ms
91,640 KB
testcase_08 AC 156 ms
91,060 KB
testcase_09 AC 151 ms
91,248 KB
testcase_10 AC 152 ms
91,120 KB
testcase_11 AC 147 ms
91,456 KB
testcase_12 AC 155 ms
91,056 KB
testcase_13 AC 216 ms
122,216 KB
testcase_14 AC 219 ms
122,244 KB
testcase_15 AC 219 ms
122,344 KB
testcase_16 AC 218 ms
122,108 KB
testcase_17 AC 220 ms
122,128 KB
testcase_18 AC 216 ms
122,104 KB
testcase_19 AC 213 ms
122,392 KB
testcase_20 AC 218 ms
120,884 KB
testcase_21 AC 211 ms
120,828 KB
testcase_22 AC 216 ms
122,212 KB
testcase_23 AC 209 ms
119,472 KB
testcase_24 AC 210 ms
119,636 KB
testcase_25 AC 221 ms
121,912 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