結果

問題 No.2027 (1, 2, 3, …, N) 's Subset Sum
ユーザー えいじえいじ
提出日時 2023-10-06 20:12:29
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 158 ms / 2,000 ms
コード長 216 bytes
コンパイル時間 176 ms
コンパイル使用メモリ 10,672 KB
実行使用メモリ 19,420 KB
最終ジャッジ日時 2023-10-06 20:12:33
合計ジャッジ時間 3,932 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
7,856 KB
testcase_01 AC 16 ms
7,916 KB
testcase_02 AC 158 ms
19,256 KB
testcase_03 AC 15 ms
7,988 KB
testcase_04 AC 158 ms
19,420 KB
testcase_05 AC 158 ms
19,220 KB
testcase_06 AC 153 ms
19,372 KB
testcase_07 AC 37 ms
9,792 KB
testcase_08 AC 122 ms
16,184 KB
testcase_09 AC 27 ms
8,812 KB
testcase_10 AC 67 ms
11,964 KB
testcase_11 AC 33 ms
9,312 KB
testcase_12 AC 46 ms
10,508 KB
testcase_13 AC 41 ms
10,084 KB
testcase_14 AC 27 ms
9,248 KB
testcase_15 AC 52 ms
9,972 KB
testcase_16 AC 57 ms
11,076 KB
testcase_17 AC 16 ms
7,852 KB
testcase_18 AC 16 ms
7,820 KB
testcase_19 AC 16 ms
7,780 KB
testcase_20 AC 17 ms
7,872 KB
testcase_21 AC 16 ms
7,868 KB
testcase_22 AC 95 ms
14,620 KB
testcase_23 AC 59 ms
11,824 KB
testcase_24 AC 28 ms
9,188 KB
testcase_25 AC 112 ms
15,592 KB
testcase_26 AC 39 ms
10,116 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, s = [int(x) for x in input().split()]
ans = []
for i in range(n, -1, -1):
    if i <= s:
        s -= i
        ans.append(i)
    if s == 0:
        break
else:
    print(-1)
print(len(ans))
print(*reversed(ans))
0