結果

問題 No.2027 (1, 2, 3, …, N) 's Subset Sum
ユーザー MasKoaTSMasKoaTS
提出日時 2022-08-05 21:52:36
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,186 bytes
コンパイル時間 286 ms
コンパイル使用メモリ 87,264 KB
実行使用メモリ 106,276 KB
最終ジャッジ日時 2023-10-13 22:35:45
合計ジャッジ時間 10,569 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 199 ms
81,452 KB
testcase_01 AC 197 ms
81,168 KB
testcase_02 AC 235 ms
93,944 KB
testcase_03 AC 200 ms
81,168 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 260 ms
106,100 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 205 ms
85,364 KB
testcase_10 AC 234 ms
94,264 KB
testcase_11 AC 218 ms
86,652 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()
elif(n & 1):
	if(s == n * (n + 1) // 2):
		ans = [i for i in range(1, n + 1)]
	elif(s == d * (n + 1)):
		ans = [i * (i != r) for i in range(1, n + 1)]
	else:
		print(-1)
		exit(0)
else:
	ans = [i for i in range(1, n + 1)]

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