結果

問題 No.1730 GCD on Blackboard in yukicoder
ユーザー とりゐとりゐ
提出日時 2021-08-17 17:16:14
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 339 ms / 2,000 ms
コード長 250 bytes
コンパイル時間 212 ms
コンパイル使用メモリ 82,284 KB
実行使用メモリ 144,940 KB
最終ジャッジ日時 2024-04-25 17:11:09
合計ジャッジ時間 8,320 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 322 ms
144,300 KB
testcase_01 AC 36 ms
53,164 KB
testcase_02 AC 254 ms
110,812 KB
testcase_03 AC 251 ms
111,228 KB
testcase_04 AC 273 ms
110,772 KB
testcase_05 AC 258 ms
111,048 KB
testcase_06 AC 245 ms
110,376 KB
testcase_07 AC 252 ms
110,940 KB
testcase_08 AC 38 ms
52,312 KB
testcase_09 AC 193 ms
99,060 KB
testcase_10 AC 202 ms
99,188 KB
testcase_11 AC 37 ms
52,000 KB
testcase_12 AC 36 ms
52,440 KB
testcase_13 AC 325 ms
144,476 KB
testcase_14 AC 332 ms
144,244 KB
testcase_15 AC 322 ms
144,772 KB
testcase_16 AC 320 ms
144,244 KB
testcase_17 AC 339 ms
144,312 KB
testcase_18 AC 159 ms
112,596 KB
testcase_19 AC 327 ms
144,940 KB
testcase_20 AC 266 ms
131,376 KB
testcase_21 AC 269 ms
131,136 KB
testcase_22 AC 263 ms
132,272 KB
testcase_23 AC 102 ms
106,000 KB
testcase_24 AC 315 ms
141,776 KB
testcase_25 AC 317 ms
144,080 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