結果

問題 No.688 E869120 and Constructing Array 2
ユーザー ssmkzkssmkzk
提出日時 2019-07-04 03:30:13
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
AC  
実行時間 847 ms / 1,000 ms
コード長 424 bytes
コンパイル時間 96 ms
コンパイル使用メモリ 11,900 KB
実行使用メモリ 54,772 KB
最終ジャッジ日時 2023-10-17 18:38:00
合計ジャッジ時間 4,883 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 793 ms
54,768 KB
testcase_01 AC 825 ms
54,768 KB
testcase_02 AC 821 ms
54,768 KB
testcase_03 AC 826 ms
54,768 KB
testcase_04 AC 830 ms
54,768 KB
testcase_05 AC 832 ms
54,768 KB
testcase_06 AC 847 ms
54,768 KB
testcase_07 AC 839 ms
54,764 KB
testcase_08 AC 833 ms
54,768 KB
testcase_09 AC 819 ms
54,768 KB
testcase_10 AC 819 ms
54,772 KB
testcase_11 AC 821 ms
54,772 KB
testcase_12 AC 806 ms
54,772 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from scipy.special import comb
import sys
K = int(input())

if K == 0:
    print(1)
    print(0)
    sys.exit()

for i in range(2,31):
    two_ch = comb(i,2,exact=True)
    for j in range(31-i):
        ans = 0
        for k in range(j+1):
            one_ch = comb(j,k,exact=True)
            ans += two_ch * one_ch
        if ans == K:
            print(i + j)
            print("1 "*i + "0 "* j )
            sys.exit()

0