結果

問題 No.2027 (1, 2, 3, …, N) 's Subset Sum
ユーザー MasKoaTSMasKoaTS
提出日時 2022-08-05 22:04:18
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,051 bytes
コンパイル時間 1,044 ms
コンパイル使用メモリ 87,320 KB
実行使用メモリ 106,408 KB
最終ジャッジ日時 2023-10-13 23:03:15
合計ジャッジ時間 12,374 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 204 ms
81,396 KB
testcase_01 AC 205 ms
81,548 KB
testcase_02 AC 251 ms
105,404 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 260 ms
106,364 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 221 ms
85,040 KB
testcase_10 AC 238 ms
94,560 KB
testcase_11 AC 229 ms
86,708 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import itertools as iter
import collections as coll
import heapq as hq
import bisect as bis
from decimal import Decimal as dec
from functools import cmp_to_key
import math
import sys
#import pypyjit
#pypyjit.set_param('max_unroll_recursion=-1')
sys.setrecursionlimit(10 ** 6)
inp = sys.stdin.readline
input = lambda : inp().rstrip()
getN = lambda : int(inp())
getNs = lambda : map(int, inp().split())
getList = lambda :list(map(int, inp().split()))
getStrs = lambda n : [input() for _ in [0] * n]
def yexit(): print("Yes"); exit(0)
def nexit(): print("No"); exit(0)
pi = 3.141592653589793
mod = 1000000007
MOD = 998244353
INF = 4611686018427387903
dx = [1, 0, -1, 0];	dy = [0, 1, 0, -1]


"""
Main Code
"""

n, s = getNs()
d = s // (n + 1)
r = s % (n + 1)

ans = []

if(d < n // 2):
	if(r > 0):
		ans.append(r)
	for i in range(1, d + (r > 0)):
		if(r in [i, n + 1 - i]):
			continue
		ans.append(i)
		ans.append(n + 1 - i)
	ans.sort()
else:
	for i in range(1, n + 1):
		if(i == r):
			continue
		ans.append(i)
	ans.sort()

print(len(ans))
print(*ans)
0