結果

問題 No.1730 GCD on Blackboard in yukicoder
ユーザー horitaka1999horitaka1999
提出日時 2021-11-05 23:37:28
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 261 ms / 2,000 ms
コード長 555 bytes
コンパイル時間 1,413 ms
コンパイル使用メモリ 86,532 KB
実行使用メモリ 116,688 KB
最終ジャッジ日時 2023-08-07 23:24:15
合計ジャッジ時間 9,086 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 260 ms
116,496 KB
testcase_01 AC 185 ms
84,532 KB
testcase_02 AC 175 ms
84,300 KB
testcase_03 AC 175 ms
84,064 KB
testcase_04 AC 173 ms
84,380 KB
testcase_05 AC 177 ms
84,580 KB
testcase_06 AC 174 ms
84,724 KB
testcase_07 AC 177 ms
84,360 KB
testcase_08 AC 173 ms
84,264 KB
testcase_09 AC 174 ms
84,284 KB
testcase_10 AC 174 ms
84,664 KB
testcase_11 AC 171 ms
84,404 KB
testcase_12 AC 176 ms
84,276 KB
testcase_13 AC 240 ms
116,540 KB
testcase_14 AC 239 ms
116,644 KB
testcase_15 AC 239 ms
116,496 KB
testcase_16 AC 240 ms
116,688 KB
testcase_17 AC 242 ms
116,644 KB
testcase_18 AC 240 ms
116,508 KB
testcase_19 AC 244 ms
116,600 KB
testcase_20 AC 242 ms
115,636 KB
testcase_21 AC 241 ms
115,560 KB
testcase_22 AC 261 ms
116,600 KB
testcase_23 AC 233 ms
114,008 KB
testcase_24 AC 231 ms
113,924 KB
testcase_25 AC 238 ms
116,452 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
A = list(map(int,input().split()))
cnt = [0 for _ in range(10**6+1)]
for a in A:
    cnt[a] += 1
filed = [0 for _ in range(N+1)]
for g in range(1,10**6+1):
    m = 10 ** 6 // g
    tmp = 0
    for i in range(1,m+1):
        tmp += cnt[g * i]
    filed[N-tmp] = g

def max_lift(List):
    rev = [0 for _ in range(len(List))]
    for i in range(len(List)):
        if i == 0:
            rev[i] = List[i]
        else:
            rev[i] = max(rev[i-1],List[i])
    return rev
ans = max_lift(filed)
for k in range(N):
    print(ans[k])
    
0