結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 109 ms
78,284 KB
testcase_01 AC 114 ms
78,360 KB
testcase_02 AC 115 ms
78,172 KB
testcase_03 AC 112 ms
78,436 KB
testcase_04 AC 110 ms
78,504 KB
testcase_05 AC 111 ms
78,356 KB
testcase_06 AC 110 ms
78,372 KB
testcase_07 AC 110 ms
78,352 KB
testcase_08 AC 111 ms
78,384 KB
testcase_09 AC 113 ms
78,292 KB
testcase_10 AC 110 ms
78,356 KB
testcase_11 AC 111 ms
78,592 KB
testcase_12 AC 112 ms
78,332 KB
testcase_13 AC 112 ms
78,572 KB
testcase_14 AC 112 ms
78,440 KB
testcase_15 AC 110 ms
78,292 KB
testcase_16 AC 111 ms
78,136 KB
testcase_17 AC 111 ms
78,616 KB
testcase_18 AC 113 ms
78,512 KB
testcase_19 AC 117 ms
78,172 KB
testcase_20 AC 114 ms
78,444 KB
testcase_21 WA -
testcase_22 AC 113 ms
78,120 KB
testcase_23 WA -
testcase_24 AC 111 ms
78,580 KB
testcase_25 AC 112 ms
78,352 KB
testcase_26 AC 110 ms
78,372 KB
testcase_27 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

m = int(input())

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