結果

問題 No.2027 (1, 2, 3, …, N) 's Subset Sum
ユーザー 👑 KazunKazun
提出日時 2022-08-05 21:23:02
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 203 bytes
コンパイル時間 1,031 ms
コンパイル使用メモリ 86,988 KB
実行使用メモリ 100,068 KB
最終ジャッジ日時 2023-10-13 21:44:06
合計ジャッジ時間 6,229 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,556 KB
testcase_01 AC 70 ms
71,532 KB
testcase_02 AC 123 ms
100,060 KB
testcase_03 AC 71 ms
71,492 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 122 ms
99,976 KB
testcase_07 AC 87 ms
78,828 KB
testcase_08 AC 114 ms
93,320 KB
testcase_09 AC 84 ms
77,964 KB
testcase_10 AC 98 ms
84,480 KB
testcase_11 AC 85 ms
78,688 KB
testcase_12 AC 88 ms
80,552 KB
testcase_13 AC 87 ms
79,012 KB
testcase_14 AC 83 ms
76,928 KB
testcase_15 AC 88 ms
80,032 KB
testcase_16 AC 97 ms
83,196 KB
testcase_17 AC 76 ms
75,504 KB
testcase_18 AC 71 ms
71,340 KB
testcase_19 AC 72 ms
71,432 KB
testcase_20 AC 77 ms
75,572 KB
testcase_21 AC 71 ms
71,536 KB
testcase_22 WA -
testcase_23 AC 96 ms
83,004 KB
testcase_24 AC 84 ms
77,084 KB
testcase_25 AC 112 ms
92,320 KB
testcase_26 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

N,S=map(int,input().split())

A=[0]*(N+1)
for i in range(N,0,-1):
    if S>=i:
        A[i]=1
        S-=i
    else:
        A[S]=1
        break

print(sum(A))
print(*[i for i in range(1,N+1) if A[i]])
0