結果

問題 No.689 E869120 and Constructing Array 3
ユーザー daku9640daku9640
提出日時 2018-05-19 00:40:47
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 435 bytes
コンパイル時間 113 ms
コンパイル使用メモリ 10,556 KB
実行使用メモリ 8,104 KB
最終ジャッジ日時 2023-09-10 23:30:38
合計ジャッジ時間 3,825 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
7,924 KB
testcase_01 AC 17 ms
8,048 KB
testcase_02 AC 17 ms
8,104 KB
testcase_03 WA -
testcase_04 AC 18 ms
7,944 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 27 ms
7,968 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 36 ms
7,912 KB
testcase_11 WA -
testcase_12 AC 92 ms
7,880 KB
testcase_13 AC 16 ms
7,916 KB
testcase_14 AC 17 ms
7,988 KB
testcase_15 AC 17 ms
7,924 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import factorial
c = lambda y, x: factorial(y) // factorial(x) // factorial(y - x)
def solve():
    k = int(input())
    if k < 250:
        return [1] + [4] * k
    for i in range(2, 251):
        for j in range(2, 251 - i):
            if i * j + c(i, 2) == k:
                return [1] * i + [4] * j
            if c(i, 2) == k:
                return [2] * i + [3] * j
    return [0]
v = solve()
print(len(v))
print(*v)
0