結果

問題 No.1730 GCD on Blackboard in yukicoder
ユーザー とりゐとりゐ
提出日時 2021-10-19 10:27:04
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,127 ms / 2,000 ms
コード長 250 bytes
コンパイル時間 172 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 33,308 KB
最終ジャッジ日時 2024-04-25 17:12:49
合計ジャッジ時間 21,471 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,020 ms
33,188 KB
testcase_01 AC 30 ms
10,880 KB
testcase_02 AC 687 ms
22,392 KB
testcase_03 AC 683 ms
22,324 KB
testcase_04 AC 702 ms
22,404 KB
testcase_05 AC 673 ms
22,260 KB
testcase_06 AC 686 ms
22,336 KB
testcase_07 AC 670 ms
22,520 KB
testcase_08 AC 29 ms
10,880 KB
testcase_09 AC 503 ms
19,168 KB
testcase_10 AC 496 ms
19,232 KB
testcase_11 AC 29 ms
10,752 KB
testcase_12 AC 29 ms
10,880 KB
testcase_13 AC 1,087 ms
33,140 KB
testcase_14 AC 1,096 ms
33,260 KB
testcase_15 AC 1,087 ms
33,236 KB
testcase_16 AC 1,119 ms
33,116 KB
testcase_17 AC 1,127 ms
33,172 KB
testcase_18 AC 521 ms
29,552 KB
testcase_19 AC 1,117 ms
33,308 KB
testcase_20 AC 852 ms
28,396 KB
testcase_21 AC 866 ms
28,552 KB
testcase_22 AC 858 ms
29,972 KB
testcase_23 AC 356 ms
14,136 KB
testcase_24 AC 1,030 ms
25,548 KB
testcase_25 AC 1,086 ms
33,216 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