結果

問題 No.2081 Make a Test Case of GCD Subset
ユーザー shotoyooshotoyoo
提出日時 2022-09-25 23:38:00
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,835 bytes
コンパイル時間 465 ms
コンパイル使用メモリ 86,960 KB
実行使用メモリ 83,492 KB
最終ジャッジ日時 2023-08-24 02:34:50
合計ジャッジ時間 8,523 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 133 ms
83,036 KB
testcase_01 AC 130 ms
83,128 KB
testcase_02 AC 132 ms
82,748 KB
testcase_03 AC 133 ms
83,152 KB
testcase_04 AC 134 ms
83,204 KB
testcase_05 AC 133 ms
83,044 KB
testcase_06 AC 133 ms
83,124 KB
testcase_07 AC 133 ms
83,040 KB
testcase_08 AC 136 ms
83,108 KB
testcase_09 AC 133 ms
82,992 KB
testcase_10 AC 135 ms
82,844 KB
testcase_11 AC 132 ms
82,824 KB
testcase_12 AC 133 ms
82,876 KB
testcase_13 AC 133 ms
83,168 KB
testcase_14 AC 137 ms
83,168 KB
testcase_15 AC 132 ms
83,012 KB
testcase_16 AC 134 ms
83,160 KB
testcase_17 AC 137 ms
82,820 KB
testcase_18 AC 134 ms
82,940 KB
testcase_19 AC 134 ms
83,272 KB
testcase_20 AC 134 ms
83,320 KB
testcase_21 WA -
testcase_22 AC 134 ms
83,056 KB
testcase_23 AC 132 ms
82,932 KB
testcase_24 AC 131 ms
83,020 KB
testcase_25 AC 136 ms
82,992 KB
testcase_26 AC 133 ms
82,852 KB
testcase_27 AC 135 ms
83,152 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys, random
input = lambda : sys.stdin.readline().rstrip()


write = lambda x: sys.stdout.write(x+"\n"); writef = lambda x: print("{:.12f}".format(x))
debug = lambda x: sys.stderr.write(x+"\n")
YES="Yes"; NO="No"; pans = lambda v: print(YES if v else NO); INF=10**18
LI = lambda : list(map(int, input().split())); II=lambda : int(input()); SI=lambda : [ord(c)-ord("a") for c in input()]
def debug(_l_):
    for s in _l_.split():
        print(f"{s}={eval(s)}", end=" ")
    print()
def dlist(*l, fill=0):
    if len(l)==1:
        return [fill]*l[0]
    ll = l[1:]
    return [dlist(*ll, fill=fill) for _ in range(l[0])]

def hurui(n):
    """線形篩
    pl: 素数のリスト
    mpf: iを割り切る最小の素因数
    """
    pl = []
    mpf = [None]*(n+1)
    for d in range(2,n+1):
        if mpf[d] is None:
            mpf[d] = d
            pl.append(d)
        for p in pl:
            if p*d>n or p>mpf[d]:
                break
            mpf[p*d] = p
    return pl, mpf
from collections import defaultdict
def factor(num):
    d = defaultdict(int)
    if num==1:
        d.update({1:1})
        return d
    while num>1:
        d[mpf[num]] += 1
        num //= mpf[num]
    return d
def fs(num):
    f = factor(num)
    ans = [1]
    for k,v in f.items():
        tmp = []
        for i in range(len(ans)):
            val = 1
            for _ in range(v):
                val *= k
                ans.append(ans[i]*val)
    return ans
pl, mpf = hurui(100000)
ps = set(pl)
ind = 0
n = int(input())
ans = []
vs = []
while n:
    v = 1
    while ((1<<(v+1))-1)<=n:
        v += 1
    vs.append(v)
    n -= (1<<v)-1
ind = len(vs)
for i in range(len(vs)):
    v = vs[i]
    p = pl[len(vs)-1-i]
    for i in range(v):
        ans.append(p*pl[ind])
        ind += 1
print(len(ans))
write(" ".join(map(str, ans)))
0