結果

問題 No.1730 GCD on Blackboard in yukicoder
ユーザー とりゐとりゐ
提出日時 2021-10-29 05:42:34
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 335 ms / 2,000 ms
コード長 268 bytes
コンパイル時間 474 ms
コンパイル使用メモリ 82,708 KB
実行使用メモリ 152,612 KB
最終ジャッジ日時 2024-04-25 17:11:43
合計ジャッジ時間 8,337 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 317 ms
152,612 KB
testcase_01 AC 36 ms
52,328 KB
testcase_02 AC 253 ms
118,952 KB
testcase_03 AC 259 ms
118,756 KB
testcase_04 AC 264 ms
118,680 KB
testcase_05 AC 252 ms
118,948 KB
testcase_06 AC 258 ms
118,456 KB
testcase_07 AC 259 ms
118,696 KB
testcase_08 AC 37 ms
52,404 KB
testcase_09 AC 197 ms
104,456 KB
testcase_10 AC 199 ms
104,564 KB
testcase_11 AC 36 ms
52,960 KB
testcase_12 AC 35 ms
51,944 KB
testcase_13 AC 331 ms
152,096 KB
testcase_14 AC 323 ms
152,264 KB
testcase_15 AC 332 ms
152,108 KB
testcase_16 AC 334 ms
152,176 KB
testcase_17 AC 329 ms
152,072 KB
testcase_18 AC 162 ms
114,352 KB
testcase_19 AC 335 ms
152,488 KB
testcase_20 AC 266 ms
136,680 KB
testcase_21 AC 258 ms
136,716 KB
testcase_22 AC 257 ms
137,888 KB
testcase_23 AC 97 ms
105,772 KB
testcase_24 AC 308 ms
149,528 KB
testcase_25 AC 328 ms
151,880 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# 解説用
n=int(input())
a=list(map(int,input().split()))
max_a=max(a)
cnt=[0]*(max_a+1)
for i in a:
  cnt[i]+=1
cnt_max=[0]*n
for i in range(1,max_a+1):
  m=sum(cnt[i::i])
  if m!=0:
    cnt_max[n-m]=i
ans=1
for i in range(n):
  ans=max(ans,cnt_max[i])
  print(ans)
0