結果

問題 No.2027 (1, 2, 3, …, N) 's Subset Sum
ユーザー Schnee
提出日時 2022-08-18 23:45:45
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
TLE  
実行時間 -
コード長 236 bytes
コンパイル時間 175 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 22,824 KB
最終ジャッジ日時 2024-10-06 21:43:46
合計ジャッジ時間 4,539 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other TLE * 1 -- * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

n,s = map(int, input().split())

t = 0
c = 0
l = []
for i in range(n):
    x = n-i
    if (t+x)<=s:
        l.insert(0, x)
        t += x
        c += 1
    if t == s:
        print(c)
        print(*l)
        break
else:
    print(-1)
0