結果

問題 No.1730 GCD on Blackboard in yukicoder
ユーザー rlangevinrlangevin
提出日時 2023-02-06 01:19:56
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 602 bytes
コンパイル時間 1,266 ms
コンパイル使用メモリ 86,720 KB
実行使用メモリ 150,780 KB
最終ジャッジ日時 2023-09-17 14:46:11
合計ジャッジ時間 21,255 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 190 ms
116,740 KB
testcase_01 AC 107 ms
84,884 KB
testcase_02 AC 119 ms
84,460 KB
testcase_03 AC 132 ms
85,552 KB
testcase_04 AC 125 ms
85,248 KB
testcase_05 AC 125 ms
85,320 KB
testcase_06 AC 127 ms
85,068 KB
testcase_07 AC 123 ms
85,096 KB
testcase_08 AC 109 ms
84,600 KB
testcase_09 AC 116 ms
84,956 KB
testcase_10 AC 122 ms
85,084 KB
testcase_11 AC 108 ms
84,864 KB
testcase_12 AC 109 ms
84,656 KB
testcase_13 TLE -
testcase_14 TLE -
testcase_15 TLE -
testcase_16 TLE -
testcase_17 TLE -
testcase_18 AC 1,496 ms
150,780 KB
testcase_19 TLE -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import *

def div(n):
    if n <= 0:
        return []
    S = set()
    i = 1
    while i * i <= n:
        if n % i == 0:
            S.add(i)
            S.add(n // i)
        i += 1
    return list(S)

N = int(input())
A = list(map(int, input().split()))
D = defaultdict(int)
for a in A:
    D[a] += 1
    
M = 1010101
L = [0] * M
for k, v in D.items():
    for j in div(k):
        L[j] += v
            
for i in range(M-2, -1, -1):
    L[i] = max(L[i], L[i + 1])
    
now = 1
for i in range(N):
    while L[now] + i >= N and L[now + 1] + i >= N:
        now += 1
    print(now) 
0