結果

問題 No.2027 (1, 2, 3, …, N) 's Subset Sum
ユーザー mkawa2mkawa2
提出日時 2022-08-05 21:41:34
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 127 ms / 2,000 ms
コード長 860 bytes
コンパイル時間 479 ms
コンパイル使用メモリ 86,696 KB
実行使用メモリ 99,776 KB
最終ジャッジ日時 2023-10-13 22:18:13
合計ジャッジ時間 5,310 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
70,948 KB
testcase_01 AC 77 ms
70,952 KB
testcase_02 AC 125 ms
99,576 KB
testcase_03 AC 73 ms
71,052 KB
testcase_04 AC 123 ms
99,776 KB
testcase_05 AC 124 ms
99,712 KB
testcase_06 AC 127 ms
99,748 KB
testcase_07 AC 92 ms
78,336 KB
testcase_08 AC 113 ms
92,740 KB
testcase_09 AC 87 ms
76,484 KB
testcase_10 AC 102 ms
83,884 KB
testcase_11 AC 90 ms
77,412 KB
testcase_12 AC 92 ms
79,904 KB
testcase_13 AC 93 ms
78,812 KB
testcase_14 AC 85 ms
76,240 KB
testcase_15 AC 90 ms
78,216 KB
testcase_16 AC 99 ms
82,040 KB
testcase_17 AC 76 ms
75,412 KB
testcase_18 AC 75 ms
71,072 KB
testcase_19 AC 72 ms
71,288 KB
testcase_20 AC 75 ms
75,356 KB
testcase_21 AC 74 ms
71,088 KB
testcase_22 AC 110 ms
89,076 KB
testcase_23 AC 97 ms
82,984 KB
testcase_24 AC 85 ms
77,008 KB
testcase_25 AC 110 ms
92,320 KB
testcase_26 AC 88 ms
78,920 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

# sys.setrecursionlimit(200005)
int1 = lambda x: int(x)-1
pDB = lambda *x: print(*x, end="\n", file=sys.stderr)
p2D = lambda x: print(*x, sep="\n", end="\n\n", file=sys.stderr)
def II(): return int(sys.stdin.readline())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]
def SI(): return sys.stdin.readline().rstrip()
# dij = [(0, 1), (-1, 0), (0, -1), (1, 0)]
# dij = [(0, 1), (-1, 0), (0, -1), (1, 0), (1, 1), (1, -1), (-1, 1), (-1, -1)]
inf = (1 << 63)-1
# inf = (1 << 31)-1
# md = 10**9+7
md = 998244353

n, s = LI()
ans = []
for a in range(n, 0, -1):
    if a <= s:
        ans.append(a)
        s -= a

print(len(ans))
print(*ans[::-1])
0