結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 213 ms
81,264 KB
testcase_01 AC 210 ms
81,276 KB
testcase_02 AC 268 ms
106,248 KB
testcase_03 AC 211 ms
81,280 KB
testcase_04 AC 271 ms
105,748 KB
testcase_05 AC 272 ms
105,968 KB
testcase_06 AC 267 ms
106,228 KB
testcase_07 AC 232 ms
87,844 KB
testcase_08 AC 263 ms
103,048 KB
testcase_09 AC 225 ms
84,784 KB
testcase_10 AC 247 ms
94,536 KB
testcase_11 AC 226 ms
86,624 KB
testcase_12 AC 231 ms
89,768 KB
testcase_13 AC 229 ms
87,620 KB
testcase_14 AC 226 ms
84,736 KB
testcase_15 AC 228 ms
88,268 KB
testcase_16 AC 244 ms
92,940 KB
testcase_17 AC 211 ms
81,296 KB
testcase_18 AC 208 ms
81,380 KB
testcase_19 AC 208 ms
81,020 KB
testcase_20 AC 226 ms
84,272 KB
testcase_21 AC 212 ms
81,380 KB
testcase_22 AC 247 ms
96,100 KB
testcase_23 AC 236 ms
89,200 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 232 ms
86,308 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 = []
t = r
i = 0
if(r > 0):
	ans.append(r)
while(i <= n // 2 + (n & 1) and 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