結果

問題 No.2027 (1, 2, 3, …, N) 's Subset Sum
ユーザー MasKoaTSMasKoaTS
提出日時 2022-08-05 22:25:46
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,169 bytes
コンパイル時間 1,722 ms
コンパイル使用メモリ 87,076 KB
実行使用メモリ 106,212 KB
最終ジャッジ日時 2023-10-13 23:41:47
合計ジャッジ時間 9,519 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 191 ms
81,580 KB
testcase_01 AC 189 ms
81,616 KB
testcase_02 AC 256 ms
106,212 KB
testcase_03 AC 195 ms
81,560 KB
testcase_04 AC 247 ms
105,804 KB
testcase_05 AC 247 ms
105,836 KB
testcase_06 AC 248 ms
106,100 KB
testcase_07 AC 214 ms
87,964 KB
testcase_08 AC 243 ms
103,172 KB
testcase_09 AC 200 ms
85,448 KB
testcase_10 AC 215 ms
94,504 KB
testcase_11 AC 203 ms
86,908 KB
testcase_12 AC 223 ms
90,220 KB
testcase_13 AC 216 ms
88,000 KB
testcase_14 AC 213 ms
84,848 KB
testcase_15 AC 205 ms
88,672 KB
testcase_16 AC 214 ms
93,356 KB
testcase_17 AC 189 ms
81,312 KB
testcase_18 AC 188 ms
81,568 KB
testcase_19 AC 207 ms
81,560 KB
testcase_20 AC 198 ms
84,508 KB
testcase_21 AC 190 ms
81,444 KB
testcase_22 AC 233 ms
96,048 KB
testcase_23 AC 219 ms
89,032 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 215 ms
86,656 KB
権限があれば一括ダウンロードができます

ソースコード

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)

if(n == s and s == 1):
	print(1)
	print(1)
	exit(0)

ans = []
if(d == n // 2 and r > 0):
	for i in range(1, n + 1):
		if(i == r):
			continue
		ans.append(i)
	print(*ans)
	exit(0)

t = r
i = 0
if(r > 0):
	ans.append(r)
while(t < s):
	#print(t)
	i += 1
	if(r in [i, n + 1 - i]):
		continue
	ans.append(i)
	ans.append(n + 1 - i)
	t += n + 1
ans.sort()

if(t != s):
	print(-1)
	exit(0)

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