結果

問題 No.2027 (1, 2, 3, …, N) 's Subset Sum
ユーザー harurunharurun
提出日時 2022-08-06 00:30:05
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 155 ms / 2,000 ms
コード長 160 bytes
コンパイル時間 87 ms
コンパイル使用メモリ 10,688 KB
実行使用メモリ 19,068 KB
最終ジャッジ日時 2023-10-14 02:47:50
合計ジャッジ時間 3,962 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,936 KB
testcase_01 AC 16 ms
7,828 KB
testcase_02 AC 155 ms
18,876 KB
testcase_03 AC 16 ms
7,820 KB
testcase_04 AC 153 ms
18,920 KB
testcase_05 AC 155 ms
19,068 KB
testcase_06 AC 153 ms
18,840 KB
testcase_07 AC 41 ms
9,552 KB
testcase_08 AC 122 ms
16,104 KB
testcase_09 AC 41 ms
8,756 KB
testcase_10 AC 68 ms
12,076 KB
testcase_11 AC 44 ms
9,268 KB
testcase_12 AC 53 ms
10,340 KB
testcase_13 AC 40 ms
9,848 KB
testcase_14 AC 27 ms
9,172 KB
testcase_15 AC 53 ms
9,728 KB
testcase_16 AC 62 ms
11,168 KB
testcase_17 AC 16 ms
7,776 KB
testcase_18 AC 16 ms
7,840 KB
testcase_19 AC 16 ms
7,784 KB
testcase_20 AC 16 ms
7,868 KB
testcase_21 AC 16 ms
7,796 KB
testcase_22 AC 94 ms
14,196 KB
testcase_23 AC 58 ms
11,384 KB
testcase_24 AC 27 ms
9,196 KB
testcase_25 AC 109 ms
15,736 KB
testcase_26 AC 38 ms
10,092 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,S=map(int,input().split())
A=[]
for i in range(N,0,-1):
  if S-i>=0:
    A.append(i)
    S-=i
A=A[::-1]
if S==0:
  print(len(A))
  print(*A)
else:
  print(-1)
0