結果

問題 No.1730 GCD on Blackboard in yukicoder
ユーザー とりゐとりゐ
提出日時 2021-08-17 17:16:14
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 384 ms / 2,000 ms
コード長 250 bytes
コンパイル時間 457 ms
コンパイル使用メモリ 87,204 KB
実行使用メモリ 145,800 KB
最終ジャッジ日時 2023-08-07 22:53:47
合計ジャッジ時間 11,372 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 370 ms
145,800 KB
testcase_01 AC 73 ms
71,416 KB
testcase_02 AC 302 ms
111,936 KB
testcase_03 AC 305 ms
112,020 KB
testcase_04 AC 311 ms
111,644 KB
testcase_05 AC 309 ms
112,012 KB
testcase_06 AC 305 ms
111,156 KB
testcase_07 AC 298 ms
111,700 KB
testcase_08 AC 73 ms
71,424 KB
testcase_09 AC 228 ms
99,844 KB
testcase_10 AC 234 ms
99,876 KB
testcase_11 AC 73 ms
71,208 KB
testcase_12 AC 72 ms
71,196 KB
testcase_13 AC 377 ms
145,620 KB
testcase_14 AC 377 ms
145,620 KB
testcase_15 AC 383 ms
145,708 KB
testcase_16 AC 384 ms
145,564 KB
testcase_17 AC 374 ms
145,624 KB
testcase_18 AC 188 ms
113,684 KB
testcase_19 AC 377 ms
145,552 KB
testcase_20 AC 302 ms
132,064 KB
testcase_21 AC 301 ms
132,128 KB
testcase_22 AC 306 ms
133,760 KB
testcase_23 AC 134 ms
107,280 KB
testcase_24 AC 361 ms
142,652 KB
testcase_25 AC 375 ms
145,480 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n=int(input())
a=list(map(int,input().split()))
b=max(a)+1
d=[0]*b
for i in a:
  d[i]+=1
ans=[1]*(n)
for i in range(2,b):
  t=sum(d[i::i])
  if t!=0:
    ans[n-t]=i
for i in range(1,n):
  ans[i]=max(ans[i],ans[i-1])
for i in range(n):
  print(ans[i])
0