結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 210 ms
81,356 KB
testcase_01 AC 212 ms
81,336 KB
testcase_02 AC 269 ms
105,796 KB
testcase_03 WA -
testcase_04 AC 272 ms
105,776 KB
testcase_05 AC 269 ms
105,372 KB
testcase_06 AC 267 ms
105,848 KB
testcase_07 AC 228 ms
87,684 KB
testcase_08 AC 261 ms
103,144 KB
testcase_09 AC 227 ms
84,720 KB
testcase_10 AC 241 ms
94,044 KB
testcase_11 AC 225 ms
86,728 KB
testcase_12 AC 238 ms
89,784 KB
testcase_13 AC 232 ms
87,500 KB
testcase_14 AC 228 ms
84,764 KB
testcase_15 AC 234 ms
87,916 KB
testcase_16 AC 245 ms
92,712 KB
testcase_17 AC 214 ms
81,280 KB
testcase_18 AC 210 ms
81,360 KB
testcase_19 AC 207 ms
81,380 KB
testcase_20 AC 220 ms
84,372 KB
testcase_21 AC 210 ms
81,104 KB
testcase_22 AC 248 ms
95,960 KB
testcase_23 AC 238 ms
88,612 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 229 ms
86,416 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)

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