結果

問題 No.2027 (1, 2, 3, …, N) 's Subset Sum
ユーザー cookie63
提出日時 2023-04-15 14:07:32
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 70 ms / 2,000 ms
コード長 221 bytes
コンパイル時間 162 ms
コンパイル使用メモリ 82,316 KB
実行使用メモリ 85,760 KB
最終ジャッジ日時 2024-10-11 01:10:33
合計ジャッジ時間 3,913 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

n, s = map(int, input().split())
ans = []
for i in range(n, 0, -1):
    if s>=i:
        s -= i
        ans.append(i)
if s>0:
    print(-1)
else:
    ans = ans[::-1]
    print(len(ans))
    print(" ".join(map(str, ans)))
0