結果
問題 | No.2027 (1, 2, 3, …, N) 's Subset Sum |
ユーザー | MasKoaTS |
提出日時 | 2022-08-05 21:47:55 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,185 bytes |
コンパイル時間 | 539 ms |
コンパイル使用メモリ | 86,864 KB |
実行使用メモリ | 93,604 KB |
最終ジャッジ日時 | 2023-10-13 22:28:02 |
合計ジャッジ時間 | 5,707 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 188 ms
85,188 KB |
testcase_01 | AC | 195 ms
81,008 KB |
testcase_02 | AC | 250 ms
93,604 KB |
testcase_03 | AC | 225 ms
80,812 KB |
testcase_04 | TLE | - |
testcase_05 | -- | - |
testcase_06 | -- | - |
testcase_07 | -- | - |
testcase_08 | -- | - |
testcase_09 | -- | - |
testcase_10 | -- | - |
testcase_11 | -- | - |
testcase_12 | -- | - |
testcase_13 | -- | - |
testcase_14 | -- | - |
testcase_15 | -- | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
testcase_22 | -- | - |
testcase_23 | -- | - |
testcase_24 | -- | - |
testcase_25 | -- | - |
testcase_26 | -- | - |
ソースコード
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): if(r > 0): ans.append(r) i = 1 while(i <= d): if(r in [i, n + 1 - i]): continue ans.append(i) ans.append(n + 1 - i) i += 1 ans.sort() elif(n & 1): if(s == n * (n + 1) // 2): ans = [i for i in range(1, n + 1)] elif(s == d * (n + 1)): ans = [i * (i != r) for i in range(1, n + 1)] else: print(-1) exit(0) else: ans = [i for i in range(1, n + 1)] print(len(ans)) print(*ans)