結果

問題 No.2027 (1, 2, 3, …, N) 's Subset Sum
ユーザー MasKoaTSMasKoaTS
提出日時 2022-08-05 22:28:07
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,178 bytes
コンパイル時間 1,827 ms
コンパイル使用メモリ 86,332 KB
実行使用メモリ 105,528 KB
最終ジャッジ日時 2023-10-13 23:45:33
合計ジャッジ時間 9,734 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 196 ms
80,504 KB
testcase_01 AC 204 ms
80,492 KB
testcase_02 WA -
testcase_03 AC 210 ms
80,920 KB
testcase_04 AC 269 ms
105,412 KB
testcase_05 AC 260 ms
105,400 KB
testcase_06 AC 257 ms
105,528 KB
testcase_07 AC 223 ms
87,524 KB
testcase_08 AC 247 ms
102,884 KB
testcase_09 AC 215 ms
85,032 KB
testcase_10 AC 240 ms
94,232 KB
testcase_11 AC 227 ms
86,396 KB
testcase_12 AC 225 ms
89,468 KB
testcase_13 AC 227 ms
87,496 KB
testcase_14 AC 222 ms
84,732 KB
testcase_15 AC 225 ms
88,228 KB
testcase_16 AC 238 ms
92,596 KB
testcase_17 AC 202 ms
80,860 KB
testcase_18 AC 207 ms
81,052 KB
testcase_19 AC 203 ms
80,888 KB
testcase_20 AC 216 ms
83,916 KB
testcase_21 AC 206 ms
81,116 KB
testcase_22 AC 242 ms
95,612 KB
testcase_23 AC 222 ms
88,600 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 223 ms
86,152 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):
	for i in range(1, n + 1):
		if(i == n * (n + 1) // 2 - s):
			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