結果

問題 No.2027 (1, 2, 3, …, N) 's Subset Sum
ユーザー 8nd5t8nd5t
提出日時 2022-08-05 21:22:40
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 287 ms / 2,000 ms
コード長 800 bytes
コンパイル時間 714 ms
コンパイル使用メモリ 86,856 KB
実行使用メモリ 116,528 KB
最終ジャッジ日時 2023-10-13 21:42:22
合計ジャッジ時間 9,794 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 231 ms
91,352 KB
testcase_01 AC 233 ms
91,200 KB
testcase_02 AC 282 ms
116,256 KB
testcase_03 AC 233 ms
91,320 KB
testcase_04 AC 282 ms
116,304 KB
testcase_05 AC 287 ms
116,528 KB
testcase_06 AC 282 ms
116,460 KB
testcase_07 AC 242 ms
93,884 KB
testcase_08 AC 272 ms
109,916 KB
testcase_09 AC 241 ms
92,388 KB
testcase_10 AC 257 ms
101,216 KB
testcase_11 AC 250 ms
92,736 KB
testcase_12 AC 250 ms
95,576 KB
testcase_13 AC 243 ms
94,324 KB
testcase_14 AC 243 ms
92,748 KB
testcase_15 AC 251 ms
93,936 KB
testcase_16 AC 258 ms
96,352 KB
testcase_17 AC 243 ms
91,776 KB
testcase_18 AC 236 ms
91,144 KB
testcase_19 AC 235 ms
91,156 KB
testcase_20 AC 235 ms
92,064 KB
testcase_21 AC 237 ms
91,296 KB
testcase_22 AC 264 ms
106,116 KB
testcase_23 AC 248 ms
97,124 KB
testcase_24 AC 241 ms
92,396 KB
testcase_25 AC 274 ms
109,128 KB
testcase_26 AC 244 ms
94,328 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
from bisect import bisect_left,bisect_right 
import sys,math,itertools,pprint,fractions
sys.setrecursionlimit(10**8)
mod = 998244353
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_1(): return list(map(lambda x:int(x)-1, sys.stdin.readline().split()))
def inplm(): return map(int, sys.stdin.readline().split())
def inpl_1m(): return map(lambda x:int(x)-1, sys.stdin.readline().split())
def err(x): print(x); exit()

n,s = inpl()
if (1+n)*n//2 < s:
    print(-1)
else:
    res = []
    for i in range(1,n+1)[::-1]:
        if i <= s:
            res.append(i)
            s -= i
    print(len(res))
    print(*res[::-1])
0