結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 212 ms
80,692 KB
testcase_01 AC 212 ms
80,972 KB
testcase_02 AC 274 ms
106,060 KB
testcase_03 AC 211 ms
80,984 KB
testcase_04 AC 272 ms
105,640 KB
testcase_05 AC 274 ms
105,752 KB
testcase_06 AC 276 ms
105,932 KB
testcase_07 AC 233 ms
87,596 KB
testcase_08 AC 264 ms
103,160 KB
testcase_09 AC 227 ms
85,228 KB
testcase_10 AC 247 ms
94,512 KB
testcase_11 AC 232 ms
86,880 KB
testcase_12 AC 235 ms
89,756 KB
testcase_13 AC 227 ms
87,836 KB
testcase_14 AC 226 ms
84,728 KB
testcase_15 AC 233 ms
88,016 KB
testcase_16 AC 239 ms
92,888 KB
testcase_17 AC 206 ms
81,000 KB
testcase_18 AC 210 ms
81,256 KB
testcase_19 AC 205 ms
81,220 KB
testcase_20 AC 222 ms
84,180 KB
testcase_21 AC 209 ms
81,224 KB
testcase_22 AC 244 ms
95,716 KB
testcase_23 AC 234 ms
88,736 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 229 ms
86,364 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(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