結果

問題 No.688 E869120 and Constructing Array 2
ユーザー takakintakakin
提出日時 2020-05-28 22:23:55
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 18 ms / 1,000 ms
コード長 576 bytes
コンパイル時間 241 ms
コンパイル使用メモリ 10,976 KB
実行使用メモリ 8,916 KB
最終ジャッジ日時 2023-08-03 14:55:27
合計ジャッジ時間 1,502 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 18 ms
8,704 KB
testcase_01 AC 17 ms
8,892 KB
testcase_02 AC 17 ms
8,764 KB
testcase_03 AC 17 ms
8,880 KB
testcase_04 AC 17 ms
8,868 KB
testcase_05 AC 18 ms
8,916 KB
testcase_06 AC 17 ms
8,780 KB
testcase_07 AC 16 ms
8,780 KB
testcase_08 AC 16 ms
8,824 KB
testcase_09 AC 17 ms
8,840 KB
testcase_10 AC 17 ms
8,864 KB
testcase_11 AC 16 ms
8,844 KB
testcase_12 AC 17 ms
8,860 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input=lambda: sys.stdin.readline().rstrip()
n=int(input())
import collections
pf=collections.defaultdict(int)
for i in range(2,int(n**0.5)+1):
  while n%i==0:
    pf[i]=pf.get(i,0)+1
    n//=i
if n>1:
  pf[n]=1
if len(pf.keys())==1:
  ans1=2
  ans2=pf[2]
else:
  m=1
  ct2=pf[2]
  for p in pf.keys():
    if p!=2:
      m*=p**pf[p]
  for i in range(ct2+2):
    if int(m**0.5)*(int(m**0.5)+1)==m:
      ans1=int(m**0.5)+1
      ans2=ct2-i+1
      break
    else:
      m*=2
if n==0:
  print(1)
  print(1)
else:
  Ans=[1]*ans1+[0]*ans2
  print(len(Ans))
  print(*Ans)
0