結果

問題 No.2027 (1, 2, 3, …, N) 's Subset Sum
ユーザー SidewaysOwlSidewaysOwl
提出日時 2022-08-05 21:29:37
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 128 ms / 2,000 ms
コード長 172 bytes
コンパイル時間 303 ms
コンパイル使用メモリ 87,048 KB
実行使用メモリ 103,164 KB
最終ジャッジ日時 2023-10-13 21:58:51
合計ジャッジ時間 4,873 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
71,360 KB
testcase_01 AC 70 ms
71,452 KB
testcase_02 AC 128 ms
103,044 KB
testcase_03 AC 71 ms
71,444 KB
testcase_04 AC 123 ms
103,164 KB
testcase_05 AC 124 ms
103,040 KB
testcase_06 AC 127 ms
103,028 KB
testcase_07 AC 87 ms
79,936 KB
testcase_08 AC 114 ms
95,828 KB
testcase_09 AC 90 ms
79,280 KB
testcase_10 AC 98 ms
85,980 KB
testcase_11 AC 89 ms
79,820 KB
testcase_12 AC 91 ms
81,772 KB
testcase_13 AC 87 ms
80,004 KB
testcase_14 AC 87 ms
77,096 KB
testcase_15 AC 91 ms
81,812 KB
testcase_16 AC 97 ms
84,656 KB
testcase_17 AC 78 ms
75,564 KB
testcase_18 AC 75 ms
71,424 KB
testcase_19 AC 73 ms
71,340 KB
testcase_20 AC 78 ms
75,816 KB
testcase_21 AC 74 ms
71,104 KB
testcase_22 AC 108 ms
90,948 KB
testcase_23 AC 95 ms
84,344 KB
testcase_24 AC 84 ms
77,480 KB
testcase_25 AC 110 ms
94,528 KB
testcase_26 AC 87 ms
79,516 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,s = map(int,input().split())
l = [i+1 for i in range(n)]

ans = []
for e in l[::-1]:
    if s >= e:
        s -= e
        ans.append(e)
print(len(ans))
print(*ans[::-1])
0