結果

問題 No.2027 (1, 2, 3, …, N) 's Subset Sum
ユーザー shirokumashirokuma
提出日時 2022-08-08 23:52:11
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 326 bytes
コンパイル時間 1,139 ms
コンパイル使用メモリ 81,560 KB
実行使用メモリ 96,848 KB
最終ジャッジ日時 2023-10-19 11:38:26
合計ジャッジ時間 4,378 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,272 KB
testcase_01 AC 37 ms
53,272 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 91 ms
96,480 KB
testcase_07 AC 55 ms
70,044 KB
testcase_08 AC 79 ms
90,076 KB
testcase_09 AC 49 ms
63,640 KB
testcase_10 AC 66 ms
81,792 KB
testcase_11 AC 52 ms
66,964 KB
testcase_12 AC 56 ms
73,280 KB
testcase_13 AC 55 ms
70,604 KB
testcase_14 AC 51 ms
65,304 KB
testcase_15 AC 53 ms
69,016 KB
testcase_16 AC 59 ms
75,768 KB
testcase_17 AC 40 ms
52,156 KB
testcase_18 AC 40 ms
52,016 KB
testcase_19 AC 39 ms
51,844 KB
testcase_20 AC 41 ms
52,488 KB
testcase_21 AC 40 ms
52,272 KB
testcase_22 WA -
testcase_23 AC 64 ms
80,904 KB
testcase_24 AC 51 ms
65,524 KB
testcase_25 AC 79 ms
89,448 KB
testcase_26 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#yuki1915
N, K = map(int, input().split())
if K <= N:
    print(K)
    exit()
if K > N*(N+1)//2:
    print(-1)
    exit()

ans = []
temp = K
for i in range(N, 0, -1):
    temp -= i
    ans.append(i)
    if temp < i -1:
        ans.append(temp)
        ans.reverse()
        print(len(ans))
        print(*ans)
        exit()

0