結果

問題 No.2081 Make a Test Case of GCD Subset
ユーザー flygonflygon
提出日時 2022-09-26 20:18:28
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 724 bytes
コンパイル時間 285 ms
コンパイル使用メモリ 87,176 KB
実行使用メモリ 78,640 KB
最終ジャッジ日時 2023-08-24 03:02:46
合計ジャッジ時間 7,931 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 113 ms
78,456 KB
testcase_01 AC 111 ms
78,500 KB
testcase_02 AC 110 ms
78,296 KB
testcase_03 AC 110 ms
78,504 KB
testcase_04 AC 111 ms
78,388 KB
testcase_05 AC 110 ms
78,368 KB
testcase_06 AC 110 ms
78,616 KB
testcase_07 AC 111 ms
78,364 KB
testcase_08 AC 111 ms
78,592 KB
testcase_09 AC 111 ms
78,448 KB
testcase_10 AC 110 ms
78,588 KB
testcase_11 AC 109 ms
78,128 KB
testcase_12 AC 110 ms
78,596 KB
testcase_13 AC 109 ms
78,432 KB
testcase_14 AC 112 ms
78,436 KB
testcase_15 AC 110 ms
78,552 KB
testcase_16 AC 114 ms
78,520 KB
testcase_17 AC 112 ms
78,168 KB
testcase_18 AC 110 ms
78,160 KB
testcase_19 AC 115 ms
78,332 KB
testcase_20 AC 111 ms
78,348 KB
testcase_21 AC 72 ms
71,380 KB
testcase_22 AC 110 ms
78,464 KB
testcase_23 WA -
testcase_24 AC 112 ms
78,396 KB
testcase_25 AC 109 ms
78,332 KB
testcase_26 AC 110 ms
78,556 KB
testcase_27 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

m = int(input())
if m == 0:
  print(1)
  print(1)
  exit()
def e(n): #O(NloglogN)
  l = [True]*(n+1)
  l[0] = False
  l[1] = False
  for i in range(2,n):
    if l[i]:
      for p in range(i+i,n+1,i):
        l[p] = False
  return l

t = e(10**5)
pn = []
for i in range(2, 10**5):
  if t[i]:
    pn.append(i)

now = 0
left = m
bits = []
while left:
  if left & 1:
    bits.append(now)
  left >>= 1
  now += 1

from collections import deque
que = deque(pn)
koho = []
for i in bits:
  pn = que.popleft()
  for j in range(i):
    koho.append(pn)
  koho.append(que.pop())

ans = set()
koho.sort(key = lambda x:-x)
for i in koho:
  if i not in ans:
    ans.add(i)
  else:
    ans.add(i*que.popleft())
print(len(ans))
print(*ans)

0